Skip to content

Commit ba7deaa

Browse files
committed
Merge branch 'remotes/lorenzo/pci/vmd'
- Restore MSI remapping configuration during resume because the configuration is cleared out by firmware when suspending (Nirmal Patel) - Reset the hierarchy below VMD when probing the VMD; we attempted this before, but with the wrong device, so it didn't work (Francisco Munoz) * remotes/lorenzo/pci/vmd: PCI: vmd: Fix secondary bus reset for Intel bridges PCI: vmd: Disable MSI remapping after suspend
2 parents 4e5db79 + 0a58465 commit ba7deaa

File tree

1 file changed

+25
-2
lines changed
  • drivers/pci/controller

1 file changed

+25
-2
lines changed

drivers/pci/controller/vmd.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
719719
resource_size_t offset[2] = {0};
720720
resource_size_t membar2_offset = 0x2000;
721721
struct pci_bus *child;
722+
struct pci_dev *dev;
722723
int ret;
723724

724725
/*
@@ -859,8 +860,25 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
859860

860861
pci_scan_child_bus(vmd->bus);
861862
vmd_domain_reset(vmd);
862-
list_for_each_entry(child, &vmd->bus->children, node)
863-
pci_reset_bus(child->self);
863+
864+
/* When Intel VMD is enabled, the OS does not discover the Root Ports
865+
* owned by Intel VMD within the MMCFG space. pci_reset_bus() applies
866+
* a reset to the parent of the PCI device supplied as argument. This
867+
* is why we pass a child device, so the reset can be triggered at
868+
* the Intel bridge level and propagated to all the children in the
869+
* hierarchy.
870+
*/
871+
list_for_each_entry(child, &vmd->bus->children, node) {
872+
if (!list_empty(&child->devices)) {
873+
dev = list_first_entry(&child->devices,
874+
struct pci_dev, bus_list);
875+
if (pci_reset_bus(dev))
876+
pci_warn(dev, "can't reset device: %d\n", ret);
877+
878+
break;
879+
}
880+
}
881+
864882
pci_assign_unassigned_bus_resources(vmd->bus);
865883

866884
/*
@@ -980,6 +998,11 @@ static int vmd_resume(struct device *dev)
980998
struct vmd_dev *vmd = pci_get_drvdata(pdev);
981999
int err, i;
9821000

1001+
if (vmd->irq_domain)
1002+
vmd_set_msi_remapping(vmd, true);
1003+
else
1004+
vmd_set_msi_remapping(vmd, false);
1005+
9831006
for (i = 0; i < vmd->msix_count; i++) {
9841007
err = devm_request_irq(dev, vmd->irqs[i].virq,
9851008
vmd_irq, IRQF_NO_THREAD,

0 commit comments

Comments
 (0)