lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260129144242.8730-1-huyuye812@163.com>
Date: Thu, 29 Jan 2026 22:42:41 +0800
From: huyuye <huyuye812@....com>
To: Bjorn Helgaas <bhelgaas@...gle.com>
Cc: "Rafael J . Wysocki" <rafael@...nel.org>,
	Len Brown <lenb@...nel.org>,
	Sunil V L <sunilvl@...tanamicro.com>,
	linux-pci@...r.kernel.org,
	linux-acpi@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	dai.hualiang@....com.cn,
	deng.weixian@....com.cn,
	guo.chang2@....com.cn,
	liu.qingtao2@....com.cn,
	wu.jiabao@....com.cn,
	lin.yongchun@....com.cn,
	hu.yuye@....com.cn,
	zhang.longxiang@....com.cn,
	zuo.jiang@....com.cn,
	li.kunpeng@....com.cn,
	huyuye <huyuye812@....com>
Subject: [PATCH v4] ACPI: pci_root: Clear the acpi dependencies after PCI root bridge initialization on RISC-V

On RISC-V platforms with multiple PCI root bridges, the enumeration
order varies randomly across reboots due to APLIC driver initialization
occurring after ACPI device scanning. This defers PCI probing to a
unbound workqueue, resulting in non-deterministic device discovery
sequences.

Such random enumeration leads to changes in device naming across each
boot, which disrupts storage configurations, network settings, and
severely impacts the stability of server maintenance.

By adding the acpi_dev_clear_dependencies() call in acpi_pci_root_add(),
this patch enables the firmware to actively control the enumeration order
of multiple PCI root bridges through the ACPI _DEP method, providing the
firmware with the opportunity to initialize devices in the intended order,
thereby ensuring consistent enumeration results across multiple boots.

Signed-off-by: huyuye <huyuye812@....com>
---
v3 -> v4:
-Removed __weak function

v2 -> v3:
- Added back the missing commit description from v1
- Moved v2 changelog to correct location after "---"

v1 -> v2:
- Removed the redundant #ifdef CONFIG_ACPI and if (!acpi_disabled) guard
- Moved acpi_dev_clear_dependencies to RISC-V specific architecture code
 drivers/acpi/pci_root.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 9d7f85dadc48..5169104b9d13 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -760,6 +760,18 @@ static int acpi_pci_root_add(struct acpi_device *device,
 	pci_lock_rescan_remove();
 	pci_bus_add_devices(root->bus);
 	pci_unlock_rescan_remove();
+	/*
+	 * On RISC-V platforms with ACPI, PCIe host bridge dependencies may be
+	 * explicitly defined via the _DEP method in the DSDT.
+	 *
+	 * The firmware uses _DEP to enforce initialization ordering: if host bridge B
+	 * depends on host bridge A, ACPI will delay B's enumeration until A is ready.
+	 *
+	 * Once this host bridge is fully initialized, we clear its _DEP entries to
+	 * release dependent bridges (like B) for enumeration.
+	 */
+	if (IS_ENABLED(CONFIG_RISCV))
+		acpi_dev_clear_dependencies(device);
 	return 1;
 
 remove_dmar:
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ