summaryrefslogtreecommitdiff
path: root/drivers/iommu
diff options
context:
space:
mode:
authorSrinivasarao P <spathi@codeaurora.org>2018-09-12 10:52:49 +0530
committerSrinivasarao P <spathi@codeaurora.org>2018-09-12 10:53:14 +0530
commitd580248c6e00698b48ca35888ca9bad80e7997e8 (patch)
tree88443e277c13bffcca1533f1c36820aefa740dff /drivers/iommu
parent727a8ba0671d43567924016e77a8c5330ecab9a3 (diff)
parentb3f777efd91778cd8ef7fbe07e19990452fc7e9b (diff)
Merge android-4.4.155 (b3f777e) into msm-4.4
* refs/heads/tmp-b3f777e Linux 4.4.155 drm/drivers: add support for using the arch wc mapping API. x86/io: add interface to reserve io memtype for a resource range. (v1.1) fs/quota: Fix spectre gadget in do_quotactl perf auxtrace: Fix queue resize bcache: release dc->writeback_lock properly in bch_writeback_thread() getxattr: use correct xattr length udlfb: set optimal write delay fb: fix lost console when the user unplugs a USB adapter pwm: tiehrpwm: Fix disabling of output of PWMs ubifs: Fix synced_i_size calculation for xattr inodes ubifs: Check data node size before truncate Revert "UBIFS: Fix potential integer overflow in allocation" ubifs: Fix memory leak in lprobs self-check userns: move user access out of the mutex sys: don't hold uts_sem while accessing userspace memory osf_getdomainname(): use copy_to_user() iommu/vt-d: Fix dev iotlb pfsid use iommu/vt-d: Add definitions for PFSID mm/tlb: Remove tlb_remove_table() non-concurrent condition ARM: tegra: Fix Tegra30 Cardhu PCA954x reset pnfs/blocklayout: off by one in bl_map_stripe() PM / sleep: wakeup: Fix build error caused by missing SRCU support 9p: fix multiple NULL-pointer-dereferences uprobes: Use synchronize_rcu() not synchronize_sched() kthread, tracing: Don't expose half-written comm when creating kthreads tracing/blktrace: Fix to allow setting same value tracing: Do not call start/stop() functions when tracing_on does not change vmw_balloon: fix VMCI use when balloon built into kernel vmw_balloon: VMCI_DOORBELL_SET does not check status vmw_balloon: do not use 2MB without batching vmw_balloon: fix inflation of 64-bit GFNs iio: ad9523: Fix return value for ad952x_store() iio: ad9523: Fix displayed phase dm cache metadata: save in-core policy_hint_size to on-disk superblock x86/mm/pat: Fix L1TF stable backport for CPA, 2nd call net/9p/trans_fd.c: fix race-condition by flushing workqueue before the kfree() net/9p/client.c: version pointer uninitialized 9p/virtio: fix off-by-one error in sg list bounds check fs/9p/xattr.c: catch the error of p9_client_clunk when setting xattr failed powerpc/pseries: Fix endianness while restoring of r3 in MCE handler. powerpc/fadump: handle crash memory ranges array index overflow drm/i915/userptr: reject zero user_size spi: davinci: fix a NULL pointer dereference net: lan78xx: Fix misplaced tasklet_schedule() call 9p/net: Fix zero-copy path in the 9p virtio transport net: mac802154: tx: expand tailroom if necessary net: 6lowpan: fix reserved space for single frames BACKPORT: arm64/vdso: Fix nsec handling for CLOCK_MONOTONIC_RAW ANDROID: arm64: mm: fix 4.4.154 merge Change-Id: Id5969245c97b88f9618cb6123e992ea4540ca434 Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/dmar.c6
-rw-r--r--drivers/iommu/intel-iommu.c18
2 files changed, 20 insertions, 4 deletions
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index e913a930ac80..5a63e32a4a6b 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1315,8 +1315,8 @@ void qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
qi_submit_sync(&desc, iommu);
}
-void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep,
- u64 addr, unsigned mask)
+void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 pfsid,
+ u16 qdep, u64 addr, unsigned mask)
{
struct qi_desc desc;
@@ -1331,7 +1331,7 @@ void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep,
qdep = 0;
desc.low = QI_DEV_IOTLB_SID(sid) | QI_DEV_IOTLB_QDEP(qdep) |
- QI_DIOTLB_TYPE;
+ QI_DIOTLB_TYPE | QI_DEV_IOTLB_PFSID(pfsid);
qi_submit_sync(&desc, iommu);
}
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 4efec2db4ee2..49b266433f4c 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -419,6 +419,7 @@ struct device_domain_info {
struct list_head global; /* link to global list */
u8 bus; /* PCI bus number */
u8 devfn; /* PCI devfn number */
+ u16 pfsid; /* SRIOV physical function source ID */
u8 pasid_supported:3;
u8 pasid_enabled:1;
u8 pri_supported:1;
@@ -1479,6 +1480,20 @@ static void iommu_enable_dev_iotlb(struct device_domain_info *info)
return;
pdev = to_pci_dev(info->dev);
+ /* For IOMMU that supports device IOTLB throttling (DIT), we assign
+ * PFSID to the invalidation desc of a VF such that IOMMU HW can gauge
+ * queue depth at PF level. If DIT is not set, PFSID will be treated as
+ * reserved, which should be set to 0.
+ */
+ if (!ecap_dit(info->iommu->ecap))
+ info->pfsid = 0;
+ else {
+ struct pci_dev *pf_pdev;
+
+ /* pdev will be returned if device is not a vf */
+ pf_pdev = pci_physfn(pdev);
+ info->pfsid = PCI_DEVID(pf_pdev->bus->number, pf_pdev->devfn);
+ }
#ifdef CONFIG_INTEL_IOMMU_SVM
/* The PCIe spec, in its wisdom, declares that the behaviour of
@@ -1537,7 +1552,8 @@ static void iommu_flush_dev_iotlb(struct dmar_domain *domain,
sid = info->bus << 8 | info->devfn;
qdep = info->ats_qdep;
- qi_flush_dev_iotlb(info->iommu, sid, qdep, addr, mask);
+ qi_flush_dev_iotlb(info->iommu, sid, info->pfsid,
+ qdep, addr, mask);
}
spin_unlock_irqrestore(&device_domain_lock, flags);
}