From: Paolo Bonzini <pbonzini@redhat.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH 5/7] ppc: force update of all msr bits in cpu_post_load
Date: Tue, 20 Jan 2015 16:01:32 +0100 [thread overview]
Message-ID: <54BE6DCC.5080609@redhat.com> (raw)
In-Reply-To: <1419294981-17368-6-git-send-email-mark.cave-ayland@ilande.co.uk>
On 23/12/2014 01:36, Mark Cave-Ayland wrote:
> 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 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 <mark.cave-ayland@ilande.co.uk>
> ---
> 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..9669063 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 all msr bits invalid before restoring */
> + msr = env->msr;
> + env->msr = ~env->msr;
> + ppc_store_msr(env, msr);
> +
> hreg_compute_mem_idx(env);
>
> return 0;
>
This is wrong for this line of hreg_store_msr:
if (unlikely((env->flags & POWERPC_FLAG_TGPR) &&
((value ^ env->msr) & (1 << MSR_TGPR)))) {
/* Swap temporary saved registers with GPRs */
hreg_swap_gpr_tgpr(env);
}
I think you need to change the ~ with "^ ~(1 << MSR_TGPR)".
Paolo
next prev parent reply other threads:[~2015-01-20 15:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-23 0:36 [Qemu-devel] [PATCH 0/7] ppc: loadvm/savevm fixups for -M g3beige and -M mac99 Mark Cave-Ayland
2014-12-23 0:36 ` [Qemu-devel] [PATCH 1/7] macio.c: include parent PCIDevice state in VMStateDescription Mark Cave-Ayland
2014-12-23 0:36 ` [Qemu-devel] [PATCH 2/7] adb.c: include ADBDevice parent state in KBDState and MouseState Mark Cave-Ayland
2014-12-23 0:36 ` [Qemu-devel] [PATCH 3/7] cuda.c: include adb_poll_timer in VMStateDescription Mark Cave-Ayland
2014-12-23 0:36 ` [Qemu-devel] [PATCH 4/7] ppc: move sdr1 value change detection logic to helper_store_sdr1() Mark Cave-Ayland
2015-01-20 14:57 ` Paolo Bonzini
2015-01-20 15:23 ` Mark Cave-Ayland
2015-01-20 15:58 ` Paolo Bonzini
2014-12-23 0:36 ` [Qemu-devel] [PATCH 5/7] ppc: force update of all msr bits in cpu_post_load Mark Cave-Ayland
2015-01-20 15:01 ` Paolo Bonzini [this message]
2015-01-21 15:12 ` Mark Cave-Ayland
2014-12-23 0:36 ` [Qemu-devel] [PATCH 6/7] openpic: fix segfault on -M mac99 savevm Mark Cave-Ayland
2014-12-23 0:36 ` [Qemu-devel] [PATCH 7/7] openpic: fix up loadvm under -M mac99 Mark Cave-Ayland
2015-01-20 14:46 ` [Qemu-devel] [PATCH 0/7] ppc: loadvm/savevm fixups for -M g3beige and " Mark Cave-Ayland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54BE6DCC.5080609@redhat.com \
--to=pbonzini@redhat.com \
--cc=agraf@suse.de \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).