File tree Expand file tree Collapse file tree 5 files changed +33
-0
lines changed Expand file tree Collapse file tree 5 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 22
33## [ Unreleased]
44
5+ ### Fixed
6+
7+ - Fixed passing through cache information from host in CPUID leaf 0x80000006.
8+
59## [ 1.3.2]
610
711### Fixed
Original file line number Diff line number Diff line change @@ -313,6 +313,16 @@ pub mod leaf_0x80000001 {
313313 }
314314}
315315
316+ pub mod leaf_0x80000006 {
317+ pub const LEAF_NUM : u32 = 0x8000_0006 ;
318+
319+ pub mod edx {
320+ use crate :: bit_helper:: BitRange ;
321+
322+ pub const RESERVED_BITRANGE : BitRange = bit_range ! ( 16 , 17 ) ;
323+ }
324+ }
325+
316326pub mod leaf_0x80000008 {
317327 pub const LEAF_NUM : u32 = 0x8000_0008 ;
318328
Original file line number Diff line number Diff line change @@ -132,6 +132,7 @@ impl CpuidTransformer for AmdCpuidTransformer {
132132 // Some versions of kernel may return the 0xB leaf for AMD even if this is an
133133 // Intel-specific leaf. Remove it.
134134 cpuid. retain ( |entry| entry. function != leaf_0xb:: LEAF_NUM ) ;
135+ use_host_cpuid_function ( cpuid, leaf_0x80000006:: LEAF_NUM , false ) ?;
135136 use_host_cpuid_function ( cpuid, leaf_0x8000001e:: LEAF_NUM , false ) ?;
136137 use_host_cpuid_function ( cpuid, leaf_0x8000001d:: LEAF_NUM , true ) ?;
137138 self . process_entries ( cpuid, vm_spec)
@@ -143,6 +144,7 @@ impl CpuidTransformer for AmdCpuidTransformer {
143144 leaf_0x7:: LEAF_NUM => Some ( amd:: update_structured_extended_entry) ,
144145 leaf_0x80000000:: LEAF_NUM => Some ( amd:: update_largest_extended_fn_entry) ,
145146 leaf_0x80000001:: LEAF_NUM => Some ( amd:: update_extended_feature_info_entry) ,
147+ leaf_0x80000006:: LEAF_NUM => Some ( common:: update_extended_cache_features_entry) ,
146148 leaf_0x80000008:: LEAF_NUM => Some ( amd:: update_amd_features_entry) ,
147149 leaf_0x8000001d:: LEAF_NUM => Some ( amd:: update_extended_cache_topology_entry) ,
148150 leaf_0x8000001e:: LEAF_NUM => Some ( amd:: update_extended_apic_id_entry) ,
Original file line number Diff line number Diff line change @@ -98,6 +98,19 @@ pub fn update_cache_parameters_entry(
9898 Ok ( ( ) )
9999}
100100
101+ pub fn update_extended_cache_features_entry (
102+ entry : & mut kvm_cpuid_entry2 ,
103+ _vm_spec : & VmSpec ,
104+ ) -> Result < ( ) , Error > {
105+ use crate :: cpu_leaf:: leaf_0x80000006:: * ;
106+
107+ // This only zeroes reserved bits [17:16].
108+ // The actual pass through is done by the `use_host_cpuid_function()` call.
109+ entry. edx . write_bits_in_range ( & edx:: RESERVED_BITRANGE , 0 ) ;
110+
111+ Ok ( ( ) )
112+ }
113+
101114/// Replaces the `cpuid` entries corresponding to `function` with the entries from the host's cpuid.
102115pub fn use_host_cpuid_function (
103116 cpuid : & mut CpuId ,
Original file line number Diff line number Diff line change 44use super :: * ;
55use crate :: bit_helper:: BitHelper ;
66use crate :: cpu_leaf:: * ;
7+ use crate :: transformer:: common:: use_host_cpuid_function;
78
89// The APIC ID shift in leaf 0xBh specifies the number of bits to shit the x2APIC ID to get a
910// unique topology of the next level. This allows 128 logical processors/package.
@@ -139,6 +140,8 @@ impl CpuidTransformer for IntelCpuidTransformer {
139140 . map_err ( Error :: Fam ) ?;
140141 }
141142
143+ use_host_cpuid_function ( cpuid, leaf_0x80000006:: LEAF_NUM , false ) ?;
144+
142145 self . process_entries ( cpuid, vm_spec)
143146 }
144147
@@ -150,6 +153,7 @@ impl CpuidTransformer for IntelCpuidTransformer {
150153 leaf_0xa:: LEAF_NUM => Some ( intel:: update_perf_mon_entry) ,
151154 leaf_0xb:: LEAF_NUM => Some ( intel:: update_extended_topology_entry) ,
152155 0x8000_0002 ..=0x8000_0004 => Some ( common:: update_brand_string_entry) ,
156+ leaf_0x80000006:: LEAF_NUM => Some ( common:: update_cache_parameters_entry) ,
153157 _ => None ,
154158 }
155159 }
You can’t perform that action at this time.
0 commit comments