Skip to content

Commit 5aa8941

Browse files
zulinx86pb8o
authored andcommitted
fix(vmm): Pass through CPUID leaf 0x80000005
PR #3721 changed to pass through CPUID leaf 0x80000006 indicating L2 cache and TLB and L3 cache information, but CPUID leaf 0x80000005 has not been passed even though it provides L1 Cache and TLB information. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent a81caf5 commit 5aa8941

File tree

6 files changed

+28
-16
lines changed

6 files changed

+28
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
- Fixed the T2CL CPU template to pass through the RSBA and RRSBA bits of the
3838
IA32_ARCH_CAPABILITIES MSR from the host in accordance with an Intel microcode
3939
update.
40+
- Fixed passing through cache information from host in CPUID leaf 0x80000005.
4041

4142
## [1.3.0]
4243

docs/cpu_templates/cpuid-normalization.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ See also: [boot protocol settings](boot-protocol.md)
2525
| Update extended topology enumeration | 0xb | all | EAX | 4:0 |
2626
| Update extended topology enumeration | 0xb | all | EBX | 15:0 |
2727
| Update extended topology enumeration | 0xb | all | ECX | 15:8 |
28-
| Pass through cache information from host | 0x80000006 | - | all | all |
28+
| Pass through L1 cache and TLB information from host | 0x80000005 | - | all | all |
29+
| Pass through L2 cache and TLB and L3 cache information from host | 0x80000006 | - | all | all |
2930

3031
## Intel-specific CPUID normalization
3132

resources/tests/cpu_template_helper/fingerprint_AMD_MILAN_4.14host.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"firecracker_version": "1.5.0-dev",
3-
"kernel_version": "4.14.314-238.539.amzn2.x86_64",
3+
"kernel_version": "4.14.318-241.531.amzn2.x86_64",
44
"microcode_version": "0xa0011a9",
55
"bios_version": "1.0",
66
"bios_revision": "5.22",
@@ -611,19 +611,19 @@
611611
"modifiers": [
612612
{
613613
"register": "eax",
614-
"bitmap": "0b00000000000000000000000000000000"
614+
"bitmap": "0b11111111010000001111111101000000"
615615
},
616616
{
617617
"register": "ebx",
618-
"bitmap": "0b00000000000000000000000000000000"
618+
"bitmap": "0b11111111010000001111111101000000"
619619
},
620620
{
621621
"register": "ecx",
622-
"bitmap": "0b00000000000000000000000000000000"
622+
"bitmap": "0b00100000000010000000000101000000"
623623
},
624624
{
625625
"register": "edx",
626-
"bitmap": "0b00000000000000000000000000000000"
626+
"bitmap": "0b00100000000010000000000101000000"
627627
}
628628
]
629629
},

resources/tests/cpu_template_helper/fingerprint_AMD_MILAN_5.10host.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"firecracker_version": "1.5.0-dev",
3-
"kernel_version": "5.10.179-168.710.amzn2.x86_64",
3+
"kernel_version": "5.10.184-175.731.amzn2.x86_64",
44
"microcode_version": "0xa0011a9",
55
"bios_version": "1.0",
66
"bios_revision": "5.22",
@@ -657,19 +657,19 @@
657657
"modifiers": [
658658
{
659659
"register": "eax",
660-
"bitmap": "0b00000000000000000000000000000000"
660+
"bitmap": "0b11111111010000001111111101000000"
661661
},
662662
{
663663
"register": "ebx",
664-
"bitmap": "0b00000000000000000000000000000000"
664+
"bitmap": "0b11111111010000001111111101000000"
665665
},
666666
{
667667
"register": "ecx",
668-
"bitmap": "0b00000000000000000000000000000000"
668+
"bitmap": "0b00100000000010000000000101000000"
669669
},
670670
{
671671
"register": "edx",
672-
"bitmap": "0b00000000000000000000000000000000"
672+
"bitmap": "0b00100000000010000000000101000000"
673673
}
674674
]
675675
},

resources/tests/cpu_template_helper/fingerprint_AMD_MILAN_6.1host.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"firecracker_version": "1.5.0-dev",
3-
"kernel_version": "6.1.29-47.49.amzn2023.x86_64",
3+
"kernel_version": "6.1.34-59.116.amzn2023.x86_64",
44
"microcode_version": "0xa0011a9",
55
"bios_version": "1.0",
66
"bios_revision": "5.22",
@@ -657,19 +657,19 @@
657657
"modifiers": [
658658
{
659659
"register": "eax",
660-
"bitmap": "0b00000000000000000000000000000000"
660+
"bitmap": "0b11111111010000001111111101000000"
661661
},
662662
{
663663
"register": "ebx",
664-
"bitmap": "0b00000000000000000000000000000000"
664+
"bitmap": "0b11111111010000001111111101000000"
665665
},
666666
{
667667
"register": "ecx",
668-
"bitmap": "0b00000000000000000000000000000000"
668+
"bitmap": "0b00100000000010000000000101000000"
669669
},
670670
{
671671
"register": "edx",
672-
"bitmap": "0b00000000000000000000000000000000"
672+
"bitmap": "0b00100000000010000000000101000000"
673673
}
674674
]
675675
},

src/vmm/src/cpu_config/x86_64/cpuid/normalize.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ pub enum ExtendedTopologyError {
9898
/// Error type for setting leaf 0x80000006 of Cpuid::normalize().
9999
#[derive(Debug, thiserror::Error, Eq, PartialEq)]
100100
pub enum ExtendedCacheFeaturesError {
101+
/// Leaf 0x80000005 is missing from CPUID.
102+
#[error("Leaf 0x80000005 is missing from CPUID.")]
103+
MissingLeaf0x80000005,
101104
/// Leaf 0x80000006 is missing from CPUID.
102105
#[error("Leaf 0x80000006 is missing from CPUID.")]
103106
MissingLeaf0x80000006,
@@ -465,6 +468,13 @@ impl super::Cpuid {
465468

466469
// Update extended cache features entry
467470
fn update_extended_cache_features(&mut self) -> Result<(), ExtendedCacheFeaturesError> {
471+
// Leaf 0x800000005 indicates L1 Cache and TLB Information.
472+
let guest_leaf_0x80000005 = self
473+
.get_mut(&CpuidKey::leaf(0x80000005))
474+
.ok_or(ExtendedCacheFeaturesError::MissingLeaf0x80000005)?;
475+
guest_leaf_0x80000005.result = cpuid(0x80000005).into();
476+
477+
// Leaf 0x80000006 indicates L2 Cache and TLB and L3 Cache Information.
468478
let guest_leaf_0x80000006 = self
469479
.get_mut(&CpuidKey::leaf(0x80000006))
470480
.ok_or(ExtendedCacheFeaturesError::MissingLeaf0x80000006)?;

0 commit comments

Comments
 (0)