qemu-ppc
[Top][All Lists]
Advanced

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

[RFC PATCH 13/13] ppc/spapr: KVM should not enable FWNMI until the guest


From: Nicholas Piggin
Subject: [RFC PATCH 13/13] ppc/spapr: KVM should not enable FWNMI until the guest requests it
Date: Wed, 4 Mar 2020 15:28:50 +1000

QEMU should not enable KVM FWNMI handling until the guest has requested
it. Although the QEMU NMI delivery will deliver interrupts as non-FWNMI,
KVM would like to know whether or not the guest is FWNMI capable because
in case of !FWNMI guests it may decide to take over some recovery tasks
(e.g., flush and reload SLB in case of a multi-hit) if the guest is not
FWNMI capable.

XXX: does this deal with machine resets properly, disabling it again on
the KVM side? Is synchronisation okay?

XXX: this is just an RFC, we could probably go either way here.
---
 hw/ppc/spapr_caps.c | 2 +-
 hw/ppc/spapr_rtas.c | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
index f8583c6b44..c11db00109 100644
--- a/hw/ppc/spapr_caps.c
+++ b/hw/ppc/spapr_caps.c
@@ -517,7 +517,7 @@ static void cap_fwnmi_apply(SpaprMachineState *spapr, 
uint8_t val,
     }
 
     if (kvm_enabled()) {
-        if (kvmppc_set_fwnmi() < 0) {
+        if (!kvmppc_get_fwnmi()) {
             error_setg(errp, "Firmware Assisted Non-Maskable Interrupts(FWNMI) 
"
                              "not supported by KVM, "
                              "try appending -machine cap-fwnmi=off");
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index 6922a6b880..008a138d9b 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -437,6 +437,13 @@ static void rtas_ibm_nmi_register(PowerPCCPU *cpu,
         return;
     }
 
+    if (kvm_enabled()) {
+        if (kvmppc_set_fwnmi() < 0) {
+            rtas_st(rets, 0, RTAS_OUT_NOT_SUPPORTED);
+            return;
+        }
+    }
+
     spapr->fwnmi_system_reset_addr = sreset_addr;
     spapr->fwnmi_machine_check_addr = mce_addr;
 
-- 
2.23.0




reply via email to

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