From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ5fD-0001ge-JD for qemu-devel@nongnu.org; Wed, 04 Feb 2015 14:31:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJ5f9-0002Uf-IK for qemu-devel@nongnu.org; Wed, 04 Feb 2015 14:31:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38181) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJ5f9-0002UZ-9r for qemu-devel@nongnu.org; Wed, 04 Feb 2015 14:30:59 -0500 Message-ID: <54D27356.6000406@redhat.com> Date: Wed, 04 Feb 2015 21:30:30 +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> <87iofhhbdn.fsf@blackfin.pond.sub.org> In-Reply-To: <87iofhhbdn.fsf@blackfin.pond.sub.org> 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 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, james.hogan@imgtec.com, mst@redhat.com, jan.kiszka@siemens.com, qemu-devel@nongnu.org, 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 06:47 PM, Markus Armbruster wrote: > Marcel Apfelbaum writes: > >> 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, > > What does this buy us over a straight current_machine->iommu? Following QOM guidelines/conventions all object fields are private to machine files only. The *only* ways that they can be exposed are: 1. A wrapper 2. object_property_get... I chose the wrapper because the other variant would be really ugly and should be used only on a generic code. This is the real reason I used this, but pure theoretical speaking using wrappers will give us the opportunity to change machine_iommu implementation without the need to change the call sites. To wrap it up, I just followed previous comments I received on QOM handling. Thanks, Marcel > > Same for the other wrapper functions. > > [...] >