From nobody Tue Apr 30 06:44:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1511327911564315.2230448867808; Tue, 21 Nov 2017 21:18:31 -0800 (PST) Received: from localhost ([::1]:37931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHNQY-0002Gg-Rv for importer@patchew.org; Wed, 22 Nov 2017 00:18:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHNPb-0001pW-42 for qemu-devel@nongnu.org; Wed, 22 Nov 2017 00:17:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHNPX-0005DZ-W8 for qemu-devel@nongnu.org; Wed, 22 Nov 2017 00:17:27 -0500 Received: from ozlabs.ru ([107.173.13.209]:59574) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHNPX-0005DR-Pw for qemu-devel@nongnu.org; Wed, 22 Nov 2017 00:17:23 -0500 Received: from vpl1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 357563A60022; Wed, 22 Nov 2017 00:16:02 -0500 (EST) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Wed, 22 Nov 2017 16:16:49 +1100 Message-Id: <20171122051649.3599-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 107.173.13.209 Subject: [Qemu-devel] [PATCH qemu] vfio: Allow configuration without INTx X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexey Kardashevskiy , Alex Williamson , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" On some platforms INTx may not be enabled on a KVM host (one such example is IBM pHyp hypervisor and this is intentional). However the PCI_INTERRUPT_PIN is not 0 so QEMU tries initializing INTx, fails as (!vdev->pdev->irq) in the VFIO's vfio_intx_enable() and this is a fatal error. This adds a debug switch - "x-no-intx" - in order to allow broken INTx configuration. Signed-off-by: Alexey Kardashevskiy --- In practice, test teams run PR KVM under HV KVM and there INTx is enabled on all levels so having this as a debug switch is enough. --- hw/vfio/pci.h | 1 + hw/vfio/pci.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index 502a575..c5e168e 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -141,6 +141,7 @@ typedef struct VFIOPCIDevice { bool has_flr; bool has_pm_reset; bool rom_read_failed; + bool no_intx; bool no_kvm_intx; bool no_kvm_msi; bool no_kvm_msix; diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index c977ee3..c9caf6a 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2869,7 +2869,12 @@ static void vfio_realize(PCIDevice *pdev, Error **er= rp) pci_device_set_intx_routing_notifier(&vdev->pdev, vfio_intx_update= ); ret =3D vfio_intx_enable(vdev, errp); if (ret) { - goto out_teardown; + if (vdev->no_intx) { + error_report_err(*errp); + *errp =3D NULL; + } else { + goto out_teardown; + } } } =20 @@ -2986,6 +2991,7 @@ static Property vfio_pci_dev_properties[] =3D { DEFINE_PROP_BIT("x-igd-opregion", VFIOPCIDevice, features, VFIO_FEATURE_ENABLE_IGD_OPREGION_BIT, false), DEFINE_PROP_BOOL("x-no-mmap", VFIOPCIDevice, vbasedev.no_mmap, false), + DEFINE_PROP_BOOL("x-no-intx", VFIOPCIDevice, no_intx, false), DEFINE_PROP_BOOL("x-no-kvm-intx", VFIOPCIDevice, no_kvm_intx, false), DEFINE_PROP_BOOL("x-no-kvm-msi", VFIOPCIDevice, no_kvm_msi, false), DEFINE_PROP_BOOL("x-no-kvm-msix", VFIOPCIDevice, no_kvm_msix, false), --=20 2.11.0