mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/msm/dpu: add DSC range checking during resource reservation
@ 2023-04-11 21:09 Kuogee Hsieh
  2023-04-11 21:36 ` Abhinav Kumar
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Kuogee Hsieh @ 2023-04-11 21:09 UTC (permalink / raw)
  To: robdclark, sean, swboyd, dianders, vkoul, daniel, airlied,
	agross, dmitry.baryshkov, andersson
  Cc: quic_abhinavk, quic_khsieh, quic_sbillaka, freedreno, dri-devel,
	linux-arm-msm, linux-kernel

Perform DSC range checking to make sure correct DSC is requested before
reserve resource for it.

Fixes: c985d7bb64ff ("drm/msm/disp/dpu1: Add DSC support in RM")
Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
index f4dda88..95e58f1 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #define pr_fmt(fmt)	"[drm:%s] " fmt, __func__
@@ -250,6 +251,11 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_dsc *hw;
 		const struct dpu_dsc_cfg *dsc = &cat->dsc[i];
 
+		if (dsc->id < DSC_0 || dsc->id >= DSC_MAX) {
+			DPU_ERROR("skip dsc %d with invalid id\n", dsc->id);
+			continue;
+		}
+
 		hw = dpu_hw_dsc_init(dsc->id, mmio, cat);
 		if (IS_ERR_OR_NULL(hw)) {
 			rc = PTR_ERR(hw);
@@ -557,8 +563,10 @@ static int _dpu_rm_make_reservation(
 	}
 
 	ret  = _dpu_rm_reserve_dsc(rm, global_state, enc, &reqs->topology);
-	if (ret)
+	if (ret) {
+		DPU_ERROR("unable to find appropriate DSC\n");
 		return ret;
+	}
 
 	return ret;
 }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-04-12 19:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-11 21:09 [PATCH] drm/msm/dpu: add DSC range checking during resource reservation Kuogee Hsieh
2023-04-11 21:36 ` Abhinav Kumar
2023-04-11 22:22 ` Dmitry Baryshkov
2023-04-11 22:24 ` Marijn Suijten
2023-04-11 22:32   ` [Freedreno] " Abhinav Kumar
2023-04-12  1:06     ` Dmitry Baryshkov
2023-04-12  1:50       ` Abhinav Kumar
2023-04-12  7:38         ` Marijn Suijten
2023-04-12 17:48           ` Abhinav Kumar
2023-04-12 18:50             ` Marijn Suijten
2023-04-12 18:56               ` Dmitry Baryshkov
2023-04-12 18:59               ` Abhinav Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®