msm: camera: common: Page Fault notification to userspace

Upon Page Fault, smmu driver invokes faulted client's callback
which looks for faulted buffer and context. The client driver
can be ISP, ICP, JPEG, IFE CDM and CPAS CDM. The driver then
fills PF msg struct, logs related info, and notify PF msg to
userspace. Userspace is expected to abort and calls to shut
down kernel drivers. When Titan powers on next session, CAMSS
undergoes async reset.
This change also ensures the page fault related changes added
to TFE, OPE, CRE do not break the drivers compilation.

CRs-Fixed: 3156671
Change-Id: Icd6c8c9a38cac206fe8260d374d03964fb280879
Signed-off-by: sokchetra eung <quic_eung@quicinc.com>
这个提交包含在:
sokchetra eung
2021-10-12 17:21:07 -07:00
提交者 Camera Software Integration
父节点 d43146eb4f
当前提交 c52c83e7ce
修改 31 个文件,包含 1038 行新增867 行删除

查看文件

@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/delay.h>
@@ -16,6 +17,7 @@
#include "cam_debug_util.h"
#include "cam_smmu_api.h"
#include "camera_main.h"
#include "cam_context_utils.h"
#define CAM_CRE_DEV_NAME "cam-cre"
@@ -31,20 +33,35 @@ struct cam_cre_subdev {
static struct cam_cre_subdev g_cre_dev;
static void cam_cre_dev_iommu_fault_handler(
struct cam_smmu_pf_info *pf_info)
struct cam_smmu_pf_info *pf_smmu_info)
{
int i = 0;
int i, rc;
struct cam_node *node = NULL;
struct cam_hw_dump_pf_args pf_args = {0};
if (!pf_info || !pf_info->token) {
CAM_ERR(CAM_ISP, "invalid token in page handler cb");
if (!pf_smmu_info || !pf_smmu_info->token) {
CAM_ERR(CAM_CRE, "invalid token in page handler cb");
return;
}
node = (struct cam_node *)pf_info->token;
node = (struct cam_node *)pf_smmu_info->token;
for (i = 0; i < node->ctx_size; i++)
cam_context_dump_pf_info(&(node->ctx_list[i]), pf_info);
pf_args.pf_smmu_info = pf_smmu_info;
for (i = 0; i < node->ctx_size; i++) {
cam_context_dump_pf_info(&(node->ctx_list[i]), &pf_args);
if (pf_args.pf_context_info.ctx_found)
/* found ctx and packet of the faulted address */
break;
}
if (i == node->ctx_size) {
/* Faulted ctx not found. Report PF to userspace */
rc = cam_context_send_pf_evt(NULL, &pf_args);
if (rc)
CAM_ERR(CAM_CRE,
"Failed to notify PF event to userspace rc: %d", rc);
}
}
static int cam_cre_subdev_open(struct v4l2_subdev *sd,