From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhKpD-0000jL-Ut for qemu-devel@nongnu.org; Wed, 30 Sep 2015 13:05:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhKpA-0000gp-P4 for qemu-devel@nongnu.org; Wed, 30 Sep 2015 13:05:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhKpA-0000gh-Jq for qemu-devel@nongnu.org; Wed, 30 Sep 2015 13:05:48 -0400 References: <201509241626.33410.wpaul@windriver.com> From: Paolo Bonzini Message-ID: <560C1668.3080200@redhat.com> Date: Wed, 30 Sep 2015 19:05:44 +0200 MIME-Version: 1.0 In-Reply-To: <201509241626.33410.wpaul@windriver.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Possible bug in target-i386/helper.c:do_cpu_init()? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bill Paul , qemu-devel@nongnu.org Cc: Eduardo Habkost , Richard Henderson On 25/09/2015 01:26, Bill Paul wrote: > The result of this is that if the CPU was in long mode and you do an INIT IPI, > the CPU still has the EFER.LMA and EFER.LME bits set, even though it's not > actually running in long mode anymore. It doesn't seem possible for the guest > to get the CPU out of this state, and one nasty side-effect is that trying to > set the CR0 to enable paging never succeeds. > > I added the following code at line 1240 above as a workaround: > > #ifdef TARGET_X86_64 > /* > * The initial state of the CPU is not 64-bit mode. This being > * the case, don't leave the EFER.LME or EFER.LME bits set. > */ > > cpu_load_efer(env, 0); > #endif > > This seemed to fix the problem I was having, however I'm not certain this is > the correct fix. I think a better fix is to move the "uint64_t efer;" field to some place before the dummy "struct {} start_init_save;" marker in target-i386/cpu.h. Can you test it and send a patch if it works? Thanks, Paolo