From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Han Gao <rabenda.cn@gmail.com>, Paul Walmsley <pjw@kernel.org>,
Sasha Levin <sashal@kernel.org>,
palmer@dabbelt.com, aou@eecs.berkeley.edu,
alexghiti@rivosinc.com, bjorn@rivosinc.com,
akpm@linux-foundation.org, agordeev@linux.ibm.com,
visitorckw@gmail.com, alexandre.f.demers@gmail.com,
pulehui@huawei.com, guoweikang.kernel@gmail.com,
sycamoremoon376@gmail.com, linux-riscv@lists.infradead.org
Subject: [PATCH AUTOSEL 6.17-6.6] riscv: acpi: avoid errors caused by probing DT devices when ACPI is used
Date: Mon, 27 Oct 2025 20:38:59 -0400 [thread overview]
Message-ID: <20251028003940.884625-15-sashal@kernel.org> (raw)
In-Reply-To: <20251028003940.884625-1-sashal@kernel.org>
From: Han Gao <rabenda.cn@gmail.com>
[ Upstream commit 69a8b62a7aa1e54ff7623064f6507fa29c1d0d4e ]
Similar to the ARM64 commit 3505f30fb6a9s ("ARM64 / ACPI: If we chose
to boot from acpi then disable FDT"), let's not do DT hardware probing
if ACPI is enabled in early boot. This avoids errors caused by
repeated driver probing.
Signed-off-by: Han Gao <rabenda.cn@gmail.com>
Link: https://lore.kernel.org/r/20250910112401.552987-1-rabenda.cn@gmail.com
[pjw@kernel.org: cleaned up patch description and subject]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
Based on my semantic code analysis and repository examination, here is
my determination:
**YES** - This commit should be backported to stable kernel trees.
## Detailed Analysis:
### 1. Semantic Tools Used:
- **mcp__semcode__find_function**: Located the `setup_arch`,
`unflatten_device_tree`, and `unflatten_and_copy_device_tree`
functions
- **mcp__semcode__find_callers**: Identified all callers of the device
tree initialization functions across architectures
- **Git log analysis**: Traced the history of RISC-V ACPI support and
similar fixes in other architectures
- **Code repository examination**: Verified the commit context and
impact scope
### 2. Bug Description:
The commit fixes a correctness bug where both ACPI and Device Tree (DT)
are initialized during boot on RISC-V systems when ACPI is enabled. This
causes "repeated driver probing" errors because hardware devices get
enumerated from both sources, leading to conflicts and initialization
failures.
### 3. Key Code Change:
The fix wraps the device tree initialization calls in an `if
(acpi_disabled)` conditional block at arch/riscv/kernel/setup.c:333-340,
ensuring device tree is only processed when ACPI is not being used.
### 4. Impact Scope Analysis:
- **Affected kernel versions**: All versions from 6.5 onwards (where
RISC-V ACPI support was introduced in commit 724f4c0df7665)
- **Affected systems**: RISC-V systems booting with ACPI enabled
- **Severity**: Medium - causes driver initialization errors on ACPI-
enabled RISC-V systems
- **Call graph analysis**: The change only affects the RISC-V
architecture-specific boot path; no cross-architecture impact
### 5. Precedent:
This follows the exact same pattern established by ARM64 in commit
3505f30fb6a98 (March 2015), which has been stable for nearly 10 years.
ARM64 faced the identical issue and resolved it the same way.
### 6. Backport Suitability Indicators:
✅ **Bug fix**: Corrects driver probing errors
✅ **Small and contained**: Only 7 lines changed in one file
✅ **No new features**: Pure bug fix
✅ **No architectural changes**: Simple conditional logic
✅ **Low regression risk**: Established pattern from ARM64
✅ **Clean apply**: No complex dependencies
✅ **Stable kernel compliant**: Fits all stable kernel rules
### 7. Dependencies Check:
Using semantic analysis, I verified that the only dependency is
`acpi_disabled`, which has been available in RISC-V since ACPI support
was added in v6.5. The fix is self-contained and requires no additional
changes.
### 8. Recommendation:
Backport to **all stable trees from 6.6.x onwards** (6.6.x, 6.12.x, and
any LTS versions), as these include RISC-V ACPI support and are affected
by this bug. The fix prevents real errors on production RISC-V ACPI
systems and has minimal risk of regression.
arch/riscv/kernel/setup.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index f90cce7a3acea..d7ee62837aa4f 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -330,11 +330,14 @@ void __init setup_arch(char **cmdline_p)
/* Parse the ACPI tables for possible boot-time configuration */
acpi_boot_table_init();
+ if (acpi_disabled) {
#if IS_ENABLED(CONFIG_BUILTIN_DTB)
- unflatten_and_copy_device_tree();
+ unflatten_and_copy_device_tree();
#else
- unflatten_device_tree();
+ unflatten_device_tree();
#endif
+ }
+
misc_mem_init();
init_resources();
--
2.51.0
next prev parent reply other threads:[~2025-10-28 0:40 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 0:38 [PATCH AUTOSEL 6.17-6.1] smb/server: fix possible memory leak in smb2_read() Sasha Levin
2025-10-28 0:38 ` [PATCH AUTOSEL 6.17-5.4] NFS4: Fix state renewals missing after boot Sasha Levin
2025-10-28 0:38 ` [PATCH AUTOSEL 6.17-6.12] drm/amdgpu: remove two invalid BUG_ON()s Sasha Levin
2025-10-28 0:38 ` [PATCH AUTOSEL 6.17-5.15] NFS: check if suid/sgid was cleared after a write as needed Sasha Levin
2025-10-28 0:38 ` [PATCH AUTOSEL 6.17-6.12] HID: logitech-hidpp: Add HIDPP_QUIRK_RESET_HI_RES_SCROLL Sasha Levin
2025-10-28 0:38 ` [PATCH AUTOSEL 6.17-5.4] ASoC: max98090/91: fixed max98091 ALSA widget powering up/down Sasha Levin
2025-10-28 0:38 ` [PATCH AUTOSEL 6.17] ALSA: hda/realtek: Fix mute led for HP Omen 17-cb0xxx Sasha Levin
2025-10-28 0:38 ` [PATCH AUTOSEL 6.17-5.10] RISC-V: clear hot-unplugged cores from all task mm_cpumasks to avoid rfence errors Sasha Levin
2025-10-28 0:38 ` [PATCH AUTOSEL 6.17] ASoC: nau8821: Avoid unnecessary blocking in IRQ handler Sasha Levin
2025-10-28 0:38 ` [PATCH AUTOSEL 6.17-5.4] HID: quirks: avoid Cooler Master MM712 dongle wakeup bug Sasha Levin
2025-10-28 0:38 ` [PATCH AUTOSEL 6.17] drm/amdkfd: fix suspend/resume all calls in mes based eviction path Sasha Levin
2025-10-28 0:38 ` [PATCH AUTOSEL 6.17-6.12] exfat: fix improper check of dentry.stream.valid_size Sasha Levin
2025-10-28 0:38 ` [PATCH AUTOSEL 6.17] io_uring: fix unexpected placement on same size resizing Sasha Levin
2025-10-28 0:38 ` [PATCH AUTOSEL 6.17] drm/amd: Disable ASPM on SI Sasha Levin
2025-10-28 0:38 ` Sasha Levin [this message]
2025-10-28 0:39 ` [PATCH AUTOSEL 6.17-6.1] drm/amd/pm: Disable MCLK switching on SI at high pixel clocks Sasha Levin
2025-10-28 0:39 ` [PATCH AUTOSEL 6.17-6.12] drm/amdgpu: hide VRAM sysfs attributes on GPUs without VRAM Sasha Levin
2025-10-28 0:39 ` [PATCH AUTOSEL 6.17] fs: return EOPNOTSUPP from file_setattr/file_getattr syscalls Sasha Levin
2025-10-28 0:39 ` [PATCH AUTOSEL 6.17-6.12] NFS4: Apply delay_retrans to async operations Sasha Levin
2025-10-28 0:39 ` [PATCH AUTOSEL 6.17-6.1] drm/amdgpu: Fix NULL pointer dereference in VRAM logic for APU devices Sasha Levin
2025-10-28 0:39 ` [PATCH AUTOSEL 6.17] ixgbe: handle IXGBE_VF_FEATURES_NEGOTIATE mbox cmd Sasha Levin
2025-10-28 0:39 ` [PATCH AUTOSEL 6.17] ixgbe: handle IXGBE_VF_GET_PF_LINK_STATE mailbox operation Sasha Levin
2025-10-28 0:39 ` [PATCH AUTOSEL 6.17-6.6] HID: quirks: Add ALWAYS_POLL quirk for VRS R295 steering wheel Sasha Levin
2025-10-28 0:39 ` [PATCH AUTOSEL 6.17] HID: intel-thc-hid: intel-quickspi: Add ARL PCI Device Id's Sasha Levin
2025-10-28 0:39 ` [PATCH AUTOSEL 6.17-6.12] HID: nintendo: Wait longer for initial probe Sasha Levin
2025-10-28 0:39 ` [PATCH AUTOSEL 6.17-6.1] smb/server: fix possible refcount leak in smb2_sess_setup() Sasha Levin
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=20251028003940.884625-15-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=alexandre.f.demers@gmail.com \
--cc=alexghiti@rivosinc.com \
--cc=aou@eecs.berkeley.edu \
--cc=bjorn@rivosinc.com \
--cc=guoweikang.kernel@gmail.com \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=patches@lists.linux.dev \
--cc=pjw@kernel.org \
--cc=pulehui@huawei.com \
--cc=rabenda.cn@gmail.com \
--cc=stable@vger.kernel.org \
--cc=sycamoremoon376@gmail.com \
--cc=visitorckw@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).