Similar to commit 0e764a01015d ("iommu/arm-smmu: Allow client devices to
select direct mapping") for arm-smmu-qcom, match GPU and display compat
strings to pick identity domain time.The drm/msm driver attaches it's own domain, which it manages directly, so we don't want an iommu managed domain interfering. Signed-off-by: Rob Clark <[email protected]> --- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c index 21d18ce67b98..5b10feb419d8 100644 --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c @@ -22,6 +22,7 @@ #include <linux/init.h> #include <linux/mutex.h> #include <linux/of.h> +#include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/pm.h> @@ -589,6 +590,22 @@ static int qcom_iommu_of_xlate(struct device *dev, return iommu_fwspec_add_ids(dev, &asid, 1); } +static const struct of_device_id qcom_iommu_client_of_match[] = { + { .compatible = "qcom,adreno" }, + { .compatible = "qcom,mdp4" }, + { .compatible = "qcom,mdp5" }, + { .compatible = "qcom,mdss" }, + { } +}; + +static int qcom_iommu_def_domain_type(struct device *dev) +{ + const struct of_device_id *match = + of_match_device(qcom_iommu_client_of_match, dev); + + return match ? IOMMU_DOMAIN_IDENTITY : 0; +} + static const struct iommu_ops qcom_iommu_ops = { .identity_domain = &qcom_iommu_identity_domain, .capable = qcom_iommu_capable, @@ -596,6 +613,7 @@ static const struct iommu_ops qcom_iommu_ops = { .probe_device = qcom_iommu_probe_device, .device_group = generic_device_group, .of_xlate = qcom_iommu_of_xlate, + .def_domain_type = qcom_iommu_def_domain_type, .default_domain_ops = &(const struct iommu_domain_ops) { .attach_dev = qcom_iommu_attach_dev, .map_pages = qcom_iommu_map, -- 2.56.0
