소스 검색

msm: eva: Extract DSP buffer info from debug queue

Extracts DSP buffer information for log printing upon SMMU faults

Change-Id: I36b1900ea84a85cdfdb2dec8ad62b67a5ff57119
Signed-off-by: Jingyu Su <[email protected]>
Jingyu Su 1 년 전
부모
커밋
c82996e90f
4개의 변경된 파일93개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 0
      eva_module_build.bzl
  2. 8 0
      msm/eva/cvp_core_hfi.h
  3. 47 1
      msm/eva/msm_cvp_buf.c
  4. 37 0
      msm/eva/msm_cvp_dsp.h

+ 1 - 0
eva_module_build.bzl

@@ -101,6 +101,7 @@ def define_target_variant_modules(target, variant, registry, modules, config_opt
             name = rule_name,
             srcs = module_srcs,
             out = "{}.ko".format(module.name),
+            copts = ["-Wno-format"],
             deps = headers + _get_kernel_build_module_deps(module, options, formatter),
             local_defines = options.keys(),
         )

+ 8 - 0
msm/eva/cvp_core_hfi.h

@@ -224,6 +224,14 @@ enum reset_state {
 	DEASSERT,
 };
 
+/* Indices of hfi queues in hfi queue arrays (iface_queues & dsp_iface_queues) */
+enum hfi_queue_idx {
+	CMD_Q, /* Command queue */
+	MSG_Q, /* Message queue */
+	DEBUG_Q, /* Debug queue */
+	MAX_Q
+};
+
 struct iris_hfi_device;
 
 struct cvp_hal_ops {

+ 47 - 1
msm/eva/msm_cvp_buf.c

@@ -2036,6 +2036,40 @@ int msm_cvp_session_deinit_buffers(struct msm_cvp_inst *inst)
 	return rc;
 }
 
+void msm_cvp_populate_dsp_buf_info(struct cvp_internal_buf *buf,
+								struct cvp_hal_session *session,
+								u32 session_id,
+								struct msm_cvp_core *core)
+{
+	struct cvp_hfi_ops *dev_ops = (struct cvp_hfi_ops *) core->dev_ops;
+	struct iris_hfi_device *cvp_device = (struct iris_hfi_device *) dev_ops->hfi_device_data;
+	struct cvp_iface_q_info dsp_debugQ_info = cvp_device->dsp_iface_queues[DEBUG_Q];
+	struct cvp_dsp_trace_buf *trace_buf;
+	struct cvp_dsp_trace *dsp_debug_trace;
+
+	dsp_debug_trace = (struct cvp_dsp_trace *) dsp_debugQ_info.q_array.align_virtual_addr;
+
+	if (!dsp_debug_trace) {
+		dprintk(CVP_ERR, "dsp trace is NULL\n");
+		return;
+	}
+	for (int session_idx = 0; session_idx < EVA_TRACE_MAX_SESSION_NUM; session_idx++) {
+		if (dsp_debug_trace->sessions[session_idx].session_id == session_id) {
+			u32 buf_cnt = dsp_debug_trace->sessions[session_idx].buf_cnt;
+
+			for (int buf_idx = 0; buf_idx < buf_cnt; buf_idx++) {
+				trace_buf = &dsp_debug_trace->sessions[session_idx].buf[buf_idx];
+				if (buf->smem->device_addr == trace_buf->iova) {
+					buf->smem->buf_idx = trace_buf->buf_idx;
+					buf->smem->pkt_type = trace_buf->pkt_type;
+					buf->smem->fd = trace_buf->fd;
+					return;
+				}
+			}
+		}
+	}
+}
+
 #define MAX_NUM_FRAMES_DUMP 4
 void msm_cvp_print_inst_bufs(struct msm_cvp_inst *inst, bool log)
 {
@@ -2045,6 +2079,13 @@ void msm_cvp_print_inst_bufs(struct msm_cvp_inst *inst, bool log)
 	struct inst_snapshot *snap = NULL;
 	int i = 0, c = 0;
 
+	// DSP trace related variables
+	struct cvp_hal_session *session;
+	u32 session_id;
+
+	session = (struct cvp_hal_session *)inst->session;
+	session_id = hash32_ptr(session);
+
 	core = cvp_driver->cvp_core;
 	if (log && core->log.snapshot_index < 16) {
 		snap = &core->log.snapshot[core->log.snapshot_index];
@@ -2088,9 +2129,14 @@ void msm_cvp_print_inst_bufs(struct msm_cvp_inst *inst, bool log)
 	mutex_unlock(&inst->frames.lock);
 
 	mutex_lock(&inst->cvpdspbufs.lock);
+
 	dprintk(CVP_ERR, "dsp buffer list:\n");
-	list_for_each_entry(buf, &inst->cvpdspbufs.list, list)
+	list_for_each_entry(buf, &inst->cvpdspbufs.list, list) {
+		// Populate DSP buffer info from debug queue to kernel instance
+		msm_cvp_populate_dsp_buf_info(buf, session, session_id, core);
+		// Log print buffer info
 		_log_buf(snap, SMEM_CDSP, inst, buf, log);
+	}
 	mutex_unlock(&inst->cvpdspbufs.lock);
 
 	mutex_lock(&inst->cvpwnccbufs.lock);

+ 37 - 0
msm/eva/msm_cvp_dsp.h

@@ -249,6 +249,43 @@ struct cvp_dsp_apps {
 	struct driver_name cvp_fastrpc_name[MAX_FASTRPC_DRIVER_NUM];
 };
 
+#define EVA_TRACE_MAX_SESSION_NUM       16
+#define EVA_TRACE_MAX_INSTANCE_NUM      6
+#define EVA_TRACE_MAX_BUF_NUM           256
+
+#define CONFIG_SIZE_IN_BYTES        2048
+#define CONFIG_SIZE_IN_WORDS        (CONFIG_SIZE_IN_BYTES >> 2)
+
+// iova is eva_dsp_buf->iova
+// pkt_type is frame packet type using the buffer
+// buf_idx is the index of the buffer in a frame packet
+// transaction_id is the transaction id of frame packet
+struct cvp_dsp_trace_buf {
+	u32	iova;
+	u32	pkt_type;
+	u32	buf_idx;
+	u32	transaction_id;
+	u32	fd;
+};
+
+// Saving config packet for each intance
+struct cvp_dsp_trace_instance {
+	u32    feature_type;
+	u32    config_pkt[CONFIG_SIZE_IN_WORDS];
+};
+
+struct cvp_dsp_trace_session {
+	u32                session_id;
+	u32                buf_cnt;
+	u32                inst_cnt;
+	struct cvp_dsp_trace_instance  instance[EVA_TRACE_MAX_INSTANCE_NUM];
+	struct cvp_dsp_trace_buf       buf[EVA_TRACE_MAX_BUF_NUM];
+};
+
+struct cvp_dsp_trace {
+	struct cvp_dsp_trace_session   sessions[EVA_TRACE_MAX_SESSION_NUM];
+};
+
 extern struct cvp_dsp_apps gfa_cv;
 /*
  * API for CVP driver to suspend CVP session during