[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 13/65] acpi: Align the size to 128k
From: |
Michael S. Tsirkin |
Subject: |
[PULL v2 13/65] acpi: Align the size to 128k |
Date: |
Wed, 9 Dec 2020 13:07:45 -0500 |
From: Yubo Miao <miaoyubo@huawei.com>
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 <miaoyubo@huawei.com>
Signed-off-by: Jiahui Cen <cenjiahui@huawei.com>
Message-Id: <20201119014841.7298-7-cenjiahui@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
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 e0bed9037c..711cf2069f 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -57,6 +57,8 @@
#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;
@@ -656,6 +658,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)
{
@@ -743,6 +754,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);
}
--
MST
- [PULL v2 03/65] memory: Add IOMMUTLBEvent, (continued)
- [PULL v2 03/65] memory: Add IOMMUTLBEvent, Michael S. Tsirkin, 2020/12/09
- [PULL v2 04/65] memory: Add IOMMU_NOTIFIER_DEVIOTLB_UNMAP IOMMUTLBNotificationType, Michael S. Tsirkin, 2020/12/09
- [PULL v2 05/65] intel_iommu: Skip page walking on device iotlb invalidations, Michael S. Tsirkin, 2020/12/09
- [PULL v2 06/65] memory: Skip bad range assertion if notifier is DEVIOTLB_UNMAP type, Michael S. Tsirkin, 2020/12/09
- [PULL v2 07/65] virtio: reset device on bad guest index in virtio_load(), Michael S. Tsirkin, 2020/12/09
- [PULL v2 08/65] acpi/gpex: Extract two APIs from acpi_dsdt_add_pci, Michael S. Tsirkin, 2020/12/09
- [PULL v2 09/65] fw_cfg: Refactor extra pci roots addition, Michael S. Tsirkin, 2020/12/09
- [PULL v2 10/65] hw/arm/virt: Write extra pci roots into fw_cfg, Michael S. Tsirkin, 2020/12/09
- [PULL v2 12/65] acpi/gpex: Build tables for pxb, Michael S. Tsirkin, 2020/12/09
- [PULL v2 11/65] acpi: Extract crs build form acpi_build.c, Michael S. Tsirkin, 2020/12/09
- [PULL v2 13/65] acpi: Align the size to 128k,
Michael S. Tsirkin <=
- [PULL v2 14/65] unit-test: The files changed., Michael S. Tsirkin, 2020/12/09
- [PULL v2 16/65] unit-test: Add the binary file and clear diff.h, Michael S. Tsirkin, 2020/12/09
- [PULL v2 17/65] failover: fix indentantion, Michael S. Tsirkin, 2020/12/09
- [PULL v2 18/65] failover: Use always atomics for primary_should_be_hidden, Michael S. Tsirkin, 2020/12/09
- [PULL v2 15/65] unit-test: Add testcase for pxb, Michael S. Tsirkin, 2020/12/09
- [PULL v2 20/65] failover: Remove unused parameter, Michael S. Tsirkin, 2020/12/09
- [PULL v2 19/65] failover: primary bus is only used once, and where it is set, Michael S. Tsirkin, 2020/12/09
- [PULL v2 22/65] failover: qdev_device_add() returns err or dev set, Michael S. Tsirkin, 2020/12/09
- [PULL v2 21/65] failover: Remove external partially_hotplugged property, Michael S. Tsirkin, 2020/12/09
- [PULL v2 23/65] failover: Rename bool to failover_primary_hidden, Michael S. Tsirkin, 2020/12/09