Skip to content

Commit f1eaa58

Browse files
tests: update CPU features for nested virt
Not all CPU features are available on EC2 nested virtualization. Signed-off-by: Marco Marangoni <mamarang@amazon.com>
1 parent 20035c3 commit f1eaa58

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

tests/framework/properties.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@ def __init__(self):
9797
self.instance = imdsv2_get("/meta-data/instance-type")
9898
self.instance_id = imdsv2_get("/meta-data/instance-id")
9999
self.ami = imdsv2_get("/meta-data/ami-id")
100+
self.is_ec2_virt = "metal" not in self.instance
100101
else:
101102
self.instance = "NA"
102103
self.instance_id = "NA"
103104
self.ami = "NA"
105+
self.is_ec2_virt = False
104106

105107
@property
106108
def host_linux_version_tpl(self):

tests/integration_tests/functional/test_cpu_features_host_vs_guest.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,53 @@
210210
"flush_l1d",
211211
} | {"la57"}
212212

213+
# CPU features not available when running in a non-metal EC2 C8i, M8i, and R8i instance
214+
EC2_CMR8i_VIRT_UNAVAILABLE = {
215+
"acpi",
216+
"arch_lbr",
217+
"art",
218+
"bts",
219+
"cat_l2",
220+
"cat_l3",
221+
"cdp_l2",
222+
"cdp_l3",
223+
"cqm",
224+
"cqm_llc",
225+
"cqm_mbm_local",
226+
"cqm_mbm_total",
227+
"cqm_occup_llc",
228+
"dca",
229+
"ds_cpl",
230+
"dtes64",
231+
"dtherm",
232+
"dts",
233+
"enqcmd",
234+
"epb",
235+
"est",
236+
"hwp",
237+
"hwp_act_window",
238+
"hwp_epp",
239+
"hwp_pkg_req",
240+
"ibpb_exit_to_user",
241+
"ibt",
242+
"intel_ppin",
243+
"intel_pt",
244+
"la57",
245+
"mba",
246+
"pbe",
247+
"pconfig",
248+
"pebs",
249+
"pln",
250+
"pts",
251+
"rdt_a",
252+
"sdbg",
253+
"smx",
254+
"split_lock_detect",
255+
"tm",
256+
"tm2",
257+
"xtpr",
258+
}
259+
213260

214261
def test_host_vs_guest_cpu_features(uvm):
215262
"""Check CPU features host vs guest"""
@@ -457,6 +504,12 @@ def test_host_vs_guest_cpu_features(uvm):
457504
# host-only synthesized bit; the guest can't read MSR 0x33).
458505
expected_host_minus_guest |= {"split_lock_detect"}
459506

507+
if global_props.is_ec2_virt:
508+
# These features aren't available in the host
509+
expected_host_minus_guest -= EC2_CMR8i_VIRT_UNAVAILABLE
510+
# Both host and guest run under an hypervisor
511+
expected_guest_minus_host -= {"hypervisor"}
512+
460513
assert host_feats - guest_feats == expected_host_minus_guest
461514
assert guest_feats - host_feats == expected_guest_minus_host
462515
case CpuModel.ARM_NEOVERSE_N1:

0 commit comments

Comments
 (0)