[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 19/35] acpi: build_waet: use acpi_table_begin()/acpi_table
From: |
Eric Auger |
Subject: |
Re: [PATCH v3 19/35] acpi: build_waet: use acpi_table_begin()/acpi_table_end() instead of build_header() |
Date: |
Wed, 22 Sep 2021 11:20:08 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 |
On 9/7/21 4:47 PM, Igor Mammedov wrote:
> it replaces error-prone pointer arithmetic for build_header() API,
> with 2 calls to start and finish table creation,
> which hides offsets magic from API user.
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> v3:
> * s/acpi_init_table|acpi_table_composed/acpi_table_begin|acpi_table_end/
>
> CC: marcel.apfelbaum@gmail.com
> ---
> hw/i386/acpi-build.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 2875c4f393..45724469b0 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -2201,10 +2201,10 @@ static void
> build_waet(GArray *table_data, BIOSLinker *linker, const char *oem_id,
> const char *oem_table_id)
> {
> - int waet_start = table_data->len;
> + AcpiTable table = { .sig = "WAET", .rev = 1, .oem_id = oem_id,
> + .oem_table_id = oem_table_id };
>
> - /* WAET header */
> - acpi_data_push(table_data, sizeof(AcpiTableHeader));
> + acpi_table_begin(&table, table_data);
> /*
> * Set "ACPI PM timer good" flag.
> *
> @@ -2213,9 +2213,7 @@ build_waet(GArray *table_data, BIOSLinker *linker,
> const char *oem_id,
> * Which avoids costly VMExits caused by guest re-reading it
> unnecessarily.
> */
> build_append_int_noprefix(table_data, 1 << 1 /* ACPI PM timer good */,
> 4);
> -
> - build_header(linker, table_data, (void *)(table_data->data + waet_start),
> - "WAET", table_data->len - waet_start, 1, oem_id,
> oem_table_id);
> + acpi_table_end(linker, &table);
> }
>
> /*
>
an easy one
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Eric
- [PATCH v3 15/35] acpi: build_tpm_tcpa: use acpi_table_begin()/acpi_table_end() instead of build_header(), (continued)
- [PATCH v3 19/35] acpi: build_waet: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- Re: [PATCH v3 19/35] acpi: build_waet: use acpi_table_begin()/acpi_table_end() instead of build_header(),
Eric Auger <=
- [PATCH v3 21/35] acpi: madt: arm/x86: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 20/35] acpi: build_amd_iommu: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 23/35] acpi: x86: set enabled when composing _MAT entries, Igor Mammedov, 2021/09/07
- [PATCH v3 24/35] acpi: x86: madt: use build_append_int_noprefix() API to compose MADT table, Igor Mammedov, 2021/09/07