From patchwork Wed Jan 21 16:01:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 431532 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 218C114008F for ; Thu, 22 Jan 2015 03:04:06 +1100 (AEDT) Received: from localhost ([::1]:48934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDxlE-0005p1-B0 for incoming@patchwork.ozlabs.org; Wed, 21 Jan 2015 11:04:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDxjD-0002HI-2T for qemu-devel@nongnu.org; Wed, 21 Jan 2015 11:01:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDxjB-0005Wo-Vn for qemu-devel@nongnu.org; Wed, 21 Jan 2015 11:01:59 -0500 Received: from s16892447.onlinehome-server.info ([82.165.15.123]:55928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDxjB-0005We-QS; Wed, 21 Jan 2015 11:01:57 -0500 Received: from 5ec2da75.skybroadband.com ([94.194.218.117] helo=kentang.lan) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1YDxjA-0007vI-DE; Wed, 21 Jan 2015 16:01:57 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, agraf@suse.de Date: Wed, 21 Jan 2015 16:01:10 +0000 Message-Id: <1421856072-25026-6-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1421856072-25026-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1421856072-25026-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 94.194.218.117 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCHv2 5/7] target-ppc: force update of msr bits in cpu_post_load X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Since env->msr has already been restored by the time cpu_post_load is called, make sure that ppc_store_msr() is explicitly called with all msr bits except MSR_TGPR marked as invalid. This solves the issue where MSR flags aren't set correctly when restoring a VM snapshot, in particular the internal env->excp_prefix value when MSR_EP has been altered by a guest. Signed-off-by: Mark Cave-Ayland --- target-ppc/machine.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target-ppc/machine.c b/target-ppc/machine.c index c801b82..fc8ddcd 100644 --- a/target-ppc/machine.c +++ b/target-ppc/machine.c @@ -159,6 +159,7 @@ static int cpu_post_load(void *opaque, int version_id) PowerPCCPU *cpu = opaque; CPUPPCState *env = &cpu->env; int i; + target_ulong msr; /* * We always ignore the source PVR. The user or management @@ -190,7 +191,12 @@ static int cpu_post_load(void *opaque, int version_id) /* Restore htab_base and htab_mask variables */ ppc_store_sdr1(env, env->spr[SPR_SDR1]); } - hreg_compute_hflags(env); + + /* Mark msr bits except MSR_TGPR invalid before restoring */ + msr = env->msr; + env->msr ^= ~(1 << MSR_TGPR); + ppc_store_msr(env, msr); + hreg_compute_mem_idx(env); return 0;