From: Rob Herring <robh@kernel.org>
To: Dmytro Maluka <dmaluka@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<x86@kernel.org>, "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>,
"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<linux-kernel@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE"
<devicetree@vger.kernel.org>
Subject: Re: [PATCH] x86/of: Restore possibility to use both ACPI and FDT from bootloader
Date: Thu, 2 Jan 2025 12:08:07 -0600 [thread overview]
Message-ID: <20250102180807.GA73778-robh@kernel.org> (raw)
In-Reply-To: <20241223181813.224446-1-dmaluka@chromium.org>
On Mon, Dec 23, 2024 at 06:18:03PM +0000, Dmytro Maluka wrote:
> 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.
Anyone booting Arm ACPI based systems with AVF?
Where's this AVF binding documented?
> 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. At the same time, since the aforementioned
> recently introduced restriction is actually useful for preventing
> conflicts between ACPI and DT for LAPIC/IOAPIC/HPET setup, don't remove
> this restriction completely but relax it: unflatten the bootloader
> supplied DTB but don't try to use it for SMP setup (i.e. don't override
> the .parse_smp_cfg callback) if ACPI is enabled. Precisely, right now
> this prevents at least:
>
> - incorrectly calling register_lapic_address(APIC_DEFAULT_PHYS_BASE)
> after the LAPIC was already successfully enumerated via ACPI, causing
> noisy kernel warnings and probably potential real issues as well
>
> - failed IOAPIC setup in the case when IOAPIC is enumerated via mptable
> instead of ACPI (e.g. with acpi=noirq), due to
> mpparse_parse_smp_config() overridden by x86_dtb_parse_smp_config()
It would be better if we explicitly opt'ed into "things we want to get
from DT" rather than allowing anything except what we check for. There's
a strong desire at least for arm64 to prevent systems from using both
at the same time. There are growing usecases for doing just that, but I
think we need to have some control or restrictions in place to define
what we support in the kernel.
> Fixes: 7b937cc243e5 ("of: Create of_root if no dtb provided by firmware")
> Signed-off-by: Dmytro Maluka <dmaluka@chromium.org>
> ---
> arch/x86/kernel/devicetree.c | 3 ++-
> drivers/of/fdt.c | 10 +---------
> 2 files changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
> index 59d23cdf4ed0..dd8748c45529 100644
> --- a/arch/x86/kernel/devicetree.c
> +++ b/arch/x86/kernel/devicetree.c
> @@ -2,6 +2,7 @@
> /*
> * Architecture specific OF callbacks.
> */
> +#include <linux/acpi.h>
> #include <linux/export.h>
> #include <linux/io.h>
> #include <linux/interrupt.h>
> @@ -313,6 +314,6 @@ void __init x86_flattree_get_config(void)
> if (initial_dtb)
> early_memunmap(dt, map_len);
> #endif
> - if (of_have_populated_dt())
> + if (acpi_disabled && of_have_populated_dt())
> x86_init.mpparse.parse_smp_cfg = x86_dtb_parse_smp_config;
I would make this a separate patch. Then it can be backported to kernel
versions without 7b937cc243e5. And then Thomas can take it and I can
take the DT part.
> }
next prev parent reply other threads:[~2025-01-02 18:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-23 18:18 [PATCH] x86/of: Restore possibility to use both ACPI and FDT from bootloader Dmytro Maluka
2025-01-02 18:08 ` Rob Herring [this message]
2025-01-02 22:18 ` Dmytro Maluka
2025-01-03 14:19 ` Rob Herring
2025-01-06 11:16 ` Christoph Hellwig
2025-01-06 18:51 ` 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=20250102180807.GA73778-robh@kernel.org \
--to=robh@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=devicetree@vger.kernel.org \
--cc=dmaluka@chromium.org \
--cc=frowand.list@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=saravanak@google.com \
--cc=sboyd@kernel.org \
--cc=ssengar@linux.microsoft.com \
--cc=tglx@linutronix.de \
--cc=usamaarif642@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.