Message ID | 20200408125816.955-6-miaoyubo@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | pci_expander_brdige:acpi:Support pxb-pcie for ARM | expand |
On Wed, Apr 08, 2020 at 08:58:13PM +0800, Yubo Miao wrote: > From: miaoyubo <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: miaoyubo <miaoyubo@huawei.com> does this affect migration in any way? > --- > 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 7bcd04dfb7..89bb768b0c 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -54,6 +54,8 @@ > #include "hw/pci/pci_bridge.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; > @@ -883,6 +885,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) > { > @@ -953,6 +964,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 >
> -----Original Message----- > From: Michael S. Tsirkin [mailto:mst@redhat.com] > Sent: Monday, May 4, 2020 10:03 PM > To: miaoyubo <miaoyubo@huawei.com> > Cc: peter.maydell@linaro.org; shannon.zhaosl@gmail.com; > lersek@redhat.com; imammedo@redhat.com; qemu-devel@nongnu.org; > berrange@redhat.com; Xiexiangyou <xiexiangyou@huawei.com> > Subject: Re: [PATCH v6 5/8] acpi: Align the size to 128k > > On Wed, Apr 08, 2020 at 08:58:13PM +0800, Yubo Miao wrote: > > From: miaoyubo <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: miaoyubo <miaoyubo@huawei.com> > > does this affect migration in any way? > No, it would not affect migration. I migrated one vm between two qemus(one with tables aligned to 128k and one not) and the vm could be migrated. > > --- > > 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 > > 7bcd04dfb7..89bb768b0c 100644 > > --- a/hw/arm/virt-acpi-build.c > > +++ b/hw/arm/virt-acpi-build.c > > @@ -54,6 +54,8 @@ > > #include "hw/pci/pci_bridge.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; > > @@ -883,6 +885,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). > > + */ > > 2.19.1 > > Regards, Miao
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 7bcd04dfb7..89bb768b0c 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -54,6 +54,8 @@ #include "hw/pci/pci_bridge.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; @@ -883,6 +885,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) { @@ -953,6 +964,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); }