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/debugfs.h>
@@ -17,22 +18,18 @@
static const char jpeg_dev_name[] = "cam-jpeg";
static int cam_jpeg_context_dump_active_request(void *data,
struct cam_smmu_pf_info *pf_info)
static int cam_jpeg_context_dump_active_request(void *data, void *args)
{
struct cam_context *ctx = (struct cam_context *)data;
struct cam_ctx_request *req = NULL;
struct cam_ctx_request *req_temp = NULL;
struct cam_hw_mgr_dump_pf_data *pf_dbg_entry = NULL;
uint32_t resource_type = 0;
struct cam_context *ctx = (struct cam_context *)data;
struct cam_ctx_request *req = NULL;
struct cam_ctx_request *req_temp = NULL;
struct cam_hw_dump_pf_args *pf_args = (struct cam_hw_dump_pf_args *)args;
int rc = 0;
int closest_port;
bool b_mem_found = false, b_ctx_found = false;
if (!ctx) {
CAM_ERR(CAM_JPEG, "Invalid ctx");
if (!ctx || !pf_args) {
CAM_ERR(CAM_JPEG, "Invalid ctx %pK or pf args %pK",
ctx, pf_args);
return -EINVAL;
}
@@ -41,19 +38,23 @@ static int cam_jpeg_context_dump_active_request(void *data,
list_for_each_entry_safe(req, req_temp,
&ctx->active_req_list, list) {
pf_dbg_entry = &(req->pf_data);
closest_port = -1;
CAM_INFO(CAM_JPEG, "req_id : %lld ", req->request_id);
CAM_INFO(CAM_JPEG, "Active req_id: %lld, ctx_id: %u",
req->request_id, ctx->ctx_id);
rc = cam_context_dump_pf_info_to_hw(ctx, pf_dbg_entry,
&b_mem_found, &b_ctx_found, &resource_type, pf_info);
rc = cam_context_dump_pf_info_to_hw(ctx, pf_args, &req->pf_data);
if (rc)
CAM_ERR(CAM_JPEG, "Failed to dump pf info");
if (b_mem_found)
CAM_ERR(CAM_JPEG, "Found page fault in req %lld %d",
req->request_id, rc);
CAM_ERR(CAM_JPEG, "Failed to dump pf info ctx_id: %u state: %d",
ctx->ctx_id, ctx->state);
}
if (pf_args->pf_context_info.ctx_found) {
/* Send PF notification to UMD if PF found on current CTX */
rc = cam_context_send_pf_evt(ctx, pf_args);
if (rc)
CAM_ERR(CAM_JPEG,
"Failed to notify PF event to userspace rc: %d", rc);
}
return rc;
}