Skip to content

Commit 28f6044

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 a185034 commit 28f6044

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
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: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,36 @@ 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+
feats = AMD_MILAN_HOST_ONLY_FEATS - {"extd_apicid"}
175+
feats_6_1 = AMD_MILAN_HOST_ONLY_FEATS_6_1 - {
176+
"extd_apicid"
177+
}
178+
else:
179+
feats = AMD_MILAN_HOST_ONLY_FEATS
180+
feats_6_1 = AMD_MILAN_HOST_ONLY_FEATS_6_1
181+
173182
if global_props.host_linux_version_tpl < (6, 1):
174-
assert host_feats - guest_feats == AMD_MILAN_HOST_ONLY_FEATS
183+
assert host_feats - guest_feats == feats
175184
else:
176-
assert host_feats - guest_feats == AMD_MILAN_HOST_ONLY_FEATS_6_1
185+
assert host_feats - guest_feats == feats_6_1
177186

178187
assert guest_feats - host_feats == AMD_GUEST_ONLY_FEATS
179188

180189
case CpuModel.AMD_GENOA:
190+
if vm.pci_enabled:
191+
feats = AMD_GENOA_HOST_ONLY_FEATS - {"extd_apicid"}
192+
feats_6_1 = AMD_GENOA_HOST_ONLY_FEATS_6_1 - {
193+
"extd_apicid"
194+
}
195+
else:
196+
feats = AMD_MILAN_HOST_ONLY_FEATS
197+
feats_6_1 = AMD_MILAN_HOST_ONLY_FEATS_6_1
198+
181199
if global_props.host_linux_version_tpl < (6, 1):
182-
assert host_feats - guest_feats == AMD_GENOA_HOST_ONLY_FEATS
200+
assert host_feats - guest_feats == feats
183201
else:
184-
assert host_feats - guest_feats == AMD_GENOA_HOST_ONLY_FEATS_6_1
202+
assert host_feats - guest_feats == feats_6_1
185203

186204
assert guest_feats - host_feats == AMD_GUEST_ONLY_FEATS
187205

0 commit comments

Comments
 (0)