Skip to content

Commit 25d2f16

Browse files
committed
test: allow extd_apicid CPU feature on AMD guests
When PCI is enabled inside the guest, the (guest) kernel enables the `extd_apicid` CPU feature for AMD CPU families after 16h [1]. Our supported AMD families (Milan & Genoa) are both 19h. Do not mark this as host-only when PCI is enabled. [1] https://elixir.bootlin.com/linux/v6.14.7/source/arch/x86/kernel/cpu/amd.c#L585 Signed-off-by: Babis Chalios <[email protected]>
1 parent 9546ac6 commit 25d2f16

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

tests/framework/microvm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ def __init__(
198198
assert microvm_id is not None
199199
self._microvm_id = microvm_id
200200

201+
self.pci_enabled = False
201202
self.kernel_file = None
202203
self.rootfs_file = None
203204
self.ssh_key = None
@@ -639,6 +640,7 @@ def spawn(
639640
self.time_api_requests = False
640641

641642
if pci:
643+
self.pci_enabled = True
642644
self.jailer.extra_args["enable-pci"] = None
643645

644646
cmd = [

tests/integration_tests/functional/test_cpu_features_host_vs_guest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ def test_host_vs_guest_cpu_features(uvm_plain_any):
170170

171171
match CPU_MODEL:
172172
case CpuModel.AMD_MILAN:
173+
if vm.pci_enabled:
174+
AMD_MILAN_HOST_ONLY_FEATS = AMD_MILAN_HOST_ONLY_FEATS - {"extd_apicid"}
175+
AMD_MILAN_HOST_ONLY_FEATS_6_1 = AMD_MILAN_HOST_ONLY_FEATS_6_1 - {
176+
"extd_apicid"
177+
}
178+
173179
if global_props.host_linux_version_tpl < (6, 1):
174180
assert host_feats - guest_feats == AMD_MILAN_HOST_ONLY_FEATS
175181
else:
@@ -178,6 +184,12 @@ def test_host_vs_guest_cpu_features(uvm_plain_any):
178184
assert guest_feats - host_feats == AMD_GUEST_ONLY_FEATS
179185

180186
case CpuModel.AMD_GENOA:
187+
if vm.pci_enabled:
188+
AMD_GENOA_HOST_ONLY_FEATS = AMD_GENOA_HOST_ONLY_FEATS - {"extd_apicid"}
189+
AMD_GENOA_HOST_ONLY_FEATS_6_1 = AMD_GENOA_HOST_ONLY_FEATS_6_1 - {
190+
"extd_apicid"
191+
}
192+
181193
if global_props.host_linux_version_tpl < (6, 1):
182194
assert host_feats - guest_feats == AMD_GENOA_HOST_ONLY_FEATS
183195
else:

0 commit comments

Comments
 (0)