From nobody Tue Jun 18 11:41:14 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651034285932843.9397241897891; Tue, 26 Apr 2022 21:38:05 -0700 (PDT) Received: from localhost ([::1]:47096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njZRE-0000Te-EV for importer@patchew.org; Wed, 27 Apr 2022 00:38:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njZQC-00083w-My; Wed, 27 Apr 2022 00:37:00 -0400 Received: from ozlabs.ru ([107.174.27.60]:58160) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njZQA-0007Fc-IR; Wed, 27 Apr 2022 00:37:00 -0400 Received: from fstn1-p1.ozlabs.ibm.com. (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 157A480517; Wed, 27 Apr 2022 00:36:52 -0400 (EDT) From: Alexey Kardashevskiy To: qemu-ppc@nongnu.org Subject: [PATCH qemu] spapr_pci: Disable IRQFD resampling on XIVE Date: Wed, 27 Apr 2022 14:36:51 +1000 Message-Id: <20220427043651.1162403-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=107.174.27.60; envelope-from=aik@ozlabs.ru; helo=ozlabs.ru X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alex Williamson , Alexey Kardashevskiy , qemu-devel@nongnu.org, Timothy Pearson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Frederic Barrat , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1651034288701100001 VFIO-PCI has an "KVM_IRQFD_FLAG_RESAMPLE" optimization for INTx EOI handling when KVM can unmask PCI INTx (level triggered interrupt) without switching to the userspace (=3D=3DQEMU). Unfortunately XIVE does not support level interrupts, QEMU emulates them and therefore there is no existing code path to kick the resamplefd. The problem appears when passing through a PCI adapter with the "pci=3Dnomsi" kernel parameter - the adapter's interrupt interrupt count in /proc/interrupts will stuck at "1". This disables resampler when the XIVE interrupt controller is configured. This should not be very visible though KVM already exits to QEMU for INTx and XIVE-capable boxes (POWER9 and newer) do not seem to have performance-critical INTx-only capable devices. Signed-off-by: Alexey Kardashevskiy --- C=C3=A9dric, this is what I meant when I said that spapr_pci.c was unaware = of the interrupt controller type, neither xics nor xive was mentioned in the file before. --- hw/ppc/spapr_pci.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 5bfd4aa9e5aa..2675052601db 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -729,11 +729,19 @@ static void pci_spapr_set_irq(void *opaque, int irq_n= um, int level) =20 static PCIINTxRoute spapr_route_intx_pin_to_irq(void *opaque, int pin) { + SpaprMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); SpaprPhbState *sphb =3D SPAPR_PCI_HOST_BRIDGE(opaque); - PCIINTxRoute route; + PCIINTxRoute route =3D { .mode =3D PCI_INTX_DISABLED }; =20 - route.mode =3D PCI_INTX_ENABLED; - route.irq =3D sphb->lsi_table[pin].irq; + /* + * Disable IRQFD resampler on XIVE as it does not support LSI and QEMU + * emulates those so the KVM kernel resamplefd kick is skipped and EOI + * is not delivered to VFIO-PCI. + */ + if (!spapr->xive) { + route.mode =3D PCI_INTX_ENABLED; + route.irq =3D sphb->lsi_table[pin].irq; + } =20 return route; } --=20 2.30.2