From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xb9i6-0006ip-WB for qemu-devel@nongnu.org; Mon, 06 Oct 2014 10:56:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xb9hx-0000q7-VG for qemu-devel@nongnu.org; Mon, 06 Oct 2014 10:56:26 -0400 Received: from mail-qc0-x236.google.com ([2607:f8b0:400d:c01::236]:53687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xb9hx-0000po-S4 for qemu-devel@nongnu.org; Mon, 06 Oct 2014 10:56:17 -0400 Received: by mail-qc0-f182.google.com with SMTP id i17so4074784qcy.13 for ; Mon, 06 Oct 2014 07:56:17 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 6 Oct 2014 16:56:04 +0200 Message-Id: <1412607364-14141-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1412607364-14141-1-git-send-email-pbonzini@redhat.com> References: <1412607364-14141-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v2 3/3] pc: clean up pre-2.1 compatibility code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mst@redhat.com Now that the alignment is parameterized, we can share the call to acpi_align_size between all three (1.7-2.0/2.1/2.2+) sizing algorithms. Also, with the new rule that SSDT cannot change except with machine-type compat code, the magic 97 constant for a CPU's AML size is not anymore "legacy", so rename it. Signed-off-by: Paolo Bonzini --- hw/i386/acpi-build.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 6bffc75..ec6828e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -62,8 +62,8 @@ * a little bit, there should be plenty of free space since the DSDT * shrunk by ~1.5k between QEMU 2.0 and QEMU 2.1. */ -#define ACPI_BUILD_LEGACY_CPU_AML_SIZE 97 -#define ACPI_BUILD_ALIGN_SIZE 0x1000 +#define ACPI_BUILD_CPU_AML_SIZE 97 +#define ACPI_BUILD_ALIGN_SIZE 0x1000 typedef struct AcpiCpuInfo { DECLARE_BITMAP(found_cpus, ACPI_CPU_HOTPLUG_ID_LIMIT); @@ -1672,10 +1672,9 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) */ int legacy_aml_len = guest_info->legacy_acpi_table_size + - ACPI_BUILD_LEGACY_CPU_AML_SIZE * max_cpus; + ACPI_BUILD_CPU_AML_SIZE * max_cpus; int legacy_table_size = - ROUND_UP(tables->table_data->len - aml_len + legacy_aml_len, - ACPI_BUILD_ALIGN_SIZE); + tables->table_data->len - aml_len + legacy_aml_len; if (tables->table_data->len > legacy_table_size) { /* Should happen only with PCI bridges and -M pc-i440fx-2.0. */ error_report("Warning: migration may not work."); @@ -1691,8 +1690,8 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) error_report("Warning: please remove CPUs, NUMA nodes, " "memory slots or PCI bridges."); } - acpi_align_size(tables->table_data, guest_info->acpi_table_align); } + acpi_align_size(tables->table_data, guest_info->acpi_table_align); acpi_align_size(tables->linker, ACPI_BUILD_ALIGN_SIZE); -- 2.1.0