[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 5/8] acpi: Align the size to 128k
From: |
Yubo Miao |
Subject: |
[PATCH v8 5/8] acpi: Align the size to 128k |
Date: |
Thu, 21 May 2020 11:36:28 +0800 |
If table size is changed between virt_acpi_build and
virt_acpi_build_update, the table size would not be updated to
UEFI, therefore, just align the size to 128kb, which is enough
and same with x86. It would warn if 64k is not enough and the
align size should be updated.
Signed-off-by: Yubo Miao <address@hidden>
---
hw/arm/virt-acpi-build.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 14fcabd197..d0616738e5 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -57,6 +57,8 @@
#include "hw/pci/pcie_host.h"
#define ARM_SPI_BASE 32
+#define ACPI_BUILD_TABLE_SIZE 0x20000
+
static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
{
uint16_t i;
@@ -885,6 +887,15 @@ struct AcpiBuildState {
bool patched;
} AcpiBuildState;
+static void acpi_align_size(GArray *blob, unsigned align)
+{
+ /*
+ * Align size to multiple of given size. This reduces the chance
+ * we need to change size in the future (breaking cross version migration).
+ */
+ g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align));
+}
+
static
void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
{
@@ -967,6 +978,20 @@ void virt_acpi_build(VirtMachineState *vms,
AcpiBuildTables *tables)
build_rsdp(tables->rsdp, tables->linker, &rsdp_data);
}
+ /*
+ * The align size is 128, warn if 64k is not enough therefore
+ * the align size could be resized.
+ */
+ if (tables_blob->len > ACPI_BUILD_TABLE_SIZE / 2) {
+ warn_report("ACPI table size %u exceeds %d bytes,"
+ " migration may not work",
+ tables_blob->len, ACPI_BUILD_TABLE_SIZE / 2);
+ error_printf("Try removing CPUs, NUMA nodes, memory slots"
+ " or PCI bridges.");
+ }
+ acpi_align_size(tables_blob, ACPI_BUILD_TABLE_SIZE);
+
+
/* Cleanup memory that's no longer used. */
g_array_free(table_offsets, true);
}
--
2.19.1
- [PATCH v8 0/8] pci_expander_brdige:acpi: Support pxb-pcie for ARM, Yubo Miao, 2020/05/20
- [PATCH v8 1/8] acpi: Extract two APIs from acpi_dsdt_add_pci, Yubo Miao, 2020/05/20
- [PATCH v8 2/8] fw_cfg: Write the extra roots into the fw_cfg, Yubo Miao, 2020/05/20
- [PATCH v8 3/8] acpi: Extract crs build form acpi_build.c, Yubo Miao, 2020/05/20
- [PATCH v8 4/8] acpi: Refactor the source of host bridge and build tables for pxb, Yubo Miao, 2020/05/20
- [PATCH v8 5/8] acpi: Align the size to 128k,
Yubo Miao <=
- [PATCH v8 6/8] unit-test: The files changed., Yubo Miao, 2020/05/20
- [PATCH v8 8/8] unit-test: Add the binary file and clear diff.h, Yubo Miao, 2020/05/20
- [PATCH v8 7/8] unit-test: Add testcase for pxb, Yubo Miao, 2020/05/20
- Re: [PATCH v8 0/8] pci_expander_brdige:acpi: Support pxb-pcie for ARM, no-reply, 2020/05/21
- Re: [PATCH v8 0/8] pci_expander_brdige:acpi: Support pxb-pcie for ARM, no-reply, 2020/05/21