mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +00:00
6c17c7d593
PCI ATS has a global Smallest Translation Unit field that is located in the PF but shared by all of the VFs. The expectation is that the STU will be set to the root port's global STU capability which is driven by the IO page table configuration of the iommu HW. Today it becomes set when the iommu driver first enables ATS. Thus, to enable ATS on the VF, the PF must have already had the correct STU programmed, even if ATS is off on the PF. Unfortunately the PF only programs the STU when the PF enables ATS. The iommu drivers tend to leave ATS disabled when IDENTITY translation is being used. Thus we can get into a state where the PF is setup to use IDENTITY with the DMA API while the VF would like to use VFIO with a PAGING domain and have ATS turned on. This fails because the PF never loaded a PAGING domain and so it never setup the STU, and the VF can't do it. The simplest solution is to have the iommu driver set the ATS STU when it probes the device. This way the ATS STU is loaded immediately at boot time to all PFs and there is no issue when a VF comes to use it. Add a new call pci_prepare_ats() which should be called by iommu drivers in their probe_device() op for every PCI device if the iommu driver supports ATS. This will setup the STU based on whatever page size capability the iommu HW has. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/0-v1-0fb4d2ab6770+7e706-ats_vf_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de> |
||
---|---|---|
.. | ||
controller | ||
endpoint | ||
hotplug | ||
msi | ||
pcie | ||
pwrctl | ||
switch | ||
access.c | ||
ats.c | ||
bus.c | ||
devres.c | ||
doe.c | ||
ecam.c | ||
host-bridge.c | ||
iomap.c | ||
iov.c | ||
irq.c | ||
Kconfig | ||
Makefile | ||
mmap.c | ||
of_property.c | ||
of.c | ||
p2pdma.c | ||
pci-acpi.c | ||
pci-bridge-emul.c | ||
pci-bridge-emul.h | ||
pci-driver.c | ||
pci-label.c | ||
pci-mid.c | ||
pci-pf-stub.c | ||
pci-stub.c | ||
pci-sysfs.c | ||
pci.c | ||
pci.h | ||
probe.c | ||
proc.c | ||
quirks.c | ||
remove.c | ||
rom.c | ||
search.c | ||
setup-bus.c | ||
setup-res.c | ||
slot.c | ||
syscall.c | ||
vc.c | ||
vgaarb.c | ||
vpd.c | ||
xen-pcifront.c |