@@ -52,6 +52,7 @@
#define KVM_REQ_WATCHDOG KVM_ARCH_REQ(0)
#define KVM_REQ_EPR_EXIT KVM_ARCH_REQ(1)
#define KVM_REQ_PENDING_TIMER KVM_ARCH_REQ(2)
+#define KVM_REQ_ESN_EXIT KVM_ARCH_REQ(3)
#include <linux/mmu_notifier.h>
@@ -2820,6 +2820,14 @@ static void kvmppc_core_vcpu_free_hv(struct kvm_vcpu *vcpu)
static int kvmppc_core_check_requests_hv(struct kvm_vcpu *vcpu)
{
+ /*
+ * If subvention interrupt needs to be injected to the guest
+ * exit to user space.
+ */
+ if (kvm_check_request(KVM_REQ_ESN_EXIT, vcpu)) {
+ vcpu->run->exit_reason = KVM_EXIT_ESN;
+ return 0;
+ }
/* Indicate we want to get back into the guest */
return 1;
}
@@ -269,6 +269,7 @@ struct kvm_xen_exit {
#define KVM_EXIT_AP_RESET_HOLD 32
#define KVM_EXIT_X86_BUS_LOCK 33
#define KVM_EXIT_XEN 34
+#define KVM_EXIT_ESN 35
/* For KVM_EXIT_INTERNAL_ERROR */
/* Emulate instruction failed. */
Add a new KVM exit request KVM_REQ_ESN_EXIT that will be used to exit to userspace (QEMU) whenever subvention notification needs to be sent to the guest. The userspace (QEMU) issues the subvention notification by injecting an interrupt into the guest. Signed-off-by: Bharata B Rao <bharata@linux.ibm.com> --- arch/powerpc/include/asm/kvm_host.h | 1 + arch/powerpc/kvm/book3s_hv.c | 8 ++++++++ include/uapi/linux/kvm.h | 1 + 3 files changed, 10 insertions(+)