[PATCH 1/3] target/i386/cpu: Use hex mask to check for valid cache CPUID leaf

Zhao Liu posted 3 patches 5 months, 1 week ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>
[PATCH 1/3] target/i386/cpu: Use hex mask to check for valid cache CPUID leaf
Posted by Zhao Liu 5 months, 1 week ago
Hexadecimal mask is more intuitive comparing to decimal.

Therefore convert the mask of bits 00-04 to hexadecimal value.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 target/i386/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 365852cb99e1..c4d4048ec32a 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6452,7 +6452,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
              * QEMU has its own number of cores/logical cpus,
              * set 24..14, 31..26 bit to configured values
              */
-            if (*eax & 31) {
+            if (*eax & 0x1f) {
                 int host_vcpus_per_cache = 1 + ((*eax & 0x3FFC000) >> 14);
 
                 *eax &= ~0xFC000000;
-- 
2.34.1