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