@@ -20,6 +20,7 @@ use crate::arch::aarch64::kvm::OptionalCapabilities;
2020use  crate :: arch:: aarch64:: regs:: { Aarch64RegisterVec ,  KVM_REG_ARM64_SVE_VLS } ; 
2121use  crate :: cpu_config:: aarch64:: custom_cpu_template:: VcpuFeatures ; 
2222use  crate :: cpu_config:: templates:: CpuConfiguration ; 
23+ use  crate :: logger:: warn; 
2324use  crate :: logger:: { IncMetric ,  METRICS ,  error} ; 
2425use  crate :: vcpu:: { VcpuConfig ,  VcpuError } ; 
2526use  crate :: vstate:: memory:: { Address ,  GuestMemoryMmap } ; 
@@ -41,25 +42,18 @@ pub enum VcpuArchError {
4142     SetMp ( kvm_ioctls:: Error ) , 
4243    /// Failed FamStructWrapper operation: {0} 
4344     Fam ( vmm_sys_util:: fam:: Error ) , 
44-     /// {0} 
45-      GetMidrEl1 ( String ) , 
4645    /// Failed to set/get device attributes for vCPU: {0} 
4746     DeviceAttribute ( kvm_ioctls:: Error ) , 
4847} 
4948
5049/// Extract the Manufacturer ID from the host. 
5150/// The ID is found between bits 24-31 of MIDR_EL1 register. 
52- pub  fn  get_manufacturer_id_from_host ( )  -> Result < u32 ,   VcpuArchError >  { 
51+ pub  fn  get_manufacturer_id_from_host ( )  -> Option < u32 >  { 
5352    let  midr_el1_path = "/sys/devices/system/cpu/cpu0/regs/identification/midr_el1" ; 
54-     let  midr_el1 = std:: fs:: read_to_string ( midr_el1_path) . map_err ( |err| { 
55-         VcpuArchError :: GetMidrEl1 ( format ! ( "Failed to get MIDR_EL1 from host path: {err}" ) ) 
56-     } ) ?; 
53+     let  midr_el1 = std:: fs:: read_to_string ( midr_el1_path) . ok ( ) ?; 
5754    let  midr_el1_trimmed = midr_el1. trim_end ( ) . trim_start_matches ( "0x" ) ; 
58-     let  manufacturer_id = u32:: from_str_radix ( midr_el1_trimmed,  16 ) . map_err ( |err| { 
59-         VcpuArchError :: GetMidrEl1 ( format ! ( "Invalid MIDR_EL1 found on host: {err}" , ) ) 
60-     } ) ?; 
61- 
62-     Ok ( manufacturer_id >> 24 ) 
55+     let  manufacturer_id = u32:: from_str_radix ( midr_el1_trimmed,  16 ) . ok ( ) ?; 
56+     Some ( manufacturer_id >> 24 ) 
6357} 
6458
6559/// Saves states of registers into `state`. 
0 commit comments