@@ -48,35 +48,6 @@ def clean_and_mkdir(dir_path):
48
48
os .makedirs (dir_path )
49
49
50
50
51
- def _check_cpuid_x86 (test_microvm , expected_cpu_count , expected_htt ):
52
- expected_cpu_features = {
53
- "maximum IDs for CPUs in pkg" : f"{ expected_cpu_count :#x} ({ expected_cpu_count } )" ,
54
- "CLFLUSH line size" : "0x8 (8)" ,
55
- "hypervisor guest status" : "true" ,
56
- "hyper-threading / multi-core supported" : expected_htt ,
57
- }
58
-
59
- cpuid_utils .check_guest_cpuid_output (
60
- test_microvm , "cpuid -1" , None , "=" , expected_cpu_features
61
- )
62
-
63
-
64
- def _check_extended_cache_features (vm ):
65
- l3_params = cpuid_utils .get_guest_cpuid (vm , "0x80000006" )[(0x80000006 , 0 , "edx" )]
66
-
67
- # fmt: off
68
- line_size = (l3_params >> 0 ) & 0xFF
69
- lines_per_tag = (l3_params >> 8 ) & 0xF
70
- assoc = (l3_params >> 12 ) & 0xF
71
- cache_size = (l3_params >> 18 ) & 0x3FFF
72
- # fmt: on
73
-
74
- assert line_size > 0
75
- assert lines_per_tag == 0x1 # This is hardcoded in the AMD spec
76
- assert assoc == 0x9 # This is hardcoded in the AMD spec
77
- assert cache_size > 0
78
-
79
-
80
51
def get_cpu_template_name_str (cpu_template , with_type = False ):
81
52
"""
82
53
Utility function to return a valid string which will be used as
@@ -135,7 +106,16 @@ def test_cpuid(uvm_plain_any, num_vcpus, htt):
135
106
vm .basic_config (vcpu_count = num_vcpus , smt = htt )
136
107
vm .add_net_iface ()
137
108
vm .start ()
138
- _check_cpuid_x86 (vm , num_vcpus , "true" if num_vcpus > 1 else "false" )
109
+
110
+ expected_cpu_features = {
111
+ "maximum IDs for CPUs in pkg" : f"{ num_vcpus :#x} ({ num_vcpus } )" ,
112
+ "CLFLUSH line size" : "0x8 (8)" ,
113
+ "hypervisor guest status" : "true" ,
114
+ "hyper-threading / multi-core supported" : "true" if num_vcpus > 1 else "false" ,
115
+ }
116
+ cpuid_utils .check_guest_cpuid_output (
117
+ vm , "cpuid -1" , None , "=" , expected_cpu_features
118
+ )
139
119
140
120
141
121
@pytest .mark .skipif (
@@ -151,7 +131,20 @@ def test_extended_cache_features(uvm_plain_any):
151
131
vm .basic_config ()
152
132
vm .add_net_iface ()
153
133
vm .start ()
154
- _check_extended_cache_features (vm )
134
+
135
+ l3_params = cpuid_utils .get_guest_cpuid (vm , "0x80000006" )[(0x80000006 , 0 , "edx" )]
136
+
137
+ # fmt: off
138
+ line_size = (l3_params >> 0 ) & 0xFF
139
+ lines_per_tag = (l3_params >> 8 ) & 0xF
140
+ assoc = (l3_params >> 12 ) & 0xF
141
+ cache_size = (l3_params >> 18 ) & 0x3FFF
142
+ # fmt: on
143
+
144
+ assert line_size > 0
145
+ assert lines_per_tag == 0x1 # This is hardcoded in the AMD spec
146
+ assert assoc == 0x9 # This is hardcoded in the AMD spec
147
+ assert cache_size > 0
155
148
156
149
157
150
def test_brand_string (uvm_plain_any ):
0 commit comments