Skip to content

Commit 0e764a0

Browse files
Jordan Crousewilldeacon
authored andcommitted
iommu/arm-smmu: Allow client devices to select direct mapping
Some client devices want to directly map the IOMMU themselves instead of using the DMA domain. Allow those devices to opt in to direct mapping by way of a list of compatible strings. Co-developed-by: Sai Prakash Ranjan <[email protected]> Signed-off-by: Jordan Crouse <[email protected]> Signed-off-by: Sai Prakash Ranjan <[email protected]> Reviewed-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/7cf1f64167b5545b7f42275395be1f1e2ea3a6ac.1587407458.git.saiprakash.ranjan@codeaurora.org Signed-off-by: Will Deacon <[email protected]>
1 parent 232c5ae commit 0e764a0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

drivers/iommu/arm-smmu-qcom.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
44
*/
55

6+
#include <linux/of_device.h>
67
#include <linux/qcom_scm.h>
78

89
#include "arm-smmu.h"
@@ -11,6 +12,23 @@ struct qcom_smmu {
1112
struct arm_smmu_device smmu;
1213
};
1314

15+
static const struct of_device_id qcom_smmu_client_of_match[] = {
16+
{ .compatible = "qcom,adreno" },
17+
{ .compatible = "qcom,mdp4" },
18+
{ .compatible = "qcom,mdss" },
19+
{ .compatible = "qcom,sc7180-mdss" },
20+
{ .compatible = "qcom,sdm845-mdss" },
21+
{ }
22+
};
23+
24+
static int qcom_smmu_def_domain_type(struct device *dev)
25+
{
26+
const struct of_device_id *match =
27+
of_match_device(qcom_smmu_client_of_match, dev);
28+
29+
return match ? IOMMU_DOMAIN_IDENTITY : 0;
30+
}
31+
1432
static int qcom_sdm845_smmu500_reset(struct arm_smmu_device *smmu)
1533
{
1634
int ret;
@@ -41,6 +59,7 @@ static int qcom_smmu500_reset(struct arm_smmu_device *smmu)
4159
}
4260

4361
static const struct arm_smmu_impl qcom_smmu_impl = {
62+
.def_domain_type = qcom_smmu_def_domain_type,
4463
.reset = qcom_smmu500_reset,
4564
};
4665

0 commit comments

Comments
 (0)