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

Commit 7b07a7e4 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: jpeg: Add support for SMMU fault handler"

parents ab18535f 0d740507
Loading
Loading
Loading
Loading
+47 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2016, 2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, 2018-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1536,6 +1536,46 @@ long __msm_jpeg_ioctl(struct msm_jpeg_device *pgmn_dev,
	return rc;
}

static void msm_jpeg_iommu_fault_handler (struct iommu_domain *domain,
	struct device *dev, unsigned long iova, int flags, void *token)
{
	struct msm_jpeg_device *pgmn_dev;

	if (token) {
		pgmn_dev = token;
		JPEG_PR_ERR("%s: core type %d addr 0x%lx\n",
			__func__, pgmn_dev->core_type, iova);
		JPEG_PR_ERR("%s: FE ion_fd %d y_addr 0x%x y_len %d\n",
			__func__,
			pgmn_dev->fe_pingpong_buf.buf[1].ion_fd,
			pgmn_dev->fe_pingpong_buf.buf[1].y_buffer_addr,
			pgmn_dev->fe_pingpong_buf.buf[1].y_len);
		JPEG_PR_ERR("%s: FE cbcr_addr %x cbcr_len %d\n",
			__func__,
			pgmn_dev->fe_pingpong_buf.buf[1].cbcr_buffer_addr,
			pgmn_dev->fe_pingpong_buf.buf[1].cbcr_len);
		JPEG_PR_ERR("%s: FE pln2_addr %x pln2_len %d frame_len %d\n",
			__func__,
			pgmn_dev->fe_pingpong_buf.buf[1].pln2_addr,
			pgmn_dev->fe_pingpong_buf.buf[1].pln2_len,
			pgmn_dev->fe_pingpong_buf.buf[1].framedone_len);
		JPEG_PR_ERR("%s: WE ion_fd %d y_addr 0x%x y_len %d\n",
			__func__,
			pgmn_dev->we_pingpong_buf.buf[0].ion_fd,
			pgmn_dev->we_pingpong_buf.buf[0].y_buffer_addr,
			pgmn_dev->we_pingpong_buf.buf[0].y_len);
		JPEG_PR_ERR("%s: WE  cbcr_addr %x cbcr_len %d\n",
			__func__,
			pgmn_dev->we_pingpong_buf.buf[0].cbcr_buffer_addr,
			pgmn_dev->we_pingpong_buf.buf[0].cbcr_len);
		JPEG_PR_ERR("%s: WE pln2_addr %x pln2_len %d frame_len %d\n",
			__func__,
			pgmn_dev->we_pingpong_buf.buf[0].pln2_addr,
			pgmn_dev->we_pingpong_buf.buf[0].pln2_len,
			pgmn_dev->we_pingpong_buf.buf[0].framedone_len);
	}
}

int __msm_jpeg_init(struct msm_jpeg_device *pgmn_dev)
{
	int rc = 0;
@@ -1569,6 +1609,12 @@ int __msm_jpeg_init(struct msm_jpeg_device *pgmn_dev)
		goto err_smmu;
	}

	cam_smmu_reg_client_page_fault_handler(
			pgmn_dev->iommu_hdl,
			msm_jpeg_iommu_fault_handler,
			NULL,
			pgmn_dev);

	/* setup all the resources for the jpeg driver */
	rc = msm_jpeg_platform_setup(pgmn_dev);
	if (rc < 0) {