From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVhrS-0001g0-P7 for qemu-devel@nongnu.org; Wed, 11 Mar 2015 10:43:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVhrN-0005O5-EI for qemu-devel@nongnu.org; Wed, 11 Mar 2015 10:43:50 -0400 Received: from mail-wg0-x22f.google.com ([2a00:1450:400c:c00::22f]:35989) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVhrN-0005Nm-8O for qemu-devel@nongnu.org; Wed, 11 Mar 2015 10:43:45 -0400 Received: by wghk14 with SMTP id k14so9789542wgh.3 for ; Wed, 11 Mar 2015 07:43:44 -0700 (PDT) Message-ID: <5500549D.3050902@gmail.com> Date: Wed, 11 Mar 2015 16:43:41 +0200 From: Marcel Apfelbaum MIME-Version: 1.0 References: <1423064635-19045-1-git-send-email-marcel@redhat.com> <1423064635-19045-2-git-send-email-marcel@redhat.com> In-Reply-To: <1423064635-19045-2-git-send-email-marcel@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/8] machine: query iommu machine property rather than qemu opts Reply-To: marcel@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, james.hogan@imgtec.com, mst@redhat.com, jan.kiszka@siemens.com, agraf@suse.de, scottwood@freescale.com, borntraeger@de.ibm.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com, leon.alrae@imgtec.com, aurelien@aurel32.net On 02/04/2015 05:43 PM, Marcel Apfelbaum wrote: > Fixes a QEMU crash when passing iommu parameter in command line. > > Signed-off-by: Marcel Apfelbaum Please amend commit message: 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 the 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 > --- > 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: >