Skip to content

Commit c9d6ee6

Browse files
zhangfeigaojgunthorpe
authored andcommitted
iommufd: Allow fault reporting for non-PRI PCI devices
iommufd_fault_iopf_enable has limitation to PRI on PCI/SRIOV VFs because the PRI might be a shared resource and current iommu subsystem is not ready to support enabling/disabling PRI on a VF without any impact on others. However, we have devices that appear as PCI but are actually on the AMBA bus. These fake PCI devices have PASID capability, support stall as well as SRIOV, so remove the limitation for these devices. Link: https://patch.msgid.link/r/[email protected] Co-developed-by: Lu Baolu <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Reviewed-by: Lu Baolu <[email protected]> Signed-off-by: Zhangfei Gao <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 0bcceb1 commit c9d6ee6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/iommu/iommufd/fault.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/module.h>
1111
#include <linux/mutex.h>
1212
#include <linux/pci.h>
13+
#include <linux/pci-ats.h>
1314
#include <linux/poll.h>
1415
#include <uapi/linux/iommufd.h>
1516

@@ -27,8 +28,12 @@ static int iommufd_fault_iopf_enable(struct iommufd_device *idev)
2728
* resource between PF and VFs. There is no coordination for this
2829
* shared capability. This waits for a vPRI reset to recover.
2930
*/
30-
if (dev_is_pci(dev) && to_pci_dev(dev)->is_virtfn)
31-
return -EINVAL;
31+
if (dev_is_pci(dev)) {
32+
struct pci_dev *pdev = to_pci_dev(dev);
33+
34+
if (pdev->is_virtfn && pci_pri_supported(pdev))
35+
return -EINVAL;
36+
}
3237

3338
mutex_lock(&idev->iopf_lock);
3439
/* Device iopf has already been on. */

0 commit comments

Comments
 (0)