This patch series overhauls how we handle ARM coprocessor registers, so that we use a consistent approach for migration, reset and QEMU<->KVM synchronisation, driven by the kernel's list of supported registers. The basic principle here is that we trust the kernel's list of what registers it knows about, and that QEMU doesn't have to have specific knowledge of a coprocessor register to support running and migrating a KVM session on a kernel that does support that register. We maintain a list of cp registers, which is initialized either from the current cpreg hashtable (for TCG), or by querying the kernel (for KVM). For migration we simply send the lists of register indexes and values; migration fails if there's a register the destination kernel is unaware of, or if the value can't be set as required, but isn't gated on whether source or destination QEMU know about the register. We also use the register list to properly reset the vcpu by simply feeding it back the initial set of register values; this fixes a bug where we weren't resetting everything we should have (though Linux guests don't care about most reset values). Note that vm save/load with KVM requires that you run with -machine kernel_irqchip=off, because the kernel doesn't currently support save/load of either the VGIC or virtual timer state. It may also be necessary to nobble the device tree blob to remove the "armv7-timer" node so the guest doesn't try to use the vtimers. Migration between TCG and KVM is not supported at the moment (it would require us to add a lot of registers to TCG, which I may do at some point, but this is a bit of an obscure usecase IMHO). Changes v1->v2: * added raw write accessors for regs which do a tlb_flush() in their write function (CONTEXTIDR and others) * added kvm-stub.h accidentally omitted in v1 (Remembered to cc kvm list this time around...) Peter Maydell (7): target-arm: Allow special cpregs to have flags set target-arm: Add raw_readfn and raw_writefn to ARMCPRegInfo target-arm: mark up cpregs for no-migrate or raw access target-arm: Convert TCG to using (index,value) list for cp migration target-arm: Initialize cpreg list from KVM when using KVM target-arm: Reinitialize all KVM VCPU registers on reset target-arm: Use tuple list to sync cp regs with KVM target-arm/Makefile.objs | 1 + target-arm/cpu-qom.h | 24 ++++ target-arm/cpu.c | 2 + target-arm/cpu.h | 89 ++++++++++++- target-arm/helper.c | 327 +++++++++++++++++++++++++++++++++++++++------- target-arm/kvm-stub.c | 23 ++++ target-arm/kvm.c | 292 +++++++++++++++++++++++++++++++---------- target-arm/kvm_arm.h | 33 +++++ target-arm/machine.c | 134 ++++++++++++------- 9 files changed, 759 insertions(+), 166 deletions(-) create mode 100644 target-arm/kvm-stub.c -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html