summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchel Humpherys <mitchelh@codeaurora.org>2015-03-19 16:13:03 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 11:12:04 -0700
commitb854c94f3dda55a609bc2a6f1e6348b7df4bbdba (patch)
tree4761912a2f0f0155d7d2f8cebb70c8a5699056fc
parent20b0cbf55a20bbba273462f5611bdb65f3dab0e6 (diff)
iommu/arm-smmu: configure stream IDs for PCI-e devices dynamically
PCI-e devices on MSM systems need to have their stream IDs configured at device add time, since they're not known at system design time and therefore can't be placed in the device tree. Add the necessary calls into the MSM PCI-e driver to obtain stream IDs for devices behind PCI-e at device add time. Change-Id: I3645a525c3ab5ef6d89eeaa99894542bd3aa261f Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
-rw-r--r--drivers/iommu/arm-smmu.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index af4c703ca498..507634c413a9 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -48,6 +48,7 @@
#include <linux/amba/bus.h>
#include <soc/qcom/msm_tz_smmu.h>
#include <soc/qcom/secure_buffer.h>
+#include <linux/msm_pcie.h>
#include <asm/pgalloc.h>
@@ -2121,12 +2122,6 @@ static bool arm_smmu_capable(enum iommu_cap cap)
}
}
-static int __arm_smmu_get_pci_sid(struct pci_dev *pdev, u16 alias, void *data)
-{
- *((u16 *)data) = alias;
- return 0; /* Continue walking */
-}
-
static void __arm_smmu_release_pci_iommudata(void *data)
{
kfree(data);
@@ -2151,7 +2146,8 @@ static int arm_smmu_add_device(struct device *dev)
}
if (dev_is_pci(dev)) {
- struct pci_dev *pdev = to_pci_dev(dev);
+ u32 sid;
+ int tmp;
cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
if (!cfg) {
@@ -2160,12 +2156,15 @@ static int arm_smmu_add_device(struct device *dev)
}
cfg->num_streamids = 1;
- /*
- * Assume Stream ID == Requester ID for now.
- * We need a way to describe the ID mappings in FDT.
- */
- pci_for_each_dma_alias(pdev, __arm_smmu_get_pci_sid,
- &cfg->streamids[0]);
+ ret = msm_pcie_configure_sid(dev, &sid, &tmp);
+ if (ret) {
+ dev_err(dev,
+ "Couldn't configure SID through PCI-e driver: %d\n",
+ ret);
+ kfree(cfg);
+ goto out_put_group;
+ }
+ cfg->streamids[0] = sid;
releasefn = __arm_smmu_release_pci_iommudata;
} else {
struct arm_smmu_master *master;