Skip to contentSkip to conversation

bus: mhi: host: pci_generic: Avoid graceful power down when device is disconnected

PATCH In review Krishna Chaitanya Chundru 2 participants 2 messages Dec 1

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus: mhi: host: pci_generic: Avoid graceful power down when device is disconnected

When PCIe hotplug is enabled and the link goes down or the device is disconnected, the hotplug driver removes the MHI PCI device. During remove, MHI currently performs a graceful power down, which involves accessing MHI registers. If the PCIe link is already down, these MMIO accesses trigger AER completion timeout errors and flood dmesg.

Avoid this by performing a non‑graceful MHI power down when the PCI device is marked as disconnected. This prevents MHI BAR accesses after link loss and avoids spurious AER errors during device removal, while preserving the existing graceful shutdown path for normal remove scenarios.

---
 drivers/bus/mhi/host/pci_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/host/pci_generic.c +1 -1
index ca9ef4aaa014..6db7fd2bed7d 100644
@@ -1512,7 +1512,7 @@ static void mhi_pci_remove(struct pci_dev *pdev)
 	cancel_work_sync(&mhi_pdev->recovery_work);
 
 	if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) {
-		mhi_power_down(mhi_cntrl, true);
+		mhi_power_down(mhi_cntrl, pci_dev_is_disconnected(pdev) ? false : true);
 		mhi_unprepare_after_power_down(mhi_cntrl);
 	}
 

---
base-commit: 19cc08c1a6a650f8e54c0461ff198be6448f425d
change-id: 20260326-mhi_remove_fix-9a7187bbb275

Best regards,

Signature · 1 line
Krishna Chaitanya Chundru <[email protected]>
#1 lore raw
Quoted 22 lines · Krishna Chaitanya Chundru

When PCIe hotplug is enabled and the link goes down or the device is disconnected, the hotplug driver removes the MHI PCI device. During remove, MHI currently performs a graceful power down, which involves accessing MHI registers. If the PCIe link is already down, these MMIO accesses trigger AER completion timeout errors and flood dmesg.

Avoid this by performing a non‑graceful MHI power down when the PCI device is marked as disconnected. This prevents MHI BAR accesses after link loss and avoids spurious AER errors during device removal, while preserving the existing graceful shutdown path for normal remove scenarios.

---
 drivers/bus/mhi/host/pci_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/host/pci_generic.c +0 -0
index ca9ef4aaa014..6db7fd2bed7d 100644

drivers/bus/mhi/host/pci_generic.c static void mhi_pci_remove(struct pci_dev *pdev) · line 1515

Quoted 5 lines
drivers/bus/mhi/host/pci_generic.c +1 -1
@@ -1512,7 +1512,7 @@ static void mhi_pci_remove(struct pci_dev *pdev)
 	cancel_work_sync(&mhi_pdev->recovery_work);
 
 	if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) {
-		mhi_power_down(mhi_cntrl, true);
+		mhi_power_down(mhi_cntrl, pci_dev_is_disconnected(pdev) ? false : true);

"!pci_dev_is_disconnected(pdev)"

Konrad