mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmytro Maluka <dmaluka@chromium.org>
To: Thomas Gleixner <tglx@linutronix.de>, Rob Herring <robh@kernel.org>
Cc: "Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
	"H. Peter Anvin" <hpa@zytor.com>,
	"Saravana Kannan" <saravanak@google.com>,
	"Saurabh Sengar" <ssengar@linux.microsoft.com>,
	"Usama Arif" <usamaarif642@gmail.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Frank Rowand" <frowand.list@gmail.com>,
	linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT
	AND 64-BIT)),
	devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND
	FLATTENED DEVICE TREE), "Pierre-Clément Tosi" <ptosi@google.com>,
	"Shikha Panwar" <shikhapanwar@google.com>,
	"Will Deacon" <will@kernel.org>, "Keir Fraser" <keirf@google.com>,
	"Michal Mazurek" <mazurekm@google.com>,
	"Bartłomiej Grzesik" <bgrzesik@google.com>,
	"Tomasz Nowicki" <tnowicki@google.com>,
	"Grzegorz Jaszczyk" <jaszczyk@google.com>,
	"Dmytro Maluka" <dmaluka@chromium.org>
Subject: [PATCH 2/2] of/fdt: Restore possibility to use both ACPI and FDT from bootloader
Date: Sun,  5 Jan 2025 17:16:43 +0000	[thread overview]
Message-ID: <20250105171643.3473702-3-dmaluka@chromium.org> (raw)
In-Reply-To: <20250105171643.3473702-1-dmaluka@chromium.org>

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@chromium.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


  parent reply	other threads:[~2025-01-05 17:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-05 17:16 [PATCH 0/2] of, x86: " Dmytro Maluka
2025-01-05 17:16 ` [PATCH 1/2] x86/of: Don't use DTB for SMP setup if ACPI is enabled Dmytro Maluka
2025-01-05 17:16 ` Dmytro Maluka [this message]
2025-01-05 17:31 ` [PATCH 0/2] of, x86: Restore possibility to use both ACPI and FDT from bootloader Dmytro Maluka

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=20250105171643.3473702-3-dmaluka@chromium.org \
    --to=dmaluka@chromium.org \
    --cc=bgrzesik@google.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jaszczyk@google.com \
    --cc=keirf@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mazurekm@google.com \
    --cc=mingo@redhat.com \
    --cc=ptosi@google.com \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    --cc=sboyd@kernel.org \
    --cc=shikhapanwar@google.com \
    --cc=ssengar@linux.microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=tnowicki@google.com \
    --cc=usamaarif642@gmail.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®