qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] spapr: Don't use the "dual" interrupt controller mode with an old hypervisor
@ 2019-06-06 17:08 Greg Kurz
  2019-06-06 17:38 ` Cédric Le Goater
  2019-06-07  0:19 ` David Gibson
  0 siblings, 2 replies; 8+ messages in thread
From: Greg Kurz @ 2019-06-06 17:08 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-devel, qemu-ppc, Cédric Le Goater, Greg Kurz

If KVM is too old to support XIVE native exploitation mode, we might end
up using the emulated XIVE after CAS. This is sub-optimal if KVM in-kernel
XICS is available, which is the case most of the time.

Also, an old KVM may not allow to destroy and re-create the KVM XICS, which
is precisely what "dual" does during machine reset. This causes QEMU to try
to switch to emulated XICS and to crash because RTAS call de-registration
isn't handled correctly. We could possibly fix that, but again we would
still end up with an emulated XICS or XIVE.

"dual" is definitely not a good choice with older KVMs. Internally force
XICS when we detect this.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 hw/ppc/spapr_irq.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index 3156daf09381..d788bd662a7a 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -18,6 +18,7 @@
 #include "hw/ppc/xics_spapr.h"
 #include "cpu-models.h"
 #include "sysemu/kvm.h"
+#include "kvm_ppc.h"
 
 #include "trace.h"
 
@@ -668,6 +669,15 @@ static void spapr_irq_check(SpaprMachineState *spapr, Error **errp)
             return;
         }
     }
+
+    /*
+     * KVM may be too old to support XIVE, in which case we'd rather try
+     * to use the in-kernel XICS instead of the emulated XIVE.
+     */
+    if (kvm_enabled() && !kvmppc_has_cap_xive() &&
+        spapr->irq == &spapr_irq_dual) {
+        spapr->irq = &spapr_irq_xics;
+    }
 }
 
 /*



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-06-12  2:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-06 17:08 [Qemu-devel] [PATCH] spapr: Don't use the "dual" interrupt controller mode with an old hypervisor Greg Kurz
2019-06-06 17:38 ` Cédric Le Goater
2019-06-07  0:19 ` David Gibson
2019-06-07  8:17   ` Cédric Le Goater
2019-06-07  8:27     ` Cédric Le Goater
2019-06-07  9:49     ` Greg Kurz
2019-06-12  1:29       ` David Gibson
2019-06-11  5:26     ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).