From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdR5u-0005ER-Kg for qemu-devel@nongnu.org; Tue, 27 Nov 2012 14:45:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TdR5t-0006uu-K3 for qemu-devel@nongnu.org; Tue, 27 Nov 2012 14:45:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33229) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdR5t-0006ug-Ct for qemu-devel@nongnu.org; Tue, 27 Nov 2012 14:45:21 -0500 From: Alex Williamson Date: Tue, 27 Nov 2012 12:45:18 -0700 Message-ID: <20121127194314.2422.65587.stgit@bling.home> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH for-1.3] vfio-pci: Fix KVM disabled path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@us.ibm.com Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org kvm_check_extension() explodes when KVM isn't enabled so we need to first test whether KVM is enabled. Use kvm_irqchip_in_kernel() for this since it matches the test we do before using this result. Signed-off-by: Alex Williamson --- hw/vfio_pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Anthony, please include this for 1.3. Let me know if you prefer a pull request. Thanks, Alex diff --git a/hw/vfio_pci.c b/hw/vfio_pci.c index 7c27834..2acc757 100644 --- a/hw/vfio_pci.c +++ b/hw/vfio_pci.c @@ -438,7 +438,8 @@ static int vfio_enable_intx(VFIODevice *vdev) * Only conditional to avoid generating error messages on platforms * where we won't actually use the result anyway. */ - if (kvm_check_extension(kvm_state, KVM_CAP_IRQFD_RESAMPLE)) { + if (kvm_irqchip_in_kernel() && + kvm_check_extension(kvm_state, KVM_CAP_IRQFD_RESAMPLE)) { vdev->intx.route = pci_device_route_intx_to_irq(&vdev->pdev, vdev->intx.pin); }