Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp52084rwl; Tue, 11 Apr 2023 14:16:28 -0700 (PDT) X-Google-Smtp-Source: AKy350biZwrTpu5zizA3k02unrNUyRHzDL8yk1QC4PXBIfF4WAhtHASA+QOYDgx101TDKYn8iI9K X-Received: by 2002:a17:903:338e:b0:1a1:d215:ef0c with SMTP id kb14-20020a170903338e00b001a1d215ef0cmr14642838plb.16.1681247788698; Tue, 11 Apr 2023 14:16:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681247788; cv=none; d=google.com; s=arc-20160816; b=pvGZN/7nIozhRro4WbpjT/1LdUBU6FT/iRMqHwESqp0nwmXbC5k1gtSv12xgzf41tA nVVj6ZdJFL12nRdY1ZVOjAC0y/ouBnzcLq/XdInbMwlD0r8+HtyH1qaIZHu3rzTX1Wan b4xEW42P1Qd9JAou5asYeEbc39UQ8jpynOF3FqGNAixBw4VhhxS69sGyW9pz3sYowbxY FjzS7s5PO9yMtjYwYZhVssv+VpuTBiWAO/Fu2af1lyRaRw0gpkWz9nTdDlwAr4d4WUoB x7rgUuSNCfx0qJZRuRFA94dMNt262zjy7sLNnQZWt2tAp/EHlaZSK17l8wOm9Xzy2guB S7kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=i2rscoya1h2h5VboVRI66W0JlClFfDBueFYWIdsH+Lw=; b=Qeitb1EuHixQEDat1zv/dg0Mc8R5UDt+10FyHT4n7R13hnJSadAJoJUjEPTNCggvyw 5r8+IlrHC8dICxFxiAKdOjEztf7it1sr49YukOXgqLyQWKXBr4XKtWayhSTvWhKXJD50 5SdTQGI3jkdHmrnhQ+/vnr75G4ndPfrcBvUr5LWtoHpDbCPjCM5mdUTPUsgsy25Ked5u tQS/KdHI6LAph65z+Q62IzgcmIHdQVGgTFpTgJZqs4f44uN9iNlyOVcksZgL2c486P9v QkGVY1lGxFLB4nntKOZ7Uv2JUhvx4FuP7K3jzPA3VLPTeSWpqcDfvlc5gP4Yg6R9/1oO ig0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mJzA60XM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i11-20020a170902eb4b00b0019d20f7db09si8691932pli.597.2023.04.11.14.15.50; Tue, 11 Apr 2023 14:16:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mJzA60XM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229683AbjDKVJ7 (ORCPT + 99 others); Tue, 11 Apr 2023 17:09:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjDKVJ5 (ORCPT ); Tue, 11 Apr 2023 17:09:57 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA6CB3594; Tue, 11 Apr 2023 14:09:56 -0700 (PDT) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33BKsDoA007547; Tue, 11 Apr 2023 21:09:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=i2rscoya1h2h5VboVRI66W0JlClFfDBueFYWIdsH+Lw=; b=mJzA60XMy6RRoAA3W8wu/hn8SBUW4JB/D/ktcBw31f3oWOqax1mVydzLaWtxQutwQA6o 4p1H2DMxsz6TnWVWVoQat3QtnCmn+eMPPiemyPDcnLElNhiWCtdY4WyG6ol0jFQpdKzD d8KzSZgUzOveqvj71NlURYYOp4mSnavx88jiTXzt+7Gu7cUo1rezh5GKXOYwzLD2YqAt 1ol9WxzO6+vTgo/Un4JK91uKg8qNa/ik/wHME0j9e7Gq6R40LzfxAToFO0PGPQPInBFz Y+ynSNaRAzWnHRRb69oXZ8zx+3cEcJzwdphInApe1Wz2lcp110eeTmTFz2J5jWSa86NO gw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pwe6m03px-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Apr 2023 21:09:50 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33BL9n4K023171 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Apr 2023 21:09:49 GMT Received: from khsieh-linux1.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Tue, 11 Apr 2023 14:09:48 -0700 From: Kuogee Hsieh To: , , , , , , , , , CC: , , , , , , Subject: [PATCH] drm/msm/dpu: add DSC range checking during resource reservation Date: Tue, 11 Apr 2023 14:09:40 -0700 Message-ID: <1681247380-1607-1-git-send-email-quic_khsieh@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: WKmBajXDpqpBM9OQIlelBY97t9wQLLFL X-Proofpoint-ORIG-GUID: WKmBajXDpqpBM9OQIlelBY97t9wQLLFL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_14,2023-04-11_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 malwarescore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304110190 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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