From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: [PATCH for-1.3] vfio-pci: Fix KVM disabled path 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 Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org To: aliguori@us.ibm.com Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50536 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752879Ab2K0TpW (ORCPT ); Tue, 27 Nov 2012 14:45:22 -0500 Sender: kvm-owner@vger.kernel.org List-ID: 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); }