From patchwork Tue Nov 27 19:45:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 202286 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E1E562C008F for ; Wed, 28 Nov 2012 06:45:36 +1100 (EST) Received: from localhost ([::1]:40807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TdR66-0005Eb-6Y for incoming@patchwork.ozlabs.org; Tue, 27 Nov 2012 14:45:34 -0500 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 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qARJjJ0d019846 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 27 Nov 2012 14:45:19 -0500 Received: from bling.home (ovpn-113-71.phx2.redhat.com [10.3.113.71]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qARJjJ0i020189; Tue, 27 Nov 2012 14:45:19 -0500 To: aliguori@us.ibm.com From: Alex Williamson Date: Tue, 27 Nov 2012 12:45:18 -0700 Message-ID: <20121127194314.2422.65587.stgit@bling.home> User-Agent: StGit/0.16 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH for-1.3] vfio-pci: Fix KVM disabled path X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.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); }