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>
This commit is contained in:
sokchetra eung
2021-10-12 17:21:07 -07:00
committed by Camera Software Integration
parent d43146eb4f
commit c52c83e7ce
31 changed files with 1038 additions and 867 deletions

View File

@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/delay.h>
@@ -17,6 +18,7 @@
#include "cam_smmu_api.h"
#include "camera_main.h"
#include "cam_common_util.h"
#include "cam_context_utils.h"
#define CAM_JPEG_DEV_NAME "cam-jpeg"
@@ -39,20 +41,35 @@ static int cam_jpeg_dev_err_inject_cb(void *err_param)
}
static void cam_jpeg_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_JPEG, "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. But report PF to UMD anyway*/
rc = cam_context_send_pf_evt(NULL, &pf_args);
if (rc)
CAM_ERR(CAM_JPEG,
"Failed to notify PF event to userspace rc: %d", rc);
}
}
static void cam_jpeg_dev_mini_dump_cb(void *priv, void *args)