summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorYajun Li <yajunl@codeaurora.org>2016-06-09 21:55:53 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-04-06 01:54:36 -0700
commit8f626889b9030e82473939c512eb41778f5bf3c5 (patch)
tree9514cd35b18dcea06c6d5144d54552e0c9b95540 /drivers/gpu
parent280560eaacd0a1c79c9b39d275db4e816e11576b (diff)
drm:msm add iommu fault handler function
Adding iommu fault handler callback to iommu driver, which will be called when memory fault happens. Change-Id: Ia2486fe167b889633ea4fb4c42601791efda133c Signed-off-by: Yajun Li <yajunl@codeaurora.org> Signed-off-by: Yunyun Cao <yunyunc@codeaurora.org>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/msm/msm_smmu.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/msm/msm_smmu.c b/drivers/gpu/drm/msm/msm_smmu.c
index c99f51e09700..172aba387982 100644
--- a/drivers/gpu/drm/msm/msm_smmu.c
+++ b/drivers/gpu/drm/msm/msm_smmu.c
@@ -53,6 +53,17 @@ struct msm_smmu_domain {
#define to_msm_smmu(x) container_of(x, struct msm_smmu, base)
#define msm_smmu_to_client(smmu) (smmu->client)
+
+static int msm_smmu_fault_handler(struct iommu_domain *iommu,
+ struct device *dev, unsigned long iova, int flags, void *arg)
+{
+
+ dev_info(dev, "%s: iova=0x%08lx, flags=0x%x, iommu=%p\n", __func__,
+ iova, flags, iommu);
+ return 0;
+}
+
+
static int _msm_smmu_create_mapping(struct msm_smmu_client *client,
const struct msm_smmu_domain *domain);
@@ -362,6 +373,7 @@ struct msm_mmu *msm_smmu_new(struct device *dev,
{
struct msm_smmu *smmu;
struct device *client_dev;
+ struct msm_smmu_client *client;
smmu = kzalloc(sizeof(*smmu), GFP_KERNEL);
if (!smmu)
@@ -376,6 +388,11 @@ struct msm_mmu *msm_smmu_new(struct device *dev,
smmu->client_dev = client_dev;
msm_mmu_init(&smmu->base, dev, &funcs);
+ client = msm_smmu_to_client(smmu);
+ if (client)
+ iommu_set_fault_handler(client->mmu_mapping->domain,
+ msm_smmu_fault_handler, dev);
+
return &smmu->base;
}