[PATCH v2 09/60][SRU][OEM-5.6] iommu: Introduce accessors for iommu private data

You-Sheng Yang vicamo.yang at canonical.com
Tue Jun 2 07:43:30 UTC 2020


From: Joerg Roedel <jroedel at suse.de>

BugLink: https://bugs.launchpad.net/bugs/1876707

Add dev_iommu_priv_get/set() functions to access per-device iommu
private data. This makes it easier to move the pointer to a different
location.

Signed-off-by: Joerg Roedel <jroedel at suse.de>
Tested-by: Will Deacon <will at kernel.org> # arm-smmu
Reviewed-by: Jean-Philippe Brucker <jean-philippe at linaro.org>
Link: https://lore.kernel.org/r/20200326150841.10083-9-joro@8bytes.org
(cherry picked from commit f9867f416ee721141e1664810516b8ebc2563cdd)
Signed-off-by: You-Sheng Yang <vicamo.yang at canonical.com>
---
 include/linux/iommu.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index d031ddc0596b..49e3173260b3 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -627,6 +627,16 @@ static inline void dev_iommu_fwspec_set(struct device *dev,
 	dev->iommu->fwspec = fwspec;
 }
 
+static inline void *dev_iommu_priv_get(struct device *dev)
+{
+	return dev->iommu->fwspec->iommu_priv;
+}
+
+static inline void dev_iommu_priv_set(struct device *dev, void *priv)
+{
+	dev->iommu->fwspec->iommu_priv = priv;
+}
+
 int iommu_probe_device(struct device *dev);
 void iommu_release_device(struct device *dev);
 
-- 
2.25.1




More information about the kernel-team mailing list