From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: jsnow@redhat.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH 4/6] pc: introduce new ACPI table sizing algorithm
Date: Thu, 18 Sep 2014 18:17:52 +0200 [thread overview]
Message-ID: <1411057074-11157-5-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1411057074-11157-1-git-send-email-pbonzini@redhat.com>
Add padding after the DSDT. Tables that vary depending on the
command-line arguments will have to be byte-equivalent across QEMU
versions >= 2.2, while fixed tables (including the DSDT) can be
changed freely.
This new algorithm will let us present smaller ACPI blobs to
the guest, which avoids bugs with -kernel/-initrd and 32-bit
RHEL5 guests. However, this patch does not change the size of
the blobs yet; for now, the values of the parameters are tuned
to have 2.1-compatible sizes.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/i386/acpi-build.c | 11 +++++++----
hw/i386/pc_piix.c | 5 +++++
include/hw/i386/pc.h | 2 ++
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 694ee91..48e7f2e 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -65,8 +65,6 @@
#define ACPI_BUILD_LEGACY_CPU_AML_SIZE 97
#define ACPI_BUILD_ALIGN_SIZE 0x1000
-#define ACPI_BUILD_TABLE_SIZE 0x20000
-
typedef struct AcpiCpuInfo {
DECLARE_BITMAP(found_cpus, ACPI_CPU_HOTPLUG_ID_LIMIT);
} AcpiCpuInfo;
@@ -1597,6 +1595,10 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
acpi_add_table(table_offsets, tables->table_data);
build_fadt(tables->table_data, tables->linker, &pm, facs, dsdt);
+ if (guest_info->fixed_table_align) {
+ acpi_align_size(tables->table_data, guest_info->fixed_table_align);
+ }
+
ssdt = tables->table_data->len;
acpi_add_table(table_offsets, tables->table_data);
build_ssdt(tables->table_data, tables->linker, &cpu, &pm, &misc, &pci,
@@ -1681,14 +1683,15 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
g_array_set_size(tables->table_data, legacy_table_size);
} else {
/* Make sure we have a buffer in case we need to resize the tables. */
- if (tables->table_data->len > ACPI_BUILD_TABLE_SIZE / 2) {
+ if (!guest_info->fixed_table_align &&
+ tables->table_data->len > guest_info->acpi_table_align / 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, ACPI_BUILD_TABLE_SIZE);
+ acpi_align_size(tables->table_data, guest_info->acpi_table_align);
}
pc_set_acpi_data_size(tables->table_data->len);
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index ca9f07c..1ecb281 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -61,6 +61,8 @@ static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
static bool has_acpi_build = true;
static int legacy_acpi_table_size;
+static int fixed_table_align = 0;
+static int acpi_table_align = 131072;
static bool smbios_defaults = true;
static bool smbios_legacy_mode;
/* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
@@ -164,6 +166,8 @@ static void pc_init1(MachineState *machine,
guest_info->has_acpi_build = has_acpi_build;
guest_info->legacy_acpi_table_size = legacy_acpi_table_size;
+ guest_info->fixed_table_align = fixed_table_align;
+ guest_info->acpi_table_align = acpi_table_align;
guest_info->isapc_ram_fw = !pci_enabled;
guest_info->has_reserved_memory = has_reserved_memory;
@@ -314,6 +318,7 @@ static void pc_compat_2_0(MachineState *machine)
* QEMU 1.7 it is 6414. For RHEL/CentOS 7.0 it is 6418.
*/
legacy_acpi_table_size = 6652;
+ acpi_table_align = 4096;
smbios_legacy_mode = true;
has_reserved_memory = false;
}
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 853829b..8b65b47 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -94,6 +94,8 @@ struct PcGuestInfo {
uint64_t *node_cpu;
FWCfgState *fw_cfg;
int legacy_acpi_table_size;
+ int fixed_table_align;
+ int acpi_table_align;
bool has_acpi_build;
bool has_reserved_memory;
};
--
2.1.0
next prev parent reply other threads:[~2014-09-18 16:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-18 16:17 [Qemu-devel] [PATCH 0/6] pc: bring ACPI table size below to 2.0 levels, try fixing -initrd for good Paolo Bonzini
2014-09-18 16:17 ` [Qemu-devel] [PATCH 1/6] pc: initialize fw_cfg earlier Paolo Bonzini
2014-09-18 16:17 ` [Qemu-devel] [PATCH 2/6] pc: load the kernel after ACPI tables are built Paolo Bonzini
2014-09-18 16:17 ` [Qemu-devel] [PATCH 3/6] pc: redo sizing of reserved high memory area for -kernel/-initrd Paolo Bonzini
2014-09-18 16:17 ` Paolo Bonzini [this message]
2014-09-18 16:17 ` [Qemu-devel] [PATCH 5/6] pc: go back to smaller ACPI tables Paolo Bonzini
2014-09-18 16:17 ` [Qemu-devel] [PATCH 6/6] pc: clean up pre-2.1 compatibility code Paolo Bonzini
2014-09-19 7:36 ` [Qemu-devel] [PATCH 0/6] pc: bring ACPI table size below to 2.0 levels, try fixing -initrd for good Gerd Hoffmann
2014-09-19 8:06 ` Paolo Bonzini
2014-09-19 13:09 ` Paolo Bonzini
2014-10-02 12:11 ` Michael S. Tsirkin
2014-10-02 12:44 ` Paolo Bonzini
2014-10-02 13:30 ` Paolo Bonzini
2014-10-02 13:41 ` Michael S. Tsirkin
2014-10-02 13:43 ` Paolo Bonzini
2014-10-02 13:49 ` Michael S. Tsirkin
2014-10-06 13:42 ` Paolo Bonzini
2014-10-06 13:52 ` Michael S. Tsirkin
2014-10-06 13:55 ` Paolo Bonzini
2014-10-06 14:12 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1411057074-11157-5-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=jsnow@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).