From patchwork Wed Jan 28 10:03:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 433835 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 207681401F6 for ; Wed, 28 Jan 2015 21:06:27 +1100 (AEDT) Received: from localhost ([::1]:52253 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGPVw-00087F-Ul for incoming@patchwork.ozlabs.org; Wed, 28 Jan 2015 05:06:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGPTY-0003Zg-Dp for qemu-devel@nongnu.org; Wed, 28 Jan 2015 05:03:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGPTU-00025q-Au for qemu-devel@nongnu.org; Wed, 28 Jan 2015 05:03:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39940) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGPTU-00025m-44 for qemu-devel@nongnu.org; Wed, 28 Jan 2015 05:03:52 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0SA3l8J009779 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Jan 2015 05:03:48 -0500 Received: from dell-pet610-01.lab.eng.brq.redhat.com (dell-pet610-01.lab.eng.brq.redhat.com [10.34.42.20]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0SA3gls003507; Wed, 28 Jan 2015 05:03:46 -0500 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Wed, 28 Jan 2015 10:03:26 +0000 Message-Id: <1422439417-5031-3-git-send-email-imammedo@redhat.com> In-Reply-To: <1422439417-5031-1-git-send-email-imammedo@redhat.com> References: <20150128072757.GA12987@redhat.com> <1422439417-5031-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: pbonzini@redhat.com, drjones@redhat.com, zhaoshenglong@huawei.com, claudio.fontana@huawei.com, marcel.a@redhat.com Subject: [Qemu-devel] [PATCH 02/13] make toplevel ACPI tables blob a pointer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org in following patch toplevel blob would be switched to QOM AML_OBJECT model vs manually constructed now. Signed-off-by: Igor Mammedov --- hw/i386/acpi-build.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index c7f492e..f24f92b 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1270,7 +1270,7 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) typedef struct AcpiBuildTables { - AcpiAml table_data; + AcpiAml* table_data; GArray *rsdp; GArray *tcpalog; GArray *linker; @@ -1279,10 +1279,10 @@ struct AcpiBuildTables { static inline void acpi_build_tables_init(AcpiBuildTables *tables) { tables->rsdp = g_array_new(false, true /* clear */, 1); - tables->table_data.buf = g_array_new(false, true /* clear */, 1); + tables->table_data->buf = g_array_new(false, true /* clear */, 1); tables->tcpalog = g_array_new(false, true /* clear */, 1); tables->linker = bios_linker_loader_init(); - tables->table_data.linker = tables->linker; + tables->table_data->linker = tables->linker; } static inline void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre) @@ -1290,7 +1290,7 @@ static inline void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre) void *linker_data = bios_linker_loader_cleanup(tables->linker); g_free(linker_data); g_array_free(tables->rsdp, mfre); - g_array_free(tables->table_data.buf, true); + g_array_free(tables->table_data->buf, true); g_array_free(tables->tcpalog, mfre); } @@ -1461,23 +1461,23 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) guest_info->legacy_acpi_table_size + ACPI_BUILD_LEGACY_CPU_AML_SIZE * max_cpus; int legacy_table_size = - ROUND_UP(tables->table_data.buf->len - aml_len + legacy_aml_len, + ROUND_UP(tables->table_data->buf->len - aml_len + legacy_aml_len, ACPI_BUILD_ALIGN_SIZE); - if (tables->table_data.buf->len > legacy_table_size) { + if (tables->table_data->buf->len > legacy_table_size) { /* Should happen only with PCI bridges and -M pc-i440fx-2.0. */ error_report("Warning: migration may not work."); } - g_array_set_size(tables->table_data.buf, legacy_table_size); + g_array_set_size(tables->table_data->buf, legacy_table_size); } else { /* Make sure we have a buffer in case we need to resize the tables. */ - if (tables->table_data.buf->len > ACPI_BUILD_TABLE_SIZE / 2) { + if (tables->table_data->buf->len > ACPI_BUILD_TABLE_SIZE / 2) { /* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. */ error_report("Warning: ACPI tables are larger than 64k."); error_report("Warning: migration may not work."); error_report("Warning: please remove CPUs, NUMA nodes, " "memory slots or PCI bridges."); } - acpi_align_size(tables->table_data.buf, ACPI_BUILD_TABLE_SIZE); + acpi_align_size(tables->table_data->buf, ACPI_BUILD_TABLE_SIZE); } acpi_align_size(tables->linker, ACPI_BUILD_ALIGN_SIZE); @@ -1501,14 +1501,14 @@ static void acpi_build_update(void *build_opaque, uint32_t offset) acpi_build(build_state->guest_info, &tables); - assert(acpi_data_len(tables.table_data.buf) == build_state->table_size); + assert(acpi_data_len(tables.table_data->buf) == build_state->table_size); /* Make sure RAM size is correct - in case it got changed by migration */ qemu_ram_resize(build_state->table_ram, build_state->table_size, &error_abort); memcpy(qemu_get_ram_ptr(build_state->table_ram), - tables.table_data.buf->data, build_state->table_size); + tables.table_data->buf->data, build_state->table_size); cpu_physical_memory_set_dirty_range_nocode(build_state->table_ram, build_state->table_size); @@ -1570,11 +1570,11 @@ void acpi_setup(PcGuestInfo *guest_info) /* Now expose it all to Guest */ build_state->table_ram = acpi_add_rom_blob(build_state, - tables.table_data.buf, + tables.table_data->buf, ACPI_BUILD_TABLE_FILE, ACPI_BUILD_TABLE_MAX_SIZE); assert(build_state->table_ram != RAM_ADDR_MAX); - build_state->table_size = acpi_data_len(tables.table_data.buf); + build_state->table_size = acpi_data_len(tables.table_data->buf); acpi_add_rom_blob(NULL, tables.linker, "etc/table-loader", 0);