[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 09/35] acpi: build_hmat: use acpi_table_begin()/acpi_table
From: |
Eric Auger |
Subject: |
Re: [PATCH v3 09/35] acpi: build_hmat: use acpi_table_begin()/acpi_table_end() instead of build_header() |
Date: |
Mon, 20 Sep 2021 18:33:03 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 |
Hi Igor,
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.
>
> Also since acpi_table_begin() reserves space only for standard header
> while previous acpi_data_push() reserved the header + 4 bytes field,
> add 4 bytes 'Reserved' field into hmat_build_table_structs()
> which didn have it.
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Eruc
> ---
> v3:
> * s/acpi_init_table|acpi_table_composed/acpi_table_begin|acpi_table_end/
> ---
> hw/acpi/hmat.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/hw/acpi/hmat.c b/hw/acpi/hmat.c
> index edb3fd91b2..6913ebf730 100644
> --- a/hw/acpi/hmat.c
> +++ b/hw/acpi/hmat.c
> @@ -200,6 +200,8 @@ static void hmat_build_table_structs(GArray *table_data,
> NumaState *numa_state)
> HMAT_LB_Info *hmat_lb;
> NumaHmatCacheOptions *hmat_cache;
>
> + build_append_int_noprefix(table_data, 0, 4); /* Reserved */
> +
> for (i = 0; i < numa_state->num_nodes; i++) {
> flags = 0;
>
> @@ -256,14 +258,10 @@ static void hmat_build_table_structs(GArray
> *table_data, NumaState *numa_state)
> void build_hmat(GArray *table_data, BIOSLinker *linker, NumaState
> *numa_state,
> const char *oem_id, const char *oem_table_id)
> {
> - int hmat_start = table_data->len;
> -
> - /* reserve space for HMAT header */
> - acpi_data_push(table_data, 40);
> + AcpiTable table = { .sig = "HMAT", .rev = 2,
> + .oem_id = oem_id, .oem_table_id = oem_table_id };
>
> + acpi_table_begin(&table, table_data);
> hmat_build_table_structs(table_data, numa_state);
> -
> - build_header(linker, table_data,
> - (void *)(table_data->data + hmat_start),
> - "HMAT", table_data->len - hmat_start, 2, oem_id,
> oem_table_id);
> + acpi_table_end(linker, &table);
> }
>
- [PATCH v3 03/35] acpi: build_xsdt: use acpi_table_begin()/acpi_table_end() instead of build_header(), (continued)
- [PATCH v3 03/35] acpi: build_xsdt: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 06/35] acpi: build_tpm2: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 05/35] acpi: build_fadt: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 07/35] acpi: acpi_build_hest: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 08/35] acpi: build_mcfg: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 09/35] acpi: build_hmat: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- Re: [PATCH v3 09/35] acpi: build_hmat: use acpi_table_begin()/acpi_table_end() instead of build_header(),
Eric Auger <=
- [PATCH v3 10/35] acpi: nvdimm_build_nfit: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 11/35] acpi: nvdimm_build_ssdt: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 12/35] acpi: vmgenid_build_acpi: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 13/35] acpi: x86: build_dsdt: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 14/35] acpi: build_hpet: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07