[PATCH 0/3] KVM: PPC: Enable user space handled SPRs

Alexander Graf
2012-10-06T23:41:26Z

While trying to get 440 autotest to work, I stumbled over an issue we have
in our API. Today, SPRs are handled exclusively in kernel space. Resets are
handled in user space. Usually that works because the notification that we
want to do a reset comes through PIO/MMIO.

However, in the case of 440, it comes through an SPR write. This breaks for
us because user space never knows it should actually handle this. We have more
situations like this where user space wants to know about SPR reads and writes.
For example the e500 fast interrupt acknowledge register needs to communicate
with the MPIC. That one is not implemented in the kernel today though. So we
need user space cooperation again.

As a generic solution, I figured it's the easiest way forward to just pass all
SPRs we can not handle in kernel space on to user space, so it can decide what
to do with them. If it doesn't want to handle them, it can always return back
to kernel space with a failure which would be treated the same as if the SPR
could not get handled by kernel space in the first place.

This way we can extend the whole thing to registers we can't even dream of that
through some funky SoC interactions talk to devices on the same chip that are
modeled in user space.

Alex

Alexander Graf (3):
KVM: PPC: Move mtspr/mfspr emulation into own functions
KVM: PPC: Add SPR emulation exits
KVM: PPC: BookE: Forward DBCR0 to user space

Documentation/virtual/kvm/api.txt | 37 +++++
arch/powerpc/include/asm/kvm_host.h | 3 +
arch/powerpc/include/asm/kvm_ppc.h | 1 +
arch/powerpc/kvm/book3s_pr.c | 4 +
arch/powerpc/kvm/booke.c | 4 +
arch/powerpc/kvm/booke_emulate.c | 12 ++-
arch/powerpc/kvm/emulate.c | 249 +++++++++++++++++++++--------------
arch/powerpc/kvm/powerpc.c | 20 +++
include/linux/kvm.h | 12 ++
9 files changed, 240 insertions(+), 102 deletions(-)