These patches add support to target-arm for '-cpu host'. The general semantics are the same as for ppc and x86 (ie "whatever the host kernel can support that looks basically like the host CPU"), but the mechanism is a little different.
The kernel API (currently still proposed rather than implemented, hence the RFC nature of this patchset) is that the existing KVM_ARM_VCPU_INIT supports a new 'target' value KVM_ARM_TARGET_HOST, which it treats as "whatever you are". On the userspace side, we use this if the kernel supports it. If it doesn't then we know the kernel must be an A15-on-A15 only one, and so can safely implement '-cpu host' with KVM_ARM_TARGET_CORTEX_A15. In order to find out details of the vCPU so we can correctly set up our ARMCPU objects, we create a scratch VM and a single cpu within it; we can then use the existing "read registers" API to access the ID registers. We do this once at startup when we register the new QOM type. ('-cpu host' is also going to be useful for AArch64 because it gives us a path to providing KVM support without having to implement a model of a specific v8 CPU and all its system registers...) Peter Maydell (2): target-arm: Don't hardcode KVM target CPU to be A15 target-arm: Provide '-cpu host' when running KVM target-arm/helper.c | 6 ++ target-arm/kvm.c | 227 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 231 insertions(+), 2 deletions(-) -- 1.7.9.5