Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp130089rwl; Tue, 11 Apr 2023 15:40:47 -0700 (PDT) X-Google-Smtp-Source: AKy350ZKk6gghOpeRKhzyPZnJtz9GJRmRgmiV4K+xoxatEBU6YRmZFxxYsEtgIqABNNYZVzSEBU5 X-Received: by 2002:a17:903:1245:b0:1a5:2540:729 with SMTP id u5-20020a170903124500b001a525400729mr18801612plh.56.1681252846812; Tue, 11 Apr 2023 15:40:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681252846; cv=none; d=google.com; s=arc-20160816; b=pyNfkJrQ5LExxBmOgvbXnPAA9dRUn1hHmw9GhDtRPOyGPxYESQYa5T2iZIOqDLjbnY 94PH1hNqoDc2GalSiTFl8djgQOLQw+NqKOWeQ2rTlDcDp3r5TxDS5kJ7Aa4vM7mdG22E h/LXjiQc1viMcCwluH0d8HOLW8f+wHjuFNNRlM+uY+NZIOJo93F1rivnu88zFgTkW8/d KOsGOK3rrl15MeYwyNLo6Y3+ESXolkt2ID5m4hp9ponXyo/LyBbqOE8KxaUhXaVTd9CP mDzsyFPiZFQoAOr5P/Avu6KA+o3tHVhr28YstV804J+qfjVGROg4aeoSbcnkmT1k4RNY X5vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=P4r8Y9Uj5B1j8T1yvkSN1a+EyeRVlGg2EjbkBjNXrqU=; b=uj7UTinKeKmqjoiZxnUuYsQOEjoaN05z/0AQvWeLS38FvwC6bCazYUrLaP+/tQXYak T8TkkdoIKKwV8SwE9JFwH8VWB1iX9Ct/Ix0Os7bZP+i5H9njrxRniQhDxg0FxU5wt7I8 9ycOWBsjS0IGP9FIhpLwulzLlfPOwrdUakYscdMFofQ0vzGid9wwUSuAXOhG6wSBi2Za 1qSPLKcHvr8KHLpwmzC3b9gjS4QKSRFnxnBxyGiTy8Hu2ouKoevLe41iDg/4Veo/7asq Z/nU7n+ZhVGEbnO5U9bpTSGBzFT0WdcBRtFDCY7srau9TXqEsR5e5pL99pYK8PGVJNDy Wo+A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i71-20020a63874a000000b00518c878b1dbsi8092279pge.356.2023.04.11.15.40.34; Tue, 11 Apr 2023 15:40:46 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229516AbjDKWYM (ORCPT + 99 others); Tue, 11 Apr 2023 18:24:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229532AbjDKWYL (ORCPT ); Tue, 11 Apr 2023 18:24:11 -0400 Received: from m-r2.th.seeweb.it (m-r2.th.seeweb.it [IPv6:2001:4b7a:2000:18::171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0E7640C6 for ; Tue, 11 Apr 2023 15:24:09 -0700 (PDT) Received: from SoMainline.org (94-211-6-86.cable.dynamic.v4.ziggo.nl [94.211.6.86]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r2.th.seeweb.it (Postfix) with ESMTPSA id E34883FFB3; Wed, 12 Apr 2023 00:24:07 +0200 (CEST) Date: Wed, 12 Apr 2023 00:24:06 +0200 From: Marijn Suijten To: Kuogee Hsieh Cc: robdclark@gmail.com, sean@poorly.run, swboyd@chromium.org, dianders@chromium.org, vkoul@kernel.org, daniel@ffwll.ch, airlied@gmail.com, agross@kernel.org, dmitry.baryshkov@linaro.org, andersson@kernel.org, quic_abhinavk@quicinc.com, quic_sbillaka@quicinc.com, freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/msm/dpu: add DSC range checking during resource reservation Message-ID: References: <1681247380-1607-1-git-send-email-quic_khsieh@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1681247380-1607-1-git-send-email-quic_khsieh@quicinc.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 Again, don't forget to include previous reviewers in cc, please :) On 2023-04-11 14:09:40, Kuogee Hsieh wrote: > Perform DSC range checking to make sure correct DSC is requested before > reserve resource for it. This isn't performing any range checking for resource reservations / requests: this is only validating the constants written in our catalog and seems rather useless. It isn't fixing any real bug either, so the Fixes: tag below seems extraneous. Given prior comments from Abhinav that "the kernel should be trusted", we should remove this validation for all the other blocks instead. > 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"); This, while a nice addition, should go in a different patch. Thanks! - Marijn > return ret; > + } > > return ret; > } > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project >