14 Aug, 2015

3 commits

  • Move ATS declarations to linux/pci.h so they're all in one place.

    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Joerg Roedel

    Bjorn Helgaas
     
  • The pci_ats struct is small and will get smaller, so I don't think it's
    worth allocating it separately from the pci_dev struct.

    Embed the ATS fields directly into struct pci_dev.

    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Joerg Roedel

    Bjorn Helgaas
     
  • Previously, we allocated pci_ats structures when an IOMMU driver called
    pci_enable_ats(). An SR-IOV VF shares the STU setting with its PF, so when
    enabling ATS on the VF, we allocated a pci_ats struct for the PF if it
    didn't already have one. We held the sriov->lock to serialize threads
    concurrently enabling ATS on several VFS so only one would allocate the PF
    pci_ats.

    Gregor reported a deadlock here:

    pci_enable_sriov
    sriov_enable
    virtfn_add
    mutex_lock(dev->sriov->lock) # acquire sriov->lock
    pci_device_add
    device_add
    BUS_NOTIFY_ADD_DEVICE notifier chain
    iommu_bus_notifier
    amd_iommu_add_device # iommu_ops.add_device
    init_iommu_group
    iommu_group_get_for_dev
    iommu_group_add_device
    __iommu_attach_device
    amd_iommu_attach_device # iommu_ops.attach_device
    attach_device
    pci_enable_ats
    mutex_lock(dev->sriov->lock) # deadlock

    There's no reason to delay allocating the pci_ats struct, and if we
    allocate it for each device at enumeration-time, there's no need for
    locking in pci_enable_ats().

    Allocate pci_ats struct during enumeration, when we initialize other
    capabilities.

    Note that this implementation requires ATS to be enabled on the PF first,
    before on any of the VFs because the PF controls the STU for all the VFs.

    Link: http://permalink.gmane.org/gmane.linux.kernel.iommu/9433
    Reported-by: Gregor Dick
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Joerg Roedel

    Bjorn Helgaas
     

11 Jan, 2014

1 commit

  • My philosophy is unused code is dead code. And dead code is subject to bit
    rot and is a likely source of bugs. Use it or lose it.

    This reverts parts of c320b976d783 ("PCI: Add implementation for PRI
    capability"), removing these interfaces:

    pci_pri_enabled()
    pci_pri_stopped()
    pci_pri_status()

    [bhelgaas: split to separate patch]
    Signed-off-by: Stephen Hemminger
    Signed-off-by: Bjorn Helgaas
    CC: Joerg Roedel

    Stephen Hemminger
     

18 Apr, 2013

1 commit


01 Nov, 2011

1 commit

  • The ats and sroiv members of 'struct pci_dev' are required
    for the ATS code already, even without IOV support compiled
    in. So depend on ATS here. This is fine with PCI_IOV too
    because it selects PCI_ATS. Also the prototypes for ATS
    need to be available for PCI_ATS.

    Reported-by: Randy Dunlap
    Signed-off-by: Joerg Roedel
    Signed-off-by: Jesse Barnes

    Joerg Roedel
     

15 Oct, 2011

3 commits

  • Devices supporting Process Address Space Identifiers
    (PASIDs) can use an IOMMU to access multiple IO address
    spaces at the same time. A PCIe device indicates support for
    this feature by implementing the PASID capability. This
    patch adds support for the capability to the Linux kernel.

    Reviewed-by: Bjorn Helgaas
    Signed-off-by: Joerg Roedel
    Signed-off-by: Jesse Barnes

    Joerg Roedel
     
  • Implement the necessary functions to handle PRI capabilities
    on PCIe devices. With PRI devices behind an IOMMU can signal
    page fault conditions to software and recover from such
    faults.

    Reviewed-by: Bjorn Helgaas
    Signed-off-by: Joerg Roedel
    Signed-off-by: Jesse Barnes

    Joerg Roedel
     
  • ATS does not depend on IOV support, so move the code into
    its own file. This file will also include support for the
    PRI and PASID capabilities later.
    Also give ATS its own Kconfig variable to allow selecting it
    without IOV support.

    Reviewed-by: Bjorn Helgaas
    Signed-off-by: Joerg Roedel
    Signed-off-by: Jesse Barnes

    Joerg Roedel
     

11 Apr, 2011

1 commit

  • This patch moves the relevant declarations from the local
    header file in drivers/pci to a more accessible locations so
    that it can be used by the AMD IOMMU driver too.
    The file is named pci-ats.h because support for the PCI PRI
    capability will also be added there in a later patch-set.

    Signed-off-by: Joerg Roedel
    Acked-by: Jesse Barnes

    Joerg Roedel