88
99import pytest
1010
11- import framework .utils_cpuid as cpuid_utils
1211from framework .properties import global_props
12+ from framework .utils_cpuid import CpuModel , CpuVendor , get_cpu_vendor
1313
1414# All existing CPU templates available on Intel
1515INTEL_TEMPLATES = ["C3" , "T2" , "T2CL" , "T2S" ]
@@ -24,23 +24,20 @@ def get_supported_cpu_templates():
2424 Return the list of CPU templates supported by the platform.
2525 """
2626 # pylint:disable=too-many-return-statements
27- match cpuid_utils .get_cpu_vendor ():
28- case cpuid_utils .CpuVendor .INTEL :
29- # T2CL template is only supported on Cascade Lake and newer CPUs.
30- if global_props .cpu_codename == cpuid_utils .CpuModel .INTEL_SKYLAKE :
31- return sorted (set (INTEL_TEMPLATES ) - set (["T2CL" ]))
27+ host_linux = global_props .host_linux_version_tpl
28+
29+ match get_cpu_vendor (), global_props .cpu_codename :
30+ # T2CL template is only supported on Cascade Lake and newer CPUs.
31+ case CpuVendor .INTEL , CpuModel .INTEL_SKYLAKE :
32+ return sorted (set (INTEL_TEMPLATES ) - set (["T2CL" ]))
33+ case CpuVendor .INTEL , _:
3234 return INTEL_TEMPLATES
33- case cpuid_utils . CpuVendor .AMD :
35+ case CpuVendor .AMD , _ :
3436 return AMD_TEMPLATES
35- case cpuid_utils .CpuVendor .ARM :
36- if global_props .host_linux_version_tpl < (6 , 1 ):
37- return []
38- match global_props .cpu_model :
39- case cpuid_utils .CpuModel .ARM_NEOVERSE_N1 :
40- return []
41- case cpuid_utils .CpuModel .ARM_NEOVERSE_V1 :
42- return ARM_TEMPLATES
43- return []
37+ case CpuVendor .ARM , CpuModel .ARM_NEOVERSE_V1 if host_linux >= (6 , 1 ):
38+ return ARM_TEMPLATES
39+ case _:
40+ return []
4441
4542
4643SUPPORTED_CPU_TEMPLATES = get_supported_cpu_templates ()
@@ -57,23 +54,22 @@ def get_supported_custom_cpu_templates():
5754 """
5855 Return the list of custom CPU templates supported by the platform.
5956 """
57+ host_linux = global_props .host_linux_version_tpl
6058
61- match cpuid_utils . get_cpu_vendor ():
62- case cpuid_utils . CpuVendor . INTEL :
63- # T2CL template is only supported on Cascade Lake and newer CPUs.
64- if global_props . cpu_codename == cpuid_utils . CpuModel . INTEL_SKYLAKE :
65- return set ( INTEL_TEMPLATES ) - { "T2CL" }
59+ match get_cpu_vendor (), global_props . cpu_codename :
60+ # T2CL template is only supported on Cascade Lake and newer CPUs.
61+ case CpuVendor . INTEL , CpuModel . INTEL_SKYLAKE :
62+ return set ( INTEL_TEMPLATES ) - { "T2CL" }
63+ case CpuVendor . INTEL , _:
6664 return INTEL_TEMPLATES
67- case cpuid_utils . CpuVendor .AMD :
65+ case CpuVendor .AMD , _ :
6866 return AMD_TEMPLATES
69- case cpuid_utils .CpuVendor .ARM :
70- if global_props .host_linux_version_tpl < (6 , 1 ):
71- return []
72- match global_props .cpu_model :
73- case cpuid_utils .CpuModel .ARM_NEOVERSE_N1 :
74- return AARCH64_CUSTOM_CPU_TEMPLATES_G2
75- case cpuid_utils .CpuModel .ARM_NEOVERSE_V1 :
76- return AARCH64_CUSTOM_CPU_TEMPLATES_G3
67+ case CpuVendor .ARM , CpuModel .ARM_NEOVERSE_N1 if host_linux >= (6 , 1 ):
68+ return AARCH64_CUSTOM_CPU_TEMPLATES_G2
69+ case CpuVendor .ARM , CpuModel .ARM_NEOVERSE_V1 if host_linux >= (6 , 1 ):
70+ return AARCH64_CUSTOM_CPU_TEMPLATES_G3
71+ case _:
72+ return []
7773
7874
7975def custom_cpu_templates_params ():
0 commit comments