From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y21Ah-0005DG-5G for qemu-devel@nongnu.org; Fri, 19 Dec 2014 12:17:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y21AW-0001vM-UY for qemu-devel@nongnu.org; Fri, 19 Dec 2014 12:16:59 -0500 Message-ID: <54945D7E.3090409@suse.de> Date: Fri, 19 Dec 2014 18:16:46 +0100 From: Alexander Graf MIME-Version: 1.0 References: <54915835.6030508@ilande.co.uk> <549159B6.6000006@suse.de> <54915F28.1090001@ilande.co.uk> <549164F5.5080902@suse.de> <5492DCAB.4050907@ilande.co.uk> <5492E8D6.3040503@suse.de> <549348E7.3020401@ilande.co.uk> <54935CE5.4090201@suse.de> <549403C2.8030902@ilande.co.uk> <54943249.2060902@ilande.co.uk> <54944F1E.7000604@ilande.co.uk> <54945779.9090103@ilande.co.uk> In-Reply-To: <54945779.9090103@ilande.co.uk> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-ppc] Unable to loadvm on qemu-system-ppc -M g3beige (keyboard freeze) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mark Cave-Ayland , Peter Maydell Cc: "qemu-ppc@nongnu.org" , qemu-devel On 19.12.14 17:51, Mark Cave-Ayland wrote: > On 19/12/14 16:35, Peter Maydell wrote: > >> On 19 December 2014 at 16:15, Mark Cave-Ayland >> wrote: >>> It looks like after restoring the CPU state with loadvm env->htab_base >>> is still at 0x0 rather than its pre-migration value of 0x7e000000. >> >> Odd -- there is code that is at least trying to do that: >> machine.c calls ppc_store_sdr1() which should set htab_base/mask >> according to the migrated value of the register... > > Stepping through ppc_store_sdr1() I see the problem is the if() statement: > > if (env->spr[SPR_SDR1] != value) { > .... > } > > It looks like env->spr[SPR_SDR1] has already been set to 0x7e000000 > before the call to ppc_store_sdr1() and so as the values are already > equal then the code to setup env->htab_mask and env->htab_base is bypassed. > > The quick fix is to comment out the above if() statement which allows me > to restore my OpenBIOS image successfully with -loadvm but sadly not my > OS image (I guess there are probably a few more state bugs still lying > around). Does this seem the right thing to do or is there a better way? How about something like this instead? Then we at least don't lose the acceleration we get from not invalidating the TLB on identical SDR1 writes. Alex diff --git a/target-ppc/machine.c b/target-ppc/machine.c index c801b82..6f347bf 100644 --- a/target-ppc/machine.c +++ b/target-ppc/machine.c @@ -71,6 +71,7 @@ static int cpu_load_old(QEMUFile *f, void *opaque, int version_id) for (i = 0; i < 1024; i++) qemu_get_betls(f, &env->spr[i]); if (!env->external_htab) { + env->spr[SPR_SDR1] = 0; ppc_store_sdr1(env, sdr1); } qemu_get_be32s(f, &env->vscr);