qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH v0 2/2] ppc,spapr: Handle KVM_EXIT_ESN


From: Bharata B Rao
Subject: [RFC PATCH v0 2/2] ppc,spapr: Handle KVM_EXIT_ESN
Date: Thu, 5 Aug 2021 13:02:28 +0530

Handle KVM_EXIT_ESN exit by issuing subvention notification
interrupt to the guest. Guests supporting async-pf feature
will need this interrupt to wake up tasks that are waiting
for the expropriated pages to be available.

Note: Updates to linux-headers/linux/kvm.h are temporary
pending headers update.

Signed-off-by: Bharata B Rao <bharata@linux.ibm.com>
---
 linux-headers/linux/kvm.h |  1 +
 target/ppc/kvm.c          | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index a76945fcbc..105c8b069a 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -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. */
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 330985c8a0..6bf3f06b88 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -38,6 +38,7 @@
 #include "hw/ppc/spapr_cpu_core.h"
 #include "hw/hw.h"
 #include "hw/ppc/ppc.h"
+#include "hw/irq.h"
 #include "migration/qemu-file-types.h"
 #include "sysemu/watchdog.h"
 #include "trace.h"
@@ -1657,6 +1658,16 @@ static int kvm_handle_debug(PowerPCCPU *cpu, struct 
kvm_run *run)
     return DEBUG_RETURN_GUEST;
 }
 
+#if defined(TARGET_PPC64)
+static void kvmppc_handle_esn(PowerPCCPU *cpu)
+{
+    SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
+
+    fprintf(stderr, "%s: ESN exit\n", __func__);
+    qemu_irq_pulse(spapr_qirq(spapr, SPAPR_IRQ_SNS));
+}
+#endif
+
 int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
 {
     PowerPCCPU *cpu = POWERPC_CPU(cs);
@@ -1687,6 +1698,11 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run 
*run)
                                               run->papr_hcall.args);
         ret = 0;
         break;
+
+    case KVM_EXIT_ESN:
+        kvmppc_handle_esn(cpu);
+        ret = 0;
+        break;
 #endif
     case KVM_EXIT_EPR:
         trace_kvm_handle_epr();
-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]