From 8356023a52d81b25ff0d4925e225dcea6c29c363 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Brucker Date: Sat, 18 May 2019 22:09:31 +0800 Subject: [PATCH] iommu/of: Add stall and pasid properties to iommu_fwspec hulk inclusion category: feature bugzilla: 14369 CVE: NA ------------------- Add stall and pasid properties to iommu_fwspec, and fill them when dma-can-stall and pasid-bits properties are present in the device tree. Signed-off-by: Jean-Philippe Brucker Signed-off-by: Fang Lijun Reviewed-by: Hanjun Guo Reviewed-by: Zhen Lei Signed-off-by: Yang Yingliang --- drivers/iommu/of_iommu.c | 13 +++++++++++++ include/linux/iommu.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index f7787e757244..2a34fa23978b 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -187,6 +187,19 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, if (err) break; } + + fwspec = dev->iommu_fwspec; + if (!err && fwspec) { + const __be32 *prop; + + if (of_get_property(master_np, "dma-can-stall", NULL)) + fwspec->can_stall = true; + + prop = of_get_property(master_np, + "pasid-num-bits", NULL); + if (prop) + fwspec->num_pasid_bits = be32_to_cpu(*prop); + } } /* diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 6643db40c1ad..e63e881d7ea9 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -650,6 +650,8 @@ struct iommu_fwspec { struct fwnode_handle *iommu_fwnode; void *iommu_priv; unsigned int num_ids; + unsigned int num_pasid_bits; + bool can_stall; u32 ids[1]; }; -- GitLab