[PATCH AUTOSEL 6.17-6.6] riscv: acpi: avoid errors caused by probing DT devices when ACPI is used
Sasha Levin
sashal at kernel.org
Mon Oct 27 17:38:59 PDT 2025
From: Han Gao <rabenda.cn at 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 at gmail.com>
Link: https://lore.kernel.org/r/20250910112401.552987-1-rabenda.cn@gmail.com
[pjw at kernel.org: cleaned up patch description and subject]
Signed-off-by: Paul Walmsley <pjw at kernel.org>
Signed-off-by: Sasha Levin <sashal at 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
More information about the linux-riscv
mailing list