[PATCH V2] PCI: vmd: Fix secondary bus reset for Intel bridges

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Francisco Munoz <francisco.munoz.ruiz@xxxxxxxxxxxxxxx>

The reset was never applied in the current implementation because Intel
Bridges owned by VMD are parentless. Internally, pci_reset_bus applies
a reset to the parent of the pci device supplied as argument, but in this
case it failed because there wasn't a parent.

In more detail, this change allows the VMD driver to enumerate NVMe devices
in pass-through configurations when host reboots are performed. Commit id
“6aab5622296b990024ee67dd7efa7d143e7558d0” attempted to fix this, but
later we discovered that the code inside pci_reset_bus wasn’t triggering
secondary bus resets.  Therefore, we updated the parameters passed to
it, and now NVMe SSDs attached to VMD bridges are properly enumerated in
VT-d pass-through scenarios.

Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@xxxxxxxxxxxxxxx>
Reviewed-by: Nirmal Patel <nirmal.patel@xxxxxxxxxxxxxxx>
---
 drivers/pci/controller/vmd.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index e06e9f4fc50f..34d6ba675440 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -859,8 +859,16 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
 
 	pci_scan_child_bus(vmd->bus);
 	vmd_domain_reset(vmd);
-	list_for_each_entry(child, &vmd->bus->children, node)
-		pci_reset_bus(child->self);
+
+	list_for_each_entry(child, &vmd->bus->children, node) {
+		if (!list_empty(&child->devices)) {
+			pci_reset_bus(list_first_entry(&child->devices,
+						       struct pci_dev,
+						       bus_list));
+			break;
+		}
+	}
+
 	pci_assign_unassigned_bus_resources(vmd->bus);
 
 	/*
-- 
2.25.1

Hi Bjorn,

I updated the commit message with more details. Hopefully, this will 
clarify its purpose.

Thanks,
Francisco.



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux