Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec637fb2 authored by Alex Williamson's avatar Alex Williamson Committed by Bjorn Helgaas
Browse files

PCI: Add function 0 DMA alias quirk for Ricoh devices

The existing quirk for these devices (pci_get_dma_source()) doesn't really
solve the problem; re-implement it using the DMA alias iterator.  We'll
come back later and remove the existing quirk and dma_source interface.
Note that device ID 0xe822 is typically function 0 and 0xe230 has been
tested to not need the quirk and are therefore removed versus the
equivalent dma_source quirk.  If there exist in other configurations we can
re-add them.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=605888


Tested-by: default avatarPat Erley <pat-lkml@erley.org>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 31c2b815
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -3333,6 +3333,22 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe)
	return -ENOTTY;
}

static void quirk_dma_func0_alias(struct pci_dev *dev)
{
	if (PCI_FUNC(dev->devfn) != 0) {
		dev->dma_alias_devfn = PCI_DEVFN(PCI_SLOT(dev->devfn), 0);
		dev->dev_flags |= PCI_DEV_FLAGS_DMA_ALIAS_DEVFN;
	}
}

/*
 * https://bugzilla.redhat.com/show_bug.cgi?id=605888
 *
 * Some Ricoh devices use function 0 as the PCIe requester ID for DMA.
 */
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe476, quirk_dma_func0_alias);

static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
{
	if (!PCI_FUNC(dev->devfn))