On Mon, Jan 25, 2021 at 11:42:43AM +0100, Paolo Bonzini wrote: > On 25/01/21 08:10, Nathan Chancellor wrote: > > > > This patch as commit 5a140b255d ("x86/cpu: Use max host physical address > > > > if -cpu max option is applied") prevents me from using '-cpu host' while > > > > booting an i386_defconfig kernel. > > > > > > > > $ qemu-system-i386 \ > > > > -append console=ttyS0 \ > > > > -cpu host \ > > > > -display none \ > > > > -enable-kvm \ > > > > -initrd rootfs.cpio \ > > > > -kernel bzImage \ > > > > -serial mon:stdio > > > > qemu-system-i386: phys-bits should be between 32 and 36 (but is 48) > > > > > > > > Am I expected to pass "-cpu host,host-phys-bits=false" now or did this > > > > do something unexpected? > > Yes, it's setting the LM bit for a 32-bit guest. > > Does this work for you?
Yes, it does! Tested-by: Nathan Chancellor <natechancel...@gmail.com> > diff --git a/target/i386/cpu.c b/target/i386/cpu.c > index 72a79e6019..70df57337f 100644 > --- a/target/i386/cpu.c > +++ b/target/i386/cpu.c > @@ -5081,6 +5081,11 @@ static uint64_t > x86_cpu_get_supported_feature_word(FeatureWord w, > } else { > return ~0; > } > +#ifdef TARGET_I386 > + if (wi->cpuid.eax = 0x80000001) { This should be a '==': ../target/i386/cpu.c: In function ‘x86_cpu_get_supported_feature_word’: ../target/i386/cpu.c:5085:9: error: suggest parentheses around assignment used as truth value [-Werror=parentheses] 5085 | if (wi->cpuid.eax = 0x80000001) { | ^~ cc1: all warnings being treated as errors > + r &= ~CPUID_EXT2_LM; > + } > +#endif > if (migratable_only) { > r &= x86_cpu_get_migratable_flags(w); > } > > > Paolo > > > > Hi, Nathan, > > > Could you try Paolo's latest patch? > > > > > > [PULL 03/31] x86/cpu: Use max host physical address if -cpu max option is > > > applied > > > > Hi Yang, > > > > That is the version of the patch I tried, which has been pulled into the > > master branch. > > > > Cheers, > > Nathan > > V>