Skip to content

Commit 9ce640d

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. Our supported AMD families (Milan & Genoa) are both 19h. Do not mark this as host-only when PCI is enabled. Signed-off-by: Babis Chalios <[email protected]>
1 parent b4e8cc8 commit 9ce640d

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-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: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,32 @@ 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 - {"extd_apicid"}
176+
else:
177+
feats = AMD_MILAN_HOST_ONLY_FEATS
178+
feats_6_1 = AMD_MILAN_HOST_ONLY_FEATS_6_1
179+
173180
if global_props.host_linux_version_tpl < (6, 1):
174-
assert host_feats - guest_feats == AMD_MILAN_HOST_ONLY_FEATS
181+
assert host_feats - guest_feats == feats
175182
else:
176-
assert host_feats - guest_feats == AMD_MILAN_HOST_ONLY_FEATS_6_1
183+
assert host_feats - guest_feats == feats_6_1
177184

178185
assert guest_feats - host_feats == AMD_GUEST_ONLY_FEATS
179186

180187
case CpuModel.AMD_GENOA:
188+
if vm.pci_enabled:
189+
feats = AMD_GENOA_HOST_ONLY_FEATS - {"extd_apicid"}
190+
feats_6_1 = AMD_GENOA_HOST_ONLY_FEATS_6_1 - {"extd_apicid"}
191+
else:
192+
feats = AMD_MILAN_HOST_ONLY_FEATS
193+
feats_6_1 = AMD_MILAN_HOST_ONLY_FEATS_6_1
194+
181195
if global_props.host_linux_version_tpl < (6, 1):
182-
assert host_feats - guest_feats == AMD_GENOA_HOST_ONLY_FEATS
196+
assert host_feats - guest_feats == feats
183197
else:
184-
assert host_feats - guest_feats == AMD_GENOA_HOST_ONLY_FEATS_6_1
198+
assert host_feats - guest_feats == feats_6_1
185199

186200
assert guest_feats - host_feats == AMD_GUEST_ONLY_FEATS
187201

0 commit comments

Comments
 (0)