qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Greg Bellows" <greg.bellows@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Christoffer Dall" <christoffer.dall@linaro.org>,
	patches@linaro.org
Subject: [Qemu-devel] [PATCH v3 0/2] target-arm: fix broken sync of sysregs between QEMU and KVM 32
Date: Mon, 26 Jan 2015 14:26:10 +0000	[thread overview]
Message-ID: <1422282372-13735-1-git-send-email-peter.maydell@linaro.org> (raw)


This patchset fixes a regression in the synchronization of
system registers between QEMU and KVM for 32-bit ARM hosts.
The most obvious effect of the bug is that trying to access
memory via the gdbstub doesn't work, because gdbstub thinks the
MMU is off and doesn't get the virt-to-phys translation right.
(Migration would not be broken.)

The underlying cause of this is that we are using the cpreg
definition flag ARM_CP_NO_MIGRATE for two different purposes:
    1) register is an alias on to state that's also visible via
       some other register, and that other register is the one
       responsible for migrating the state
    2) register is not actually state at all (for instance the TLB
       or cache maintenance operation "registers") and it makes no
       sense to attempt to migrate it or otherwise access the raw state

This works fine for identifying which registers should be ignored
when performing migration, but we also use the same functions for
synchronizing system register state between QEMU and the kernel
when using KVM. In this case we don't want to try to sync state
into registers in category 2, but we do want to sync into registers
in category 1, because the kernel might have picked a different
one of the aliases as its choice for which one to expose for
migration. (In particular, on 32 bit hosts the kernel will
expose the state in the AArch32 version of the register, but
TCG's convention is to mark the AArch64 version as the version
to migrate, even if the CPU being emulated happens to be 32 bit,
so almost all system registers will hit this issue now that we've
added AArch64 system emulation.)

Fix this by splitting the NO_MIGRATE flag in two (ALIAS and NO_RAW)
corresponding to the two different reasons we might not want to
migrate a register. When setting up the TCG list of registers to
migrate we honour both flags; when populating the list from KVM,
only ignore registers which are NO_RAW.

Changes v1->v2:
 * change raw_accessors_valid() to raw_accessors_invalid() and
   beef up its comment, following confusion during review of v1
Changes v2->v3:
 * actually change behaviour of the raw_accessors_invalid()
   function rather than merely its name...

Peter Maydell (2):
  target-arm: Split NO_MIGRATE into ALIAS and NO_RAW
  target-arm: Add checks that cpreg raw accesses are handled

 target-arm/cpu.h    |  15 +++-
 target-arm/helper.c | 237 ++++++++++++++++++++++++++++++----------------------
 2 files changed, 146 insertions(+), 106 deletions(-)

-- 
1.9.1

             reply	other threads:[~2015-01-26 14:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 14:26 Peter Maydell [this message]
2015-01-26 14:26 ` [Qemu-devel] [PATCH v3 1/2] target-arm: Split NO_MIGRATE into ALIAS and NO_RAW Peter Maydell
2015-01-26 14:26 ` [Qemu-devel] [PATCH v3 2/2] target-arm: Add checks that cpreg raw accesses are handled Peter Maydell
2015-01-26 19:40   ` Greg Bellows

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=1422282372-13735-1-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=greg.bellows@linaro.org \
    --cc=patches@linaro.org \
    --cc=qemu-devel@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).