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>
This commit is contained in:
parent
20b0cbf55a
commit
b854c94f3d
1 changed files with 12 additions and 13 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue