From 56afe9f919f6de062ecc939356c2404eea53f986 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 4 Mar 2021 18:07:25 -0500 Subject: [PATCH] target/i386: do not set LM for 32-bit emulation '-cpu host/max' 32-bit targets by definition do not support long mode; therefore, the bit must be masked in the features supported by the accelerator. As a side effect, this avoids setting up the 0x80000008 CPUID leaf for qemu-system-i386 -cpu host which since commit 5a140b255d ("x86/cpu: Use max host physical address if -cpu max option is applied") would have printed this error: qemu-system-i386: phys-bits should be between 32 and 36 (but is 48) Backports 5ea9e9e239db83391a39c09f1de63c4099c20df5 --- qemu/target/i386/cpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qemu/target/i386/cpu.c b/qemu/target/i386/cpu.c index cab9017f..36b52050 100644 --- a/qemu/target/i386/cpu.c +++ b/qemu/target/i386/cpu.c @@ -4429,6 +4429,11 @@ static uint32_t x86_cpu_get_supported_feature_word(struct uc_struct *uc, } else { return ~0; } + #ifndef TARGET_X86_64 + if (w == FEAT_8000_0001_EDX) { + r &= ~CPUID_EXT2_LM; + } +#endif if (migratable_only) { r &= x86_cpu_get_migratable_flags(w); }