From bc32fa9ef8ba4c3a18673b9ef9c60d2dce1fd416 Mon Sep 17 00:00:00 2001 From: Shravya Samala Date: Thu, 8 Apr 2021 17:07:47 +0530 Subject: [PATCH] msm: camera: smmu: Disable SMMU stall on page fault Changes are made to disable stall on pagefault for all the driver contexts inorder to support for smmu stall on page fault. CRs-Fixed: 2936320 Change-Id: Id3d16b4d980349044de1bc1d1bf4bfad5aee79f4 Signed-off-by: Shravya Samala --- drivers/cam_smmu/cam_smmu_api.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/cam_smmu/cam_smmu_api.c b/drivers/cam_smmu/cam_smmu_api.c index 14734c75a15d..05b3700bddfb 100644 --- a/drivers/cam_smmu/cam_smmu_api.c +++ b/drivers/cam_smmu/cam_smmu_api.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. */ #include @@ -133,6 +133,7 @@ struct cam_context_bank_info { bool is_fw_allocated; bool is_secheap_allocated; bool is_qdss_allocated; + bool stall_disable; struct scratch_mapping scratch_map; struct gen_pool *shared_mem_pool; @@ -3641,6 +3642,8 @@ static int cam_smmu_setup_cb(struct cam_context_bank_info *cb, struct device *dev) { int rc = 0; + int32_t stall_disable = 1; + int32_t hupcf = 1; if (!cb || !dev) { CAM_ERR(CAM_SMMU, "Error: invalid input params"); @@ -3708,6 +3711,24 @@ static int cam_smmu_setup_cb(struct cam_context_bank_info *cb, cb->discard_iova_len); cb->state = CAM_SMMU_ATTACH; + + if (cb->stall_disable) { + if (iommu_domain_set_attr(cb->domain, + DOMAIN_ATTR_FAULT_MODEL_NO_STALL, + &stall_disable) < 0) { + CAM_ERR(CAM_SMMU, + "Error: failed to set cb stall disable for node: %s", + cb->name[0]); + } + + if (iommu_domain_set_attr(cb->domain, + DOMAIN_ATTR_FAULT_MODEL_HUPCF, + &hupcf) < 0) { + CAM_ERR(CAM_SMMU, + "Error: failed to set attribute HUPCF for node: %s", + cb->name[0]); + } + } } else { CAM_ERR(CAM_SMMU, "Context bank does not have IO region"); rc = -ENODEV; @@ -4046,6 +4067,9 @@ static int cam_populate_smmu_context_banks(struct device *dev, cb->num_shared_hdl = of_property_count_strings(dev->of_node, "cam-smmu-label"); + cb->stall_disable = + of_property_read_bool(dev->of_node, "stall-disable"); + if (cb->num_shared_hdl > CAM_SMMU_SHARED_HDL_MAX) { CAM_ERR(CAM_CDM, "Invalid count of client names count=%d",