[PATCH v3 1/6] hw/acpi: Make BIOS linker optional

Oliver Steffen posted 6 patches 1 month ago
Maintainers: Gerd Hoffmann <kraxel@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, Ani Sinha <anisinha@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Marcelo Tosatti <mtosatti@redhat.com>, Zhao Liu <zhao1.liu@intel.com>
There is a newer version of this series
[PATCH v3 1/6] hw/acpi: Make BIOS linker optional
Posted by Oliver Steffen 1 month ago
Make the BIOS linker optional in acpi_table_end().
This makes it possible to call for example
acpi_build_madt() from outside the ACPI table builder context.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
---
 hw/acpi/aml-build.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 2d5826a8f1..ed86867ae3 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1748,8 +1748,11 @@ void acpi_table_end(BIOSLinker *linker, AcpiTable *desc)
      */
     memcpy(len_ptr, &table_len_le, sizeof table_len_le);
 
-    bios_linker_loader_add_checksum(linker, ACPI_BUILD_TABLE_FILE,
-        desc->table_offset, table_len, desc->table_offset + checksum_offset);
+    if (linker != NULL) {
+        bios_linker_loader_add_checksum(linker, ACPI_BUILD_TABLE_FILE,
+                                        desc->table_offset, table_len,
+                                        desc->table_offset + checksum_offset);
+    }
 }
 
 void *acpi_data_push(GArray *table_data, unsigned size)
-- 
2.52.0
Re: [PATCH v3 1/6] hw/acpi: Make BIOS linker optional
Posted by Gerd Hoffmann 4 weeks ago
On Fri, Jan 09, 2026 at 03:34:08PM +0100, Oliver Steffen wrote:
> Make the BIOS linker optional in acpi_table_end().
> This makes it possible to call for example
> acpi_build_madt() from outside the ACPI table builder context.
> 
> Signed-off-by: Oliver Steffen <osteffen@redhat.com>
> ---
>  hw/acpi/aml-build.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 2d5826a8f1..ed86867ae3 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -1748,8 +1748,11 @@ void acpi_table_end(BIOSLinker *linker, AcpiTable *desc)
>       */
>      memcpy(len_ptr, &table_len_le, sizeof table_len_le);
>  
> -    bios_linker_loader_add_checksum(linker, ACPI_BUILD_TABLE_FILE,
> -        desc->table_offset, table_len, desc->table_offset + checksum_offset);
> +    if (linker != NULL) {
> +        bios_linker_loader_add_checksum(linker, ACPI_BUILD_TABLE_FILE,
> +                                        desc->table_offset, table_len,
> +                                        desc->table_offset + checksum_offset);
> +    }

else {
	// calculate + fill checksum directly
}

take care,
  Gerd