PCI: Refactor HT advertising of NO_MSI flag
The few quirks that deal with NO_MSI tend to be copy-paste heavy. Refactor them so that the hierarchy of conditions is slightly cleaner. Link: https://lore.kernel.org/r/20210330151145.997953-15-maz@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
parent
61af69296c
commit
557853f4e2
|
@ -2585,10 +2585,8 @@ static int msi_ht_cap_enabled(struct pci_dev *dev)
|
||||||
/* Check the HyperTransport MSI mapping to know whether MSI is enabled or not */
|
/* Check the HyperTransport MSI mapping to know whether MSI is enabled or not */
|
||||||
static void quirk_msi_ht_cap(struct pci_dev *dev)
|
static void quirk_msi_ht_cap(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
if (dev->subordinate && !msi_ht_cap_enabled(dev)) {
|
if (!msi_ht_cap_enabled(dev))
|
||||||
pci_warn(dev, "MSI quirk detected; subordinate MSI disabled\n");
|
quirk_disable_msi(dev);
|
||||||
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE,
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE,
|
||||||
quirk_msi_ht_cap);
|
quirk_msi_ht_cap);
|
||||||
|
@ -2601,9 +2599,6 @@ static void quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev;
|
||||||
|
|
||||||
if (!dev->subordinate)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check HT MSI cap on this chipset and the root one. A single one
|
* Check HT MSI cap on this chipset and the root one. A single one
|
||||||
* having MSI is enough to be sure that MSI is supported.
|
* having MSI is enough to be sure that MSI is supported.
|
||||||
|
@ -2611,10 +2606,8 @@ static void quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
|
||||||
pdev = pci_get_slot(dev->bus, 0);
|
pdev = pci_get_slot(dev->bus, 0);
|
||||||
if (!pdev)
|
if (!pdev)
|
||||||
return;
|
return;
|
||||||
if (!msi_ht_cap_enabled(dev) && !msi_ht_cap_enabled(pdev)) {
|
if (!msi_ht_cap_enabled(pdev))
|
||||||
pci_warn(dev, "MSI quirk detected; subordinate MSI disabled\n");
|
quirk_msi_ht_cap(dev);
|
||||||
dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
|
|
||||||
}
|
|
||||||
pci_dev_put(pdev);
|
pci_dev_put(pdev);
|
||||||
}
|
}
|
||||||
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
|
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
|
||||||
|
|
Loading…
Reference in New Issue