From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVmek-0002fj-Oh for qemu-devel@nongnu.org; Wed, 11 Mar 2015 15:51:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVmeg-0004yY-DN for qemu-devel@nongnu.org; Wed, 11 Mar 2015 15:51:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVmeg-0004yR-4n for qemu-devel@nongnu.org; Wed, 11 Mar 2015 15:50:58 -0400 Date: Wed, 11 Mar 2015 20:50:51 +0100 From: "Michael S. Tsirkin" Message-ID: <20150311205051-mutt-send-email-mst@redhat.com> References: <1426096767-30494-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1426096767-30494-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 06/25] machine: replace qemu opts with iommu property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Peter Maydell , Paolo Bonzini From: Marcel Apfelbaum Fixes a QEMU crash when passing iommu parameter in command line. Running x86_64-softmmu/qemu-system-x86_64 -machine pc,iommu=on -enable-kvm leads to crash: qemu-system-x86_64: qemu/util/qemu-option.c:387: qemu_opt_get_bool_helper: Assertion `opt->desc && opt->desc->type == QEMU_OPT_BOOL' failed. Aborted (core dumped) This happens because commit e79d5a6 ("machine: remove qemu_machine_opts global list") removed the global option descriptions and moved them to MachineState's QOM properties. Fix this by querying machine properties through designated wrappers. Signed-off-by: Marcel Apfelbaum Acked-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Paolo Bonzini --- include/hw/boards.h | 1 + hw/core/machine.c | 5 +++++ hw/pci-host/q35.c | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) 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: 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 df60e61..c8827cc 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -415,7 +415,7 @@ static void mch_realize(PCIDevice *d, Error **errp) 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); } } -- MST