From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YN581-00034m-HF for qemu-devel@nongnu.org; Sun, 15 Feb 2015 14:45:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YN57w-0000FA-NC for qemu-devel@nongnu.org; Sun, 15 Feb 2015 14:45:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YN57w-0000F6-Ea for qemu-devel@nongnu.org; Sun, 15 Feb 2015 14:45:12 -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 (8.14.4/8.14.4) with ESMTP id t1FJjATU010573 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Sun, 15 Feb 2015 14:45:11 -0500 Date: Sun, 15 Feb 2015 20:45:07 +0100 From: "Michael S. Tsirkin" Message-ID: <20150215194507.GA22518@redhat.com> References: <1423490395-22054-1-git-send-email-imammedo@redhat.com> <1423490395-22054-3-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1423490395-22054-3-git-send-email-imammedo@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 2/3] pc: acpi-build: update linker on guest access List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, marcel.a@redhat.com On Mon, Feb 09, 2015 at 01:59:54PM +0000, Igor Mammedov wrote: > Linker table is build only once, so if later during > tables rebuild sizes of other ACPI tables change > pointers will be patched incorrectly due to wrong > offsets in linker. Resulting in guest not being able > to find ACPI tables. > Fix it by updating 'linker' table with the rest of > tables when firmware reads it. > > Signed-off-by: Igor Mammedov > --- > hw/i386/acpi-build.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index 5b2b017..21ea3db 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -1527,6 +1527,8 @@ struct AcpiBuildState { > uint8_t patched; > PcGuestInfo *guest_info; > void *rsdp; > + ram_addr_t linker_ram; > + uint32_t linker_size; > } AcpiBuildState; > > static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg) > @@ -1733,6 +1735,8 @@ static void acpi_build_update(void *build_opaque, uint32_t offset) > memcpy(qemu_get_ram_ptr(build_state->table_ram), tables.table_data->data, > build_state->table_size); > memcpy(build_state->rsdp, tables.rsdp->data, acpi_data_len(tables.rsdp)); > + memcpy(qemu_get_ram_ptr(build_state->linker_ram), tables.linker->data, > + build_state->linker_size); > > cpu_physical_memory_set_dirty_range_nocode(build_state->table_ram, > build_state->table_size); OK, but it looks like linker data needs to be marked dirty as well. I'll send a patch to do this. > @@ -1799,7 +1803,9 @@ void acpi_setup(PcGuestInfo *guest_info) > assert(build_state->table_ram != RAM_ADDR_MAX); > build_state->table_size = acpi_data_len(tables.table_data); > > - acpi_add_rom_blob(NULL, tables.linker, "etc/table-loader", 0); > + build_state->linker_ram = > + acpi_add_rom_blob(build_state, tables.linker, "etc/table-loader", 0); > + build_state->linker_size = acpi_data_len(tables.linker); > > fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE, > tables.tcpalog->data, acpi_data_len(tables.tcpalog)); > -- > 1.8.3.1