From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: [PATCH] pci-assign: Catch missing KVM support Date: Sun, 07 Nov 2010 14:08:01 +0100 Message-ID: <4CD6A4B1.9010401@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: kvm To: Avi Kivity , Marcelo Tosatti Return-path: Received: from fmmailgate02.web.de ([217.72.192.227]:34863 "EHLO fmmailgate02.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752471Ab0KGNR3 (ORCPT ); Sun, 7 Nov 2010 08:17:29 -0500 Sender: kvm-owner@vger.kernel.org List-ID: From: Jan Kiszka Report an error instead of raising a SEGV when a pci-assign device is about to be initialized without KVM enabled. Signed-off-by: Jan Kiszka --- hw/device-assignment.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index bde231d..5f5bde1 100644 --- a/hw/device-assignment.c +++ b/hw/device-assignment.c @@ -1440,6 +1440,11 @@ static int assigned_initfn(struct PCIDevice *pci_dev) uint8_t e_device, e_intx; int r; + if (!kvm_enabled()) { + error_report("pci-assign: error: requires KVM support"); + return -1; + } + if (!dev->host.seg && !dev->host.bus && !dev->host.dev && !dev->host.func) { error_report("pci-assign: error: no host device specified"); return -1; -- 1.7.1