[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250105171643.3473702-3-dmaluka@chromium.org>
Date: Sun, 5 Jan 2025 17:16:43 +0000
From: Dmytro Maluka <dmaluka@...omium.org>
To: Thomas Gleixner <tglx@...utronix.de>,
Rob Herring <robh@...nel.org>
Cc: Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
"H. Peter Anvin" <hpa@...or.com>,
Saravana Kannan <saravanak@...gle.com>,
Saurabh Sengar <ssengar@...ux.microsoft.com>,
Usama Arif <usamaarif642@...il.com>,
Stephen Boyd <sboyd@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
linux-kernel@...r.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
devicetree@...r.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE),
Pierre-Clément Tosi <ptosi@...gle.com>,
Shikha Panwar <shikhapanwar@...gle.com>,
Will Deacon <will@...nel.org>,
Keir Fraser <keirf@...gle.com>,
Michal Mazurek <mazurekm@...gle.com>,
Bartłomiej Grzesik <bgrzesik@...gle.com>,
Tomasz Nowicki <tnowicki@...gle.com>,
Grzegorz Jaszczyk <jaszczyk@...gle.com>,
Dmytro Maluka <dmaluka@...omium.org>
Subject: [PATCH 2/2] of/fdt: Restore possibility to use both ACPI and FDT from bootloader
There are cases when the bootloader provides information to the kernel
in both ACPI and DTB, not interchangeably. One such use case is virtual
machines in Android. When running on x86, the Android Virtualization
Framework (AVF) boots VMs with ACPI like it is usually done on x86 (i.e.
the virtual LAPIC, IOAPIC, HPET, PCI MMCONFIG etc are described in ACPI)
but also passes various AVF-specific boot parameters in DTB. This allows
reusing the same implementations of various AVF components on both
arm64 and x86.
Commit 7b937cc243e5 ("of: Create of_root if no dtb provided by firmware")
removed the possibility to do that, since among other things
it introduced forcing emptying the bootloader-provided DTB if ACPI is
enabled (probably assuming that if ACPI is available, a DTB can only be
useful for applying overlays to it afterwards, for testing purposes).
So restore this possibility. Instead of completely preventing using ACPI
and DT together, rely on arch-specific setup code to prevent using both
to set up the same things (see various acpi_disabled checks under arch/).
Fixes: 7b937cc243e5 ("of: Create of_root if no dtb provided by firmware")
Signed-off-by: Dmytro Maluka <dmaluka@...omium.org>
---
drivers/of/fdt.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 0121100372b4..3b29a5c50e2e 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -8,7 +8,6 @@
#define pr_fmt(fmt) "OF: fdt: " fmt
-#include <linux/acpi.h>
#include <linux/crash_dump.h>
#include <linux/crc32.h>
#include <linux/kernel.h>
@@ -1215,14 +1214,7 @@ void __init unflatten_device_tree(void)
/* Save the statically-placed regions in the reserved_mem array */
fdt_scan_reserved_mem_reg_nodes();
- /* Don't use the bootloader provided DTB if ACPI is enabled */
- if (!acpi_disabled)
- fdt = NULL;
-
- /*
- * Populate an empty root node when ACPI is enabled or bootloader
- * doesn't provide one.
- */
+ /* Populate an empty root node when bootloader doesn't provide one */
if (!fdt) {
fdt = (void *) __dtb_empty_root_begin;
/* fdt_totalsize() will be used for copy size */
--
2.47.1.613.gc27f4b7a9f-goog
Powered by blists - more mailing lists