Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 196f4e6b authored by Camera Software Integration's avatar Camera Software Integration Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: smmu: Disable SMMU stall on page fault" into camera-kernel.lnx.4.0

parents e4003013 bc32fa9e
Loading
Loading
Loading
Loading
+25 −1
Original line number Original line Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
// 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 <linux/module.h>
#include <linux/module.h>
@@ -133,6 +133,7 @@ struct cam_context_bank_info {
	bool is_fw_allocated;
	bool is_fw_allocated;
	bool is_secheap_allocated;
	bool is_secheap_allocated;
	bool is_qdss_allocated;
	bool is_qdss_allocated;
	bool stall_disable;


	struct scratch_mapping scratch_map;
	struct scratch_mapping scratch_map;
	struct gen_pool *shared_mem_pool;
	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)
	struct device *dev)
{
{
	int rc = 0;
	int rc = 0;
	int32_t stall_disable = 1;
	int32_t hupcf = 1;


	if (!cb || !dev) {
	if (!cb || !dev) {
		CAM_ERR(CAM_SMMU, "Error: invalid input params");
		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->discard_iova_len);


		cb->state = CAM_SMMU_ATTACH;
		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 {
	} else {
		CAM_ERR(CAM_SMMU, "Context bank does not have IO region");
		CAM_ERR(CAM_SMMU, "Context bank does not have IO region");
		rc = -ENODEV;
		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,
	cb->num_shared_hdl = of_property_count_strings(dev->of_node,
		"cam-smmu-label");
		"cam-smmu-label");


	cb->stall_disable =
		of_property_read_bool(dev->of_node, "stall-disable");

	if (cb->num_shared_hdl >
	if (cb->num_shared_hdl >
		CAM_SMMU_SHARED_HDL_MAX) {
		CAM_SMMU_SHARED_HDL_MAX) {
		CAM_ERR(CAM_CDM, "Invalid count of client names count=%d",
		CAM_ERR(CAM_CDM, "Invalid count of client names count=%d",