Skip to content

Commit 409877a

Browse files
committed
tests: refactor test_cpu_features_x86_64.py
Make the common feature flags to get some clarity on what are the differences between the CPUs. Signed-off-by: Pablo Barbáchano <[email protected]>
1 parent da969fb commit 409877a

File tree

1 file changed

+56
-147
lines changed

1 file changed

+56
-147
lines changed

tests/integration_tests/functional/test_cpu_features_x86_64.py

Lines changed: 56 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,57 @@ def test_brand_string(uvm_plain_any):
203203
assert False
204204

205205

206+
INTEL_HOST_ONLY_FEATS = {
207+
"acpi",
208+
"aperfmperf",
209+
"arch_perfmon",
210+
"art",
211+
"bts",
212+
"cat_l3",
213+
"cdp_l3",
214+
"cqm",
215+
"cqm_llc",
216+
"cqm_mbm_local",
217+
"cqm_mbm_total",
218+
"cqm_occup_llc",
219+
"dca",
220+
"ds_cpl",
221+
"dtes64",
222+
"dtherm",
223+
"dts",
224+
"epb",
225+
"ept",
226+
"ept_ad",
227+
"est",
228+
"flexpriority",
229+
"flush_l1d",
230+
"hwp",
231+
"hwp_act_window",
232+
"hwp_epp",
233+
"hwp_pkg_req",
234+
"ida",
235+
"intel_ppin",
236+
"intel_pt",
237+
"mba",
238+
"monitor",
239+
"pbe",
240+
"pdcm",
241+
"pebs",
242+
"pln",
243+
"pts",
244+
"rdt_a",
245+
"sdbg",
246+
"smx",
247+
"tm",
248+
"tm2",
249+
"tpr_shadow",
250+
"vmx",
251+
"vnmi",
252+
"vpid",
253+
"xtpr",
254+
}
255+
256+
206257
def test_host_vs_guest_cpu_features_x86_64(uvm_nano):
207258
"""Check CPU features host vs guest"""
208259

@@ -283,110 +334,14 @@ def test_host_vs_guest_cpu_features_x86_64(uvm_nano):
283334
"tsc_known_freq",
284335
}
285336
case CpuModel.INTEL_SKYLAKE:
286-
assert host_feats - guest_feats == {
287-
"acpi",
288-
"aperfmperf",
289-
"arch_perfmon",
290-
"art",
291-
"bts",
292-
"cat_l3",
293-
"cdp_l3",
294-
"cqm",
295-
"cqm_llc",
296-
"cqm_mbm_local",
297-
"cqm_mbm_total",
298-
"cqm_occup_llc",
299-
"dca",
300-
"ds_cpl",
301-
"dtes64",
302-
"dtherm",
303-
"dts",
304-
"epb",
305-
"ept",
306-
"ept_ad",
307-
"est",
308-
"flexpriority",
309-
"flush_l1d",
310-
"hwp",
311-
"hwp_act_window",
312-
"hwp_epp",
313-
"hwp_pkg_req",
314-
"ida",
315-
"intel_ppin",
316-
"intel_pt",
317-
"mba",
318-
"monitor",
319-
"pbe",
320-
"pdcm",
321-
"pebs",
322-
"pln",
323-
"pts",
324-
"rdt_a",
325-
"sdbg",
326-
"smx",
327-
"tm",
328-
"tm2",
329-
"tpr_shadow",
330-
"vmx",
331-
"vnmi",
332-
"vpid",
333-
"xtpr",
334-
}
337+
assert host_feats - guest_feats == INTEL_HOST_ONLY_FEATS
335338
assert guest_feats - host_feats == {
336339
"hypervisor",
337340
"tsc_known_freq",
338341
"umip",
339342
}
340343
case CpuModel.INTEL_CASCADELAKE:
341-
expected_host_minus_guest = {
342-
"acpi",
343-
"aperfmperf",
344-
"arch_perfmon",
345-
"art",
346-
"bts",
347-
"cat_l3",
348-
"cdp_l3",
349-
"cqm",
350-
"cqm_llc",
351-
"cqm_mbm_local",
352-
"cqm_mbm_total",
353-
"cqm_occup_llc",
354-
"dca",
355-
"ds_cpl",
356-
"dtes64",
357-
"dtherm",
358-
"dts",
359-
"epb",
360-
"ept",
361-
"ept_ad",
362-
"est",
363-
"flexpriority",
364-
"flush_l1d",
365-
"hwp",
366-
"hwp_act_window",
367-
"hwp_epp",
368-
"hwp_pkg_req",
369-
"ida",
370-
"intel_ppin",
371-
"intel_pt",
372-
"mba",
373-
"monitor",
374-
"pbe",
375-
"pdcm",
376-
"pebs",
377-
"pln",
378-
"pts",
379-
"rdt_a",
380-
"sdbg",
381-
"smx",
382-
"tm",
383-
"tm2",
384-
"tpr_shadow",
385-
"vmx",
386-
"vnmi",
387-
"vpid",
388-
"xtpr",
389-
}
344+
expected_host_minus_guest = INTEL_HOST_ONLY_FEATS
390345
expected_guest_minus_host = {
391346
"hypervisor",
392347
"tsc_known_freq",
@@ -414,56 +369,10 @@ def test_host_vs_guest_cpu_features_x86_64(uvm_nano):
414369
assert host_feats - guest_feats == expected_host_minus_guest
415370
assert guest_feats - host_feats == expected_guest_minus_host
416371
case CpuModel.INTEL_ICELAKE:
417-
host_guest_diff_5_10 = {
418-
"dtes64",
419-
"hwp_act_window",
420-
"pdcm",
421-
"acpi",
422-
"aperfmperf",
423-
"arch_perfmon",
424-
"art",
425-
"bts",
426-
"cat_l3",
427-
"cqm",
428-
"cqm_llc",
429-
"cqm_mbm_local",
430-
"cqm_mbm_total",
431-
"cqm_occup_llc",
432-
"dca",
433-
"ds_cpl",
434-
"dtherm",
435-
"dts",
436-
"epb",
437-
"ept",
438-
"ept_ad",
439-
"est",
440-
"flexpriority",
441-
"flush_l1d",
442-
"hwp",
443-
"hwp_epp",
444-
"hwp_pkg_req",
445-
"ida",
446-
"intel_ppin",
447-
"intel_pt",
448-
"mba",
449-
"monitor",
450-
"pbe",
372+
host_guest_diff_5_10 = INTEL_HOST_ONLY_FEATS - {"cdp_l3"} | {
451373
"pconfig",
452-
"pebs",
453-
"pln",
454-
"pts",
455-
"rdt_a",
456-
"sdbg",
457-
"smx",
458-
"split_lock_detect",
459-
"tm",
460-
"tm2",
461374
"tme",
462-
"tpr_shadow",
463-
"vmx",
464-
"vnmi",
465-
"vpid",
466-
"xtpr",
375+
"split_lock_detect",
467376
}
468377
host_guest_diff_6_1 = host_guest_diff_5_10 - {
469378
"bts",
@@ -1261,7 +1170,7 @@ def test_c3_on_skylake_show_warning(uvm_plain, cpu_template):
12611170
"does not apply the mitigation against MMIO stale data "
12621171
"vulnerability."
12631172
)
1264-
if cpu_template == "C3" and global_props.cpu_codename == "INTEL_SKYLAKE":
1173+
if uvm.cpu_template_name == "c3" and global_props.cpu_codename == "INTEL_SKYLAKE":
12651174
assert message in uvm.log_data
12661175
else:
12671176
assert message not in uvm.log_data

0 commit comments

Comments
 (0)