summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Huang <kenbshuang@google.com>2023-03-20 10:40:55 +0800
committerKen Huang <kenbshuang@google.com>2023-03-21 14:16:33 +0800
commit0202e9daaa025994070727d20f200fc2c70faede (patch)
tree215d59390a10e685f609d67a83df5ece6e00ade6
parent39d0f1e423c02468d72b2f23d912f3394f90fda5 (diff)
downloaddisplay-0202e9daaa025994070727d20f200fc2c70faede.tar.gz
drm: samsung: improve debug messages for secure contents
Dump the security bit as well when the sysmmu fault happens. Bug: 260514681 Test: check dpu event log Change-Id: I9af612686ce35d24fa271045959f14b59a942fc2 Signed-off-by: Ken Huang <kenbshuang@google.com>
-rw-r--r--samsung/cal_9845/dpp_reg.c10
-rw-r--r--samsung/cal_9845/regs-dpp.h1
-rw-r--r--samsung/cal_common/dpp_cal.h1
-rw-r--r--samsung/exynos_drm_debug.c16
-rw-r--r--samsung/exynos_drm_decon.h3
-rw-r--r--samsung/exynos_drm_dpp.c4
-rw-r--r--samsung/exynos_drm_dpp.h1
7 files changed, 36 insertions, 0 deletions
diff --git a/samsung/cal_9845/dpp_reg.c b/samsung/cal_9845/dpp_reg.c
index 79d74bc..c19b249 100644
--- a/samsung/cal_9845/dpp_reg.c
+++ b/samsung/cal_9845/dpp_reg.c
@@ -1036,6 +1036,16 @@ void dma_reg_get_shd_addr(u32 id, u32 shd_addr[], const unsigned long attr)
shd_addr[0], shd_addr[1], shd_addr[2], shd_addr[3]);
}
+bool dma_reg_is_mst_security_enabled(u32 id, u32 *out_mst_security)
+{
+ u32 val = dma_read(id, RDMA_MST_SECURITY);
+
+ if (out_mst_security)
+ *out_mst_security = val;
+
+ return (val & RDMA_MST_SECURITY_MASK) != 0;
+}
+
static void dpp_reg_dump_ch_data(struct drm_printer *p, int id, enum dpp_reg_area reg_area,
const u32 sel[], u32 cnt)
{
diff --git a/samsung/cal_9845/regs-dpp.h b/samsung/cal_9845/regs-dpp.h
index 667a1cc..e7e8771 100644
--- a/samsung/cal_9845/regs-dpp.h
+++ b/samsung/cal_9845/regs-dpp.h
@@ -285,6 +285,7 @@
#define IDMA_DG_EN_ALL (0x7FFFFFFF << 0)
#define RDMA_MST_SECURITY (0x0200)
+#define RDMA_MST_SECURITY_MASK (0x1 << 0)
#define RDMA_SLV_SECURITY (0x0204)
#define RDMA_DEBUG_CTRL (0x0300)
diff --git a/samsung/cal_common/dpp_cal.h b/samsung/cal_common/dpp_cal.h
index 40c75e6..bae3d92 100644
--- a/samsung/cal_common/dpp_cal.h
+++ b/samsung/cal_common/dpp_cal.h
@@ -252,6 +252,7 @@ void cgc_reg_set_config(u32 id, bool en, dma_addr_t addr);
void cgc_reg_set_cgc_start(u32 id);
void dma_reg_get_shd_addr(u32 id, u32 shd_addr[], const unsigned long attr);
+bool dma_reg_is_mst_security_enabled(u32 id, u32 *out_mst_security);
#ifdef __linux__
struct dpp_device;
diff --git a/samsung/exynos_drm_debug.c b/samsung/exynos_drm_debug.c
index 7c5487f..de197d4 100644
--- a/samsung/exynos_drm_debug.c
+++ b/samsung/exynos_drm_debug.c
@@ -178,6 +178,12 @@ void DPU_EVENT_LOG(enum dpu_event_type type, int index, void *priv)
log->data.dpp.id = dpp->id;
log->data.dpp.win_id = dpp->win_id;
break;
+ case DPU_EVT_DPP_SET_PROTECTION:
+ dpp = (struct dpp_device *)priv;
+ log->data.dpp.id = dpp->id;
+ log->data.dpp.mst_security = dpp->rdma_mst_security;
+ log->data.dpp.last_secure_pid = current->pid;
+ break;
case DPU_EVT_DMA_RECOVERY:
dpp = (struct dpp_device *)priv;
log->data.dpp.id = dpp->id;
@@ -540,6 +546,7 @@ static const char *get_event_name(enum dpu_event_type type)
"DSIM_PH_FIFO_TIMEOUT",
"DSIM_PL_FIFO_TIMEOUT",
"DPP_FRAMEDONE",
+ "DPP_SET_PROTECTION",
"DMA_RECOVERY",
"IDMA_AFBC_CONFLICT",
"IDMA_FBC_ERROR",
@@ -693,11 +700,13 @@ static bool is_skip_dpu_event_dump(enum dpu_event_type type, enum dpu_event_cond
case DPU_EVT_DSIM_FRAMEDONE:
case DPU_EVT_DPP_FRAMEDONE:
case DPU_EVT_DMA_RECOVERY:
+ case DPU_EVT_DPP_SET_PROTECTION:
case DPU_EVT_IDMA_AFBC_CONFLICT:
case DPU_EVT_IDMA_FBC_ERROR:
case DPU_EVT_IDMA_READ_SLAVE_ERROR:
case DPU_EVT_IDMA_DEADLOCK:
case DPU_EVT_IDMA_CFG_ERROR:
+ case DPU_EVT_SYSMMU_FAULT:
case DPU_EVT_ATOMIC_COMMIT:
case DPU_EVT_TE_INTERRUPT:
case DPU_EVT_DSIM_RUNTIME_SUSPEND:
@@ -790,6 +799,13 @@ static void dpu_event_log_print(const struct decon_device *decon, struct drm_pri
scnprintf(buf + len, sizeof(buf) - len,
"\tID:%u WIN:%u", log->data.dpp.id, log->data.dpp.win_id);
break;
+ case DPU_EVT_DPP_SET_PROTECTION:
+ scnprintf(buf + len, sizeof(buf) - len,
+ "\tID:%u mst_security:%#x PID: %d",
+ log->data.dpp.id,
+ log->data.dpp.mst_security,
+ log->data.dpp.last_secure_pid);
+ break;
case DPU_EVT_DMA_RECOVERY:
str_comp = get_comp_src_name(log->data.dpp.comp_src);
scnprintf(buf + len, sizeof(buf) - len,
diff --git a/samsung/exynos_drm_decon.h b/samsung/exynos_drm_decon.h
index 1d5ce3f..b6ca5b7 100644
--- a/samsung/exynos_drm_decon.h
+++ b/samsung/exynos_drm_decon.h
@@ -208,6 +208,7 @@ enum dpu_event_type {
DPU_EVT_DSIM_PL_FIFO_TIMEOUT,
DPU_EVT_DPP_FRAMEDONE,
+ DPU_EVT_DPP_SET_PROTECTION,
DPU_EVT_DMA_RECOVERY,
DPU_EVT_IDMA_AFBC_CONFLICT,
@@ -299,6 +300,8 @@ struct dpu_log_dpp {
u32 win_id;
u64 comp_src;
u32 recovery_cnt;
+ pid_t last_secure_pid; /* record last PID which wrote mst_security */
+ bool mst_security;
};
struct dpu_log_win {
diff --git a/samsung/exynos_drm_dpp.c b/samsung/exynos_drm_dpp.c
index 88eff56..2354f13 100644
--- a/samsung/exynos_drm_dpp.c
+++ b/samsung/exynos_drm_dpp.c
@@ -552,6 +552,10 @@ static int set_protection(struct dpp_device *dpp, uint64_t modifier)
ret = exynos_smc(SMC_PROTECTION_SET, 0, protection_id,
(protection ? SMC_PROTECTION_ENABLE :
SMC_PROTECTION_DISABLE));
+ WARN(dma_reg_is_mst_security_enabled(dpp->id, &dpp->rdma_mst_security) != !protection,
+ "dpp[%u] mst_security: %#x\n",
+ dpp->id, dpp->rdma_mst_security);
+ DPU_EVENT_LOG(DPU_EVT_DPP_SET_PROTECTION, dpp->decon_id, dpp);
if (ret) {
dpp_err(dpp, "failed to %s protection(ch:%u, ret:%d)\n",
protection ? "enable" : "disable", dpp->id, ret);
diff --git a/samsung/exynos_drm_dpp.h b/samsung/exynos_drm_dpp.h
index 20ce94b..ac5e875 100644
--- a/samsung/exynos_drm_dpp.h
+++ b/samsung/exynos_drm_dpp.h
@@ -92,6 +92,7 @@ struct dpp_device {
unsigned int win_id; /* connected window id */
bool is_win_connected; /* Is dpp connected to window ? */
bool protection;
+ u32 rdma_mst_security; /* read MST_SECURITY from rdma register */
/*
* comp_src means compression source of input buffer compressed by