Skip to content

Commit e62252b

Browse files
committed
Merge tag 'pci-v6.3-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci
Pull pci fixes from Bjorn Helgaas: - Provide pci_msix_can_alloc_dyn() stub when CONFIG_PCI_MSI unset to avoid build errors (Reinette Chatre) - Quirk AMD XHCI controller that loses MSI-X state in D3hot to avoid broken USB after hotplug or suspend/resume (Basavaraj Natikar) - Fix use-after-free in pci_bus_release_domain_nr() (Rob Herring) * tag 'pci-v6.3-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci: PCI: Fix use-after-free in pci_bus_release_domain_nr() x86/PCI: Add quirk for AMD XHCI controller that loses MSI-X state in D3hot PCI/MSI: Provide missing stub for pci_msix_can_alloc_dyn()
2 parents 2c40519 + 30ba2d0 commit e62252b

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

arch/x86/pci/fixup.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/dmi.h>
88
#include <linux/pci.h>
99
#include <linux/vgaarb.h>
10+
#include <asm/amd_nb.h>
1011
#include <asm/hpet.h>
1112
#include <asm/pci_x86.h>
1213

@@ -824,3 +825,23 @@ static void rs690_fix_64bit_dma(struct pci_dev *pdev)
824825
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7910, rs690_fix_64bit_dma);
825826

826827
#endif
828+
829+
#ifdef CONFIG_AMD_NB
830+
831+
#define AMD_15B8_RCC_DEV2_EPF0_STRAP2 0x10136008
832+
#define AMD_15B8_RCC_DEV2_EPF0_STRAP2_NO_SOFT_RESET_DEV2_F0_MASK 0x00000080L
833+
834+
static void quirk_clear_strap_no_soft_reset_dev2_f0(struct pci_dev *dev)
835+
{
836+
u32 data;
837+
838+
if (!amd_smn_read(0, AMD_15B8_RCC_DEV2_EPF0_STRAP2, &data)) {
839+
data &= ~AMD_15B8_RCC_DEV2_EPF0_STRAP2_NO_SOFT_RESET_DEV2_F0_MASK;
840+
if (amd_smn_write(0, AMD_15B8_RCC_DEV2_EPF0_STRAP2, data))
841+
pci_err(dev, "Failed to write data 0x%x\n", data);
842+
} else {
843+
pci_err(dev, "Failed to read data\n");
844+
}
845+
}
846+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15b8, quirk_clear_strap_no_soft_reset_dev2_f0);
847+
#endif

drivers/pci/remove.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,16 @@ void pci_remove_root_bus(struct pci_bus *bus)
157157
list_for_each_entry_safe(child, tmp,
158158
&bus->devices, bus_list)
159159
pci_remove_bus_device(child);
160-
pci_remove_bus(bus);
161-
host_bridge->bus = NULL;
162160

163161
#ifdef CONFIG_PCI_DOMAINS_GENERIC
164162
/* Release domain_nr if it was dynamically allocated */
165163
if (host_bridge->domain_nr == PCI_DOMAIN_NR_NOT_SET)
166164
pci_bus_release_domain_nr(bus, host_bridge->dev.parent);
167165
#endif
168166

167+
pci_remove_bus(bus);
168+
host_bridge->bus = NULL;
169+
169170
/* remove the host bridge */
170171
device_del(&host_bridge->dev);
171172
}

include/linux/pci.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,6 +1624,8 @@ pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
16241624
flags, NULL);
16251625
}
16261626

1627+
static inline bool pci_msix_can_alloc_dyn(struct pci_dev *dev)
1628+
{ return false; }
16271629
static inline struct msi_map pci_msix_alloc_irq_at(struct pci_dev *dev, unsigned int index,
16281630
const struct irq_affinity_desc *affdesc)
16291631
{

0 commit comments

Comments
 (0)