From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ28D-0003dC-US for qemu-devel@nongnu.org; Wed, 04 Feb 2015 10:44:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJ287-0004a6-Gj for qemu-devel@nongnu.org; Wed, 04 Feb 2015 10:44:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ287-0004Y1-8w for qemu-devel@nongnu.org; Wed, 04 Feb 2015 10:44:39 -0500 From: Marcel Apfelbaum Date: Wed, 4 Feb 2015 17:43:48 +0200 Message-Id: <1423064635-19045-2-git-send-email-marcel@redhat.com> In-Reply-To: <1423064635-19045-1-git-send-email-marcel@redhat.com> References: <1423064635-19045-1-git-send-email-marcel@redhat.com> Subject: [Qemu-devel] [PATCH 1/8] machine: query iommu machine property rather than qemu opts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, james.hogan@imgtec.com, mst@redhat.com, marcel@redhat.com, jan.kiszka@siemens.com, cornelia.huck@de.ibm.com, agraf@suse.de, borntraeger@de.ibm.com, scottwood@freescale.com, pbonzini@redhat.com, leon.alrae@imgtec.com, aurelien@aurel32.net Fixes a QEMU crash when passing iommu parameter in command line. Signed-off-by: Marcel Apfelbaum --- hw/core/machine.c | 5 +++++ hw/pci-host/q35.c | 2 +- include/hw/boards.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index fbd91be..096eb10 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -403,6 +403,11 @@ bool machine_usb(MachineState *machine) return machine->usb; } +bool machine_iommu(MachineState *machine) +{ + return machine->iommu; +} + static const TypeInfo machine_info = { .name = TYPE_MACHINE, .parent = TYPE_OBJECT, diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index b20bad8..dfd8bbf 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -415,7 +415,7 @@ static int mch_init(PCIDevice *d) PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); } /* Intel IOMMU (VT-d) */ - if (qemu_opt_get_bool(qemu_get_machine_opts(), "iommu", false)) { + if (machine_iommu(current_machine)) { mch_init_dmar(mch); } return 0; diff --git a/include/hw/boards.h b/include/hw/boards.h index 3ddc449..a12f041 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -66,6 +66,7 @@ MachineClass *find_default_machine(void); extern MachineState *current_machine; bool machine_usb(MachineState *machine); +bool machine_iommu(MachineState *machine); /** * MachineClass: -- 2.1.0