Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2738012rwd; Fri, 16 Jun 2023 07:37:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6GOTiwpdLi1u8p13aV3mhbeTZJ4xCmK/WrkzSm+d+tPLWuCESL2g0yUnYSX3jeWscZWjbe X-Received: by 2002:a17:902:b786:b0:1b3:a667:45aa with SMTP id e6-20020a170902b78600b001b3a66745aamr1810148pls.34.1686926267172; Fri, 16 Jun 2023 07:37:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686926267; cv=none; d=google.com; s=arc-20160816; b=X9oDn20R+YcwLMK2U1RunpQOLgOOWY8pFZHv+IawCnvyg6tIO+Jt7nqkEbithXn/wU 5BpmbHUQkh4g/TdV8Rx0Wh77THZMLLr9nBlLvgv7MK4QZlWhu7B24XAGtwnIESOPKkJ3 jGQMGKmKdi7EKVZ+qnXbsra8oMaTiX3C1KJ2sTSB8XFo9vYkhDhRlLa9P9AnDH2xffn2 kQwgCytW612aLLAKvM82Bx6eZhl3nW7EiF86l7/X92Cq4LsM5l0p7UegzSH4x1bTvfb0 7zkMHRY4DVP5DvGrGpFBe5DfDx2ed/s8OOR7/FdqIDvrN+N4yT6WzMFTmeU1euvgM5+a x/gQ== 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:dkim-signature; bh=QRmknCCl0lyR6k6/V1KGpl6AoQ4ICI5UlwGTrZvz4To=; b=J4somdC2FocluTEWGlcKXquZ6EazATEgZ0d9yEvOPigHhbZGaOcOZPyECJpiNhX14m uGPEt2+bVIQW3zFIPJrmZNf9+LdpdsLBwTbEJd7OCPSadqWwUAJzf0veyke5Ng19FUT3 i061lJNqg0jXOZhNtYs6a1PG2QyMg1X0P7j9wK0HoOWV3QtPoC1e/ZaHywZx1fb+aj6y nmecrJtxMiUniBnryw4UsQbpvXDsrpxc27zMjJ4dUrijC41haQmP0/6ym/XLwOxfk+WM L8QUAhkPBeCheEatQcGAPSkcxf0L5dCEgvvUD1YvXrP0jciFBK/UZIUjjYc5fU6nI6yZ nkDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="pE/KKLIh"; 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 l1-20020a170902f68100b001ac5896c746si12171146plg.329.2023.06.16.07.37.31; Fri, 16 Jun 2023 07:37:47 -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="pE/KKLIh"; 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 S1345516AbjFPObw (ORCPT + 99 others); Fri, 16 Jun 2023 10:31:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345504AbjFPObu (ORCPT ); Fri, 16 Jun 2023 10:31:50 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4E9A30EA; Fri, 16 Jun 2023 07:31:49 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35GBxSw8010503; Fri, 16 Jun 2023 14:31:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=qcppdkim1; bh=QRmknCCl0lyR6k6/V1KGpl6AoQ4ICI5UlwGTrZvz4To=; b=pE/KKLIhPKKiLUJlYeVVT3elSWg1+23LzAmu9rP7A7hfsv94qgLKDm4RAIIhtBM7vNBy jLN8ZeuhyC/WdRYDLdsBX9HrNum99vyh6jIGdwhl+NxutJ3ApqrgXZisp7pDIFlJ7KN/ Cs6I/nl4Ninpl3uyX8HnZ/Jkb2lENFPUsp4P5qIqkf0QWfHlTwBfzC9bAcwZtS3xpzNy 2hYzhQRMD6eADIcCa24lEO5TOEl4UtHKR+1JTD/E2E5A34yYhO+4oYBmXc9Ma8AHMvX+ CkrvP7sH0uuZlrFe65SEPh3K38dNzKnI9rCFqHkMu/p3Or4huW5Ekq1S6WN/qEZhGY/g aw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3r8axuhm56-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 14:31:44 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35GEVhQ5016770 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 14:31:43 GMT Received: from hu-bjorande-lv.qualcomm.com (10.49.16.6) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Fri, 16 Jun 2023 07:31:42 -0700 Date: Fri, 16 Jun 2023 07:31:41 -0700 From: Bjorn Andersson To: Viresh Kumar CC: Bjorn Andersson , Viresh Kumar , Nishanth Menon , Stephen Boyd , , Vincent Guittot , "Rafael J. Wysocki" , Ulf Hansson , Subject: Re: [PATCH 1/2] OPP: pstate is only valid for genpd OPP tables Message-ID: <20230616143141.GA4034918@hu-bjorande-lv.qualcomm.com> References: <5437756c65c79f9520886bc54321d39c022c8638.1686739018.git.viresh.kumar@linaro.org> <20230616061830.fysc7l7jxymmhb3m@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20230616061830.fysc7l7jxymmhb3m@vireshk-i7> X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: AEyPOpUW9-w_HsjkonvDjZ9RZxiG1_M3 X-Proofpoint-GUID: AEyPOpUW9-w_HsjkonvDjZ9RZxiG1_M3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-16_08,2023-06-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 mlxscore=0 suspectscore=0 impostorscore=0 adultscore=0 bulkscore=0 priorityscore=1501 clxscore=1011 phishscore=0 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306160131 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Fri, Jun 16, 2023 at 11:48:30AM +0530, Viresh Kumar wrote: > On 15-06-23, 18:35, Bjorn Andersson wrote: > > On Wed, Jun 14, 2023 at 04:07:25PM +0530, Viresh Kumar wrote: > > > It is not very clear right now that the `pstate` field is only valid for > > > genpd OPP tables and not consumer tables. And there is no checking for > > > the same at various places. > > > > > > Add checks in place to verify that and make it clear to the reader. > > > > > > Signed-off-by: Viresh Kumar > > > --- > > > drivers/opp/core.c | 18 ++++++++++++++++-- > > > drivers/opp/debugfs.c | 4 +++- > > > drivers/opp/of.c | 6 ++++++ > > > 3 files changed, 25 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > > [..] > > > @@ -2686,6 +2694,12 @@ int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, > > > int dest_pstate = -EINVAL; > > > int i; > > > > > > + /* Both OPP tables must belong to genpds */ > > > + if (unlikely(!src_table->is_genpd || !dst_table->is_genpd)) { > > > > I have a platform_device, with a required-opps and with an associated > > genpd which does not implement set_performance_state(), but its parent > > genpd does. > > > > This results in me arriving here with src_table of NULL, and boom... > > > > > > Looking at the very next statement in this function, it seems arriving > > here without src_table was valid up until this change. > > Fixed as: > > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > index 48ddd72d2c71..3f46e499d615 100644 > --- a/drivers/opp/core.c > +++ b/drivers/opp/core.c > @@ -2694,12 +2694,6 @@ int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, > int dest_pstate = -EINVAL; > int i; > > - /* Both OPP tables must belong to genpds */ > - if (unlikely(!src_table->is_genpd || !dst_table->is_genpd)) { > - pr_err("%s: Performance state is only valid for genpds.\n", __func__); > - return -EINVAL; > - } > - > /* > * Normally the src_table will have the "required_opps" property set to > * point to one of the OPPs in the dst_table, but in some cases the > @@ -2710,6 +2704,12 @@ int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, > if (!src_table || !src_table->required_opp_count) > return pstate; > > + /* Both OPP tables must belong to genpds */ > + if (unlikely(!src_table->is_genpd || !dst_table->is_genpd)) { > + pr_err("%s: Performance state is only valid for genpds.\n", __func__); > + return -EINVAL; > + } > + > /* required-opps not fully initialized yet */ > if (lazy_linking_pending(src_table)) > return -EBUSY; > > Thanks. > Looks good, thanks for the quick response. Reviewed-by: Bjorn Andersson Tested-by: Bjorn Andersson Regards, Bjorn