This series aims to increase the range of instructions that KVM on PPC can emulate and reduce code duplication by using the existing instruction emulation code from arch/powerpc/lib/sstep.c for KVM. The ultimate goal is to make PR KVM run faster on the kind of instruction sequences that we get in Linux's first-level interrupt handlers, where we have privileged instructions such as move to/from SPR, mtmsrd, rfid, etc., intermingled with ordinary unprivileged loads, stores, arithmetic instructions, etc. If KVM could emulate those ordinary instructions as well as the privileged ones, we could emulate these code sequences without incurring the cost to exit and re-enter the guest for every single privileged instruction. That would be a speedup provided the guest entry/exit cost was greater than the cost of emulating a few ordinary instructions. This series doesn't get to that ultimate goal but does lay the groundwork. It splits the emulate_step() function into two parts, analyse_instr() and emulate_step(), and uses analyse_instr() in kvmppc_emulate_instruction(). This means that KVM needs to store its vcpu integer register state in a struct pt_regs like the rest of the kernel does. We also need to make kvmppc_handle_load() and kvmppc_handle_store() handle loads and stores to ordinary guest memory as well as emulated MMIO. I have tested this series by running a Fedora 20 PR guest inside a HV guest on POWER7. The series is against Alex Graf's kvm-ppc-queue branch, plus the 3 bug-fix patches I just posted, and a bug-fix entitled "powerpc: Fix bugs in emulate_step()" that I posted to the linuxppc-dev list. Paul. -- arch/powerpc/include/asm/kvm_book3s.h | 24 +- arch/powerpc/include/asm/kvm_booke.h | 24 +- arch/powerpc/include/asm/kvm_host.h | 22 +- arch/powerpc/include/asm/kvm_ppc.h | 21 +- arch/powerpc/include/asm/sstep.h | 62 ++ arch/powerpc/kernel/asm-offsets.c | 32 +- arch/powerpc/kvm/Makefile | 1 + arch/powerpc/kvm/book3s_32_mmu.c | 2 +- arch/powerpc/kvm/book3s_64_mmu_hv.c | 10 +- arch/powerpc/kvm/book3s_64_vio_hv.c | 2 +- arch/powerpc/kvm/book3s_emulate.c | 22 +- arch/powerpc/kvm/book3s_hv.c | 42 +- arch/powerpc/kvm/book3s_hv_rm_mmu.c | 10 +- arch/powerpc/kvm/book3s_hv_rm_xics.c | 2 +- arch/powerpc/kvm/book3s_paired_singles.c | 121 +--- arch/powerpc/kvm/book3s_pr.c | 88 +-- arch/powerpc/kvm/booke.c | 45 +- arch/powerpc/kvm/booke_emulate.c | 12 +- arch/powerpc/kvm/e500_mmu.c | 2 +- arch/powerpc/kvm/emulate.c | 318 ++++------ arch/powerpc/kvm/powerpc.c | 148 +++-- arch/powerpc/lib/sstep.c | 987 ++++++++++++++++++++----------- 22 files changed, 1093 insertions(+), 904 deletions(-) -- 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