Received: from eggs.gnu.org ([2001:4830:134:3::10]:60721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6MY1-0005Bi-Nz for qemu-devel@nongnu.org; Tue, 08 Dec 2015 12:59:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a6MXy-00073M-FV for qemu-devel@nongnu.org; Tue, 08 Dec 2015 12:59:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6MXy-00073I-9o for qemu-devel@nongnu.org; Tue, 08 Dec 2015 12:59:30 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id C6390C0A5165 for ; Tue, 8 Dec 2015 17:59:29 +0000 (UTC) Date: Tue, 8 Dec 2015 15:59:27 -0200 From: Eduardo Habkost Message-ID: <20151208175927.GN14490@thinpad.lan.raisama.net> References: <1449020831-8414-1-git-send-email-ehabkost@redhat.com> <1449020831-8414-7-git-send-email-ehabkost@redhat.com> <5665A831.2060504@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5665A831.2060504@gmail.com> Subject: Re: [Qemu-devel] [PATCH 06/16] acpi: Save PCMachineState on AcpiBuildState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcel@redhat.com Cc: Igor Mammedov , "Michael S. Tsirkin" , qemu-devel@nongnu.org, Marcel Apfelbaum On Mon, Dec 07, 2015 at 05:39:29PM +0200, Marcel Apfelbaum wrote: > On 12/02/2015 03:47 AM, Eduardo Habkost wrote: > >PCMachineState will be used in some of the steps of ACPI table > >building. > > > >Signed-off-by: Eduardo Habkost > >--- > > hw/i386/acpi-build.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > >diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > >index 85a5c53..ca11c88 100644 > >--- a/hw/i386/acpi-build.c > >+++ b/hw/i386/acpi-build.c > >@@ -1644,7 +1644,7 @@ struct AcpiBuildState { > > MemoryRegion *table_mr; > > /* Is table patched? */ > > uint8_t patched; > >- PcGuestInfo *guest_info; > >+ PCMachineState *pcms; > > void *rsdp; > > MemoryRegion *rsdp_mr; > > MemoryRegion *linker_mr; > >@@ -1855,7 +1855,7 @@ static void acpi_build_update(void *build_opaque, uint32_t offset) > > > > acpi_build_tables_init(&tables); > > > >- acpi_build(build_state->guest_info, &tables); > >+ acpi_build(&build_state->pcms->acpi_guest_info, &tables); > > > > acpi_ram_update(build_state->table_mr, tables.table_data); > > > >@@ -1916,12 +1916,12 @@ void acpi_setup(PCMachineState *pcms) > > > > build_state = g_malloc0(sizeof *build_state); > > > >- build_state->guest_info = guest_info; > >+ build_state->pcms = pcms; > > I am not "sold" on keeping a reference to machine in the build_state. > We can always query current machine using qdev_machine() or something. > > Keeping the "guest info" made sense since is used especially for ACPI, > however the machine has a wider scope. (And not having to keep it > around is a very good thing!) I wouldn't mind using qdev_get_machine() if preferred by the maintainer of that code, but I like to avoid it when possible. To me, qdev_get_machine() is just a global variable disguised as a harder-to-understand API. -- Eduardo