U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Holmes-Mitra <dholmesm@google.com>
To: u-boot@lists.u-boot-project.org
Cc: Tom Rini <trini@konsulko.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	 Ilias Apalodimas <ilias.apalodimas@linaro.org>
Subject: [PATCH 4/4] efi_loader: Handle offset or absent runtime ACPI tables
Date: Thu, 03 Dec 2026 02:21:12 GMT	[thread overview]
Message-ID: <20261203022028.04-04-dholmesm@google.com> (raw)
In-Reply-To: <20261203022028.04-00-dholmesm@google.com>

When QFW loads QEMU ACPI tables into BLOBLISTT_ACPI_TABLES, the RSDP is
placed after etc/acpi/tables rather than at offset 0 of the bloblist.
efi_acpi_register() previously passed map_to_sysmem(tab) to
efi_install_configuration_table() instead of gd_acpi_start(), handing
payloads raw DSDT/FACP bytes instead of the RSDP.

Prefer gd_acpi_start() when non-zero (while falling back to
map_to_sysmem(tab) so prior-stage bloblist ACPI handoffs keep working),
and treat absent runtime ACPI tables (!tab in bloblist mode, or
!gd_acpi_start() otherwise) as a non-fatal no-op in efi_acpi_register().
In efi_install_fdt(), check whether EFI_ACPI_TABLE_GUID was actually
installed so platforms built with CONFIG_GENERATE_ACPI_TABLE fall back
to FDT when no ACPI tables exist while still honoring EBBR for
prior-stage bloblist ACPI handoffs.

Signed-off-by: Dan Holmes-Mitra <dholmesm@google.com>
---
 lib/efi_loader/efi_acpi.c   | 6 +++++-
 lib/efi_loader/efi_helper.c | 9 +++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_acpi.c b/lib/efi_loader/efi_acpi.c
index 046986a751..af7b38934e 100644
--- a/lib/efi_loader/efi_acpi.c
+++ b/lib/efi_loader/efi_acpi.c
@@ -40,14 +40,18 @@ efi_status_t efi_acpi_register(void)
 		void *tab = bloblist_get_blob(BLOBLISTT_ACPI_TABLES, &size);
 
 		if (!tab)
-			return EFI_NOT_FOUND;
+			return EFI_SUCCESS;
 		addr = map_to_sysmem(tab);
 
 		ret = efi_add_memory_map(addr, size,
 					 EFI_ACPI_RECLAIM_MEMORY);
 		if (ret != EFI_SUCCESS)
 			return ret;
+		if (gd_acpi_start())
+			addr = gd_acpi_start();
 	} else {
+		if (!gd_acpi_start())
+			return EFI_SUCCESS;
 		/* Mark space used for tables */
 		start = ALIGN_DOWN(gd->arch.table_start, EFI_PAGE_MASK);
 		end = ALIGN(gd->arch.table_end, EFI_PAGE_MASK);
diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c
index 44b806aadc..928863af66 100644
--- a/lib/efi_loader/efi_helper.c
+++ b/lib/efi_loader/efi_helper.c
@@ -544,14 +544,19 @@ void *efi_get_configuration_table(const efi_guid_t *guid)
  */
 efi_status_t efi_install_fdt(void *fdt)
 {
+	static const efi_guid_t acpi_guid = EFI_ACPI_TABLE_GUID;
 	struct bootm_headers img = { 0 };
+	bool has_acpi;
 	efi_status_t ret;
 
+	has_acpi = CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) &&
+		   efi_get_configuration_table(&acpi_guid);
+
 	/*
 	 * The EBBR spec requires that we have either an FDT or an ACPI table
 	 * but not both.
 	 */
-	if (CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) && fdt)
+	if (has_acpi && fdt)
 		log_warning("Can't have ACPI table and device tree - ignoring DT.\n");
 
 	if (fdt == EFI_FDT_USE_INTERNAL) {
@@ -582,7 +587,7 @@ efi_status_t efi_install_fdt(void *fdt)
 		return EFI_LOAD_ERROR;
 	}
 
-	if (CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE)) {
+	if (has_acpi) {
 		/* Create memory reservations as indicated by the device tree */
 		efi_carve_out_dt_rsv(fdt);
 		return EFI_SUCCESS;
-- 
2.56.1.911.g883d8bcb20-goog


      parent reply	other threads:[~2026-12-03  5:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  2:21 [PATCH 0/4] qfw/acpi & efi_loader: Fix linker cleanup, RSDP bounds, and absent/offset ACPI handling Dan Holmes-Mitra
2026-12-03  2:21 ` [PATCH 1/4] qfw/acpi: Do not free non-heap addresses on linker error Dan Holmes-Mitra
2026-12-03  2:21 ` [PATCH 2/4] qfw/acpi: Guard ACPI 1.0 RSDP bounds and NULL lookup Dan Holmes-Mitra
2026-12-03  2:21 ` [PATCH 3/4] qfw/acpi: Skip absent ACPI bloblist and size from table-loader Dan Holmes-Mitra
2026-12-03  2:21 ` Dan Holmes-Mitra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203022028.04-04-dholmesm@google.com \
    --to=dholmesm@google.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox