All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bharata B Rao <bharata@linux.ibm.com>
To: qemu-devel@nongnu.org
Cc: aneesh.kumar@linux.ibm.com, Bharata B Rao <bharata@linux.ibm.com>,
	qemu-ppc@nongnu.org, david@gibson.dropbear.id.au
Subject: [RFC PATCH v0 2/2] ppc,spapr: Handle KVM_EXIT_ESN
Date: Thu,  5 Aug 2021 13:02:28 +0530	[thread overview]
Message-ID: <20210805073228.502292-3-bharata@linux.ibm.com> (raw)
In-Reply-To: <20210805073228.502292-1-bharata@linux.ibm.com>

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



  parent reply	other threads:[~2021-08-05  7:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05  7:32 [RFC PATCH v0 0/2] Support for H_REG_SNS hcall Bharata B Rao
2021-08-05  7:32 ` [RFC PATCH v0 1/2] spapr: Add " Bharata B Rao
2021-08-06 19:25   ` Fabiano Rosas
2021-08-09  3:49   ` David Gibson
2021-08-11  9:26     ` Bharata B Rao
2021-08-12  1:24       ` David Gibson
2021-08-05  7:32 ` Bharata B Rao [this message]
2021-08-05  7:48   ` [RFC PATCH v0 2/2] ppc,spapr: Handle KVM_EXIT_ESN Laurent Vivier
2021-08-05  8:37     ` Bharata B Rao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210805073228.502292-3-bharata@linux.ibm.com \
    --to=bharata@linux.ibm.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.