qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 0/2] target-arm: fix broken sync of sysregs between


From: Peter Maydell
Subject: [Qemu-devel] [PATCH 0/2] target-arm: fix broken sync of sysregs between QEMU and KVM 32 bit
Date: Tue, 9 Dec 2014 19:46:25 +0000

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.

These patches are based on my target-arm.next branch (they won't
apply to current master because I have all the TZ support patches
on target-arm.next).
    

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 | 228 +++++++++++++++++++++++++++++-----------------------
 2 files changed, 137 insertions(+), 106 deletions(-)

-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]