Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2908679rwr; Fri, 21 Apr 2023 16:51:57 -0700 (PDT) X-Google-Smtp-Source: AKy350a4x8p/mhnRWqZ6DBksGYAbByX+UbQuGh3TrbCgilDwur6rHGeb1CWC6spYb8WH1VHjIUMX X-Received: by 2002:a17:902:e808:b0:1a6:6bdb:b548 with SMTP id u8-20020a170902e80800b001a66bdbb548mr8022884plg.1.1682121117110; Fri, 21 Apr 2023 16:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682121117; cv=none; d=google.com; s=arc-20160816; b=b9+7SAg5HiwBjoKVpjHYxygbLoJVLGbj5Wz9FaJxf9H+4Q+XDe/BaubhD6vBMse1tq 6qx0xqxGxx/BpvuIrVy3u9Uxq5sau8RAvogdbvkU3VP+p9f/YuKW1XxfVds3bqcBeyWy LLOdgB7aqeg1n7fTS5RlJPbb1McgvzTCb4pM/n6OsvIGHFE3XQh+P1YXYMURBC+7IVQv Glv1lkP0zXw6y1RGVuecxKRss1TdACRKaIswHGmLaMLWMupU2GBEK1//2Nhmxwj4EOPA CKBrDqh74W2QT5VB0QhDdpNRMp2/10fKRXLjX8hdYPKVDIxOxIz6gSVseBLhwT4wgS+2 825w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=jo698b9kC38YuFkFAulLL8uZp9Tf9BwRfwEyBVmKSGw=; b=RDQu5IuFrsi8ESIwDUJmi80GGEojS3PE05Ih0l6EK3XH6A1xMdZeFoORCCNjCVwRIs /ZXSjB4NU0zQI7q2c783OgttasE26LQUBhR4CPnkGypaizofgnUJwM8m6R6UDHBgl1S4 eEaTF0zLR9TizZGrtoHW0swe3gBt2seh7D9jV++l9pwAyCg5itdsE3SzkLNQlzOh1PUe Cfjp65PSrWxmSnDb15v3Dldl3RjSRZq7ZN72MU/Z0uPn+dYI3IphLqtUbcaPCXFsyMOk cpl9+poJIAbdNOL5zQSJNeBWLfRbR/QpDzCo8IZGXGxGGiYHOeTqDvpdApes60rX/pgZ pvxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MuowO5y7; 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 d13-20020a170902f14d00b0019d13e26ecasi5190341plb.355.2023.04.21.16.51.40; Fri, 21 Apr 2023 16:51:57 -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=MuowO5y7; 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 S233771AbjDUXZb (ORCPT + 99 others); Fri, 21 Apr 2023 19:25:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233512AbjDUXZa (ORCPT ); Fri, 21 Apr 2023 19:25:30 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B0A2171B; Fri, 21 Apr 2023 16:25:28 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33LMemKM027312; Fri, 21 Apr 2023 23:25:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=jo698b9kC38YuFkFAulLL8uZp9Tf9BwRfwEyBVmKSGw=; b=MuowO5y7WcL98JrpPA1Mh5Vxsh+VrWqvSyYxmKMX99TVZcIevHPvllQUKZhKjKrmz7ZT rTQs/84OzlPxOMOa1vRlN/qq5UdNjBr5g9HC0bEl737UywFanVXeTpajuuit7/beGOhy FSNNbZ4ODXJb8SLUTRS+vKGw1Ym+0GsivGYKO+42wcm1w71560vGqZ9Vsqq7LUWQNYr1 Maez7ybTT+LD6adVEMBwL8HKXJohg0wkceBvwVvnQwXXjaZT8GZWnAQ8Ihd707R5NzTB r4H8lj92n4IQmUbyOq+CuBSzMAHtpEP9NUbOfSaqtZTPbzHGgAIyIb5hTmDezs2bCGIC DA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q3phdhugu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Apr 2023 23:25:18 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33LNPHWS013848 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Apr 2023 23:25:17 GMT Received: from [10.110.74.190] (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; Fri, 21 Apr 2023 16:25:16 -0700 Message-ID: <50d22e0c-84b3-0678-eb06-30fb66fd24cf@quicinc.com> Date: Fri, 21 Apr 2023 16:25:15 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH v2 3/3] drm/msm/dpu: Pass catalog pointers directly from RM instead of IDs Content-Language: en-US To: Marijn Suijten , Rob Clark , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter CC: <~postmarketos/upstreaming@lists.sr.ht>, AngeloGioacchino Del Regno , Konrad Dybcio , Martin Botka , Jami Kettunen , Jordan Crouse , , , , References: <20230418-dpu-drop-useless-for-lookup-v2-0-acb08e82ef19@somainline.org> <20230418-dpu-drop-useless-for-lookup-v2-3-acb08e82ef19@somainline.org> From: Abhinav Kumar In-Reply-To: <20230418-dpu-drop-useless-for-lookup-v2-3-acb08e82ef19@somainline.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: 1IVxCeOGBIg5Mg6pf_XbadZAjZAzk-sK X-Proofpoint-ORIG-GUID: 1IVxCeOGBIg5Mg6pf_XbadZAjZAzk-sK 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-21_08,2023-04-21_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 mlxlogscore=897 phishscore=0 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304210205 X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On 4/21/2023 1:53 PM, Marijn Suijten wrote: > The Resource Manager already iterates over all available blocks from the > catalog, only to pass their ID to a dpu_hw_xxx_init() function which > uses an _xxx_offset() helper to search for and find the exact same > catalog pointer again to initialize the block with, fallible error > handling and all. > > Instead, pass const pointers to the catalog entries directly to these > _init functions and drop the for loops entirely, saving on both > readability complexity and unnecessary cycles at boot. > > Signed-off-by: Marijn Suijten > Reviewed-by: Dmitry Baryshkov Overall, a nice cleanup! One comment below. > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c | 37 +++++---------------- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h | 14 ++++---- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.c | 32 +++--------------- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dsc.h | 11 +++---- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c | 38 ++++----------------- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.h | 12 +++---- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 2 +- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 40 ++++++----------------- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h | 12 +++---- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c | 38 ++++----------------- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h | 10 +++--- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c | 33 +++---------------- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.h | 14 ++++---- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 33 +++---------------- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 14 ++++---- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 39 ++++------------------ > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 12 +++---- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.c | 33 +++---------------- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.h | 11 +++---- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c | 33 ++++--------------- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h | 11 +++---- > drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 17 +++++----- > drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 18 +++++----- > 23 files changed, 139 insertions(+), 375 deletions(-) > > -struct dpu_hw_intf *dpu_hw_intf_init(enum dpu_intf idx, > - void __iomem *addr, > - const struct dpu_mdss_cfg *m) > +struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg, > + void __iomem *addr) > { > struct dpu_hw_intf *c; > - const struct dpu_intf_cfg *cfg; > + > + if (cfg->type == INTF_NONE) { > + pr_err("Cannot create interface hw object for INTF_NONE type\n"); > + return ERR_PTR(-EINVAL); > + } The caller of dpu_hw_intf_init which is the RM already has protection for INTF_NONE, see below for (i = 0; i < cat->intf_count; i++) { struct dpu_hw_intf *hw; const struct dpu_intf_cfg *intf = &cat->intf[i]; if (intf->type == INTF_NONE) { DPU_DEBUG("skip intf %d with type none\n", i); continue; } if (intf->id < INTF_0 || intf->id >= INTF_MAX) { DPU_ERROR("skip intf %d with invalid id\n", intf->id); continue; } hw = dpu_hw_intf_init(intf->id, mmio, cat); So this part can be dropped. > > c = kzalloc(sizeof(*c), GFP_KERNEL); > if (!c) > return ERR_PTR(-ENOMEM); > > - cfg = _intf_offset(idx, m, addr, &c->hw); > - if (IS_ERR_OR_NULL(cfg)) { > - kfree(c); > - pr_err("failed to create dpu_hw_intf %d\n", idx); > - return ERR_PTR(-EINVAL); > - } > + c->hw.blk_addr = addr + cfg->base; > + c->hw.log_mask = DPU_DBG_MASK_INTF; >