On Fri, 31 Jan 2025 18:42:44 +0100 Mauro Carvalho Chehab <mchehab+hua...@kernel.org> wrote:
> There are two pointers that are needed during error injection: > > 1. The start address of the CPER block to be stored; > 2. The address of the ack. > > It is preferable to calculate them from the HEST table. This allows > checking the source ID, the size of the table and the type of the > HEST error block structures. > > Yet, keep the old code, as this is needed for migration purposes. > > Signed-off-by: Mauro Carvalho Chehab <mchehab+hua...@kernel.org> Tiny niggle on patch split up inline. Either way Reviewed-by: Jonathan Cameron <jonathan.came...@huawei.com> > @@ -212,14 +237,6 @@ static void build_ghes_error_table(GArray > *hardware_errors, BIOSLinker *linker, > { > int i, error_status_block_offset; > > - /* > - * TODO: Current version supports only one source. > - * A further patch will drop this check, after adding a proper migration > - * code, as, for the code to work, we need to store a bios pointer to the > - * HEST table. > - */ > - assert(num_sources == 1); > - > /* Build error_block_address */ > for (i = 0; i < num_sources; i++) { > build_append_int_noprefix(hardware_errors, 0, sizeof(uint64_t)); > @@ -352,6 +369,14 @@ void acpi_build_hest(GArray *table_data, GArray > *hardware_errors, > .oem_id = oem_id, .oem_table_id = oem_table_id }; > uint32_t hest_offset; > int i; > + AcpiGedState *acpi_ged_state; > + AcpiGhesState *ags = NULL; > + > + acpi_ged_state = ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED, > + NULL)); > + if (acpi_ged_state) { > + ags = &acpi_ged_state->ghes_state; > + } > > hest_offset = table_data->len; > > @@ -371,10 +396,12 @@ void acpi_build_hest(GArray *table_data, GArray > *hardware_errors, > * Tell firmware to write into GPA the address of HEST via fw_cfg, > * once initialized. > */ > - bios_linker_loader_write_pointer(linker, > - ACPI_HEST_ADDR_FW_CFG_FILE, 0, > - sizeof(uint64_t), > - ACPI_BUILD_TABLE_FILE, hest_offset); > + if (ags->use_hest_addr) { Maybe move ags->use_hest_addr introduction to previous patch to avoid churn here? It's not set yet anyway. > + bios_linker_loader_write_pointer(linker, > + ACPI_HEST_ADDR_FW_CFG_FILE, 0, > + sizeof(uint64_t), > + ACPI_BUILD_TABLE_FILE, hest_offset); > + } > } > > void acpi_ghes_add_fw_cfg(AcpiGhesState *ags, FWCfgState *s, > @@ -420,6 +447,78 @@ static void get_hw_error_offsets(uint64_t ghes_addr, > *read_ack_register_addr = ghes_addr + sizeof(uint64_t); > }