From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86D61C4338F for ; Thu, 12 Aug 2021 13:23:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D4DF60FC3 for ; Thu, 12 Aug 2021 13:23:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237689AbhHLNXZ (ORCPT ); Thu, 12 Aug 2021 09:23:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237681AbhHLNVg (ORCPT ); Thu, 12 Aug 2021 09:21:36 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D276FC00EA84 for ; Thu, 12 Aug 2021 06:21:10 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id h2so10538307lji.6 for ; Thu, 12 Aug 2021 06:21:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=yjZ/rfFZv9yz218MWmQe0cfR6IJjiAXfYaqScy1hjno=; b=rDTzdG/m/QTa4eJgPkUCeC5RJseS2Zz/fq9jOKWkTMSYWZhDlp5ftM4xgBhvpZg2qX 594bbYnY1UsoTYoLNbrTbeUCw+cl89ayOYwTIYijQzIfmc3SoMmE9/WIUHN4iPAONAGD WYhlVfjb7/6K5yHjV4TwHnSksm2/Rn5b0znQVgt9rBdm6RELohCx6lvsZFtbgI8vd3GW AVRZFaMmEP1phjpu04/2tqIDUxsMiX+ymd4RMngkSj1j+o3g0w3ygP/qM7Qv/6z6XH72 kIWDM6aThkLQMmFMGGJzISorgAKe+NhB5JmF+iB1aphytoo61l92ekbVL2uJw+vMCk3l MW7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=yjZ/rfFZv9yz218MWmQe0cfR6IJjiAXfYaqScy1hjno=; b=Tvyox6LmcmXOv3PYnH43yMt5fuh6PKpwoUqW2XmeNdgdy6bk0eGHBBKpZ5+90tr/kP rC/Zuo0Q4Fu+4L08MAnXz9IPp/Dws95DBERvmzxij0o6IPIXuEZOxOpFgzyktYSmJmB2 vh4KL2K3ArlvBKKhPEIZgmE8IPElBBVoxVZG8wINNAKMmYvOhOanC9eZMsPphDxAwPaM le/biYjFAKEEzpJ5a/hnlp3B61V9axcu7yTjgm1lTBfDoJWFWDIVUctHWIy7Y3GDxYQ6 ip4zUbZuU454xKwuPhRBRrYWaVRrCNkSY2w2FlSGAfAsE83J55SxxiBSY4PVbESj8C8p zL3A== X-Gm-Message-State: AOAM53129XKKduN+8kg6sPIk4/MTY9UpMR1tDJPUjEfLQlj4WM2Dpgjp dwzsy/yfVPnXVINidZIu7DLZVkU+TDp+fQ== X-Google-Smtp-Source: ABdhPJwD6ODMBgPaE5cXR1FoZjeCM22LtEudadyrDARL5mQ4ObYER8CTLSU8NPChYE4bmb94Mr+dBQ== X-Received: by 2002:a2e:a4d5:: with SMTP id p21mr2934156ljm.214.1628774468960; Thu, 12 Aug 2021 06:21:08 -0700 (PDT) Received: from [192.168.1.211] ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id c10sm262390lfb.136.2021.08.12.06.21.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Aug 2021 06:21:08 -0700 (PDT) Subject: Re: [RESEND PATCH 2/2] soc: qcom: rpmhpd: Make power_on actually enable the domain To: Bjorn Andersson , Andy Gross , Ulf Hansson , Stephen Boyd , Rajendra Nayak Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210703025449.2687201-1-bjorn.andersson@linaro.org> From: Dmitry Baryshkov Message-ID: <45bfb6ae-d131-10d7-1924-48c98a957667@linaro.org> Date: Thu, 12 Aug 2021 16:21:07 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210703025449.2687201-1-bjorn.andersson@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/07/2021 05:54, Bjorn Andersson wrote: > The general expectation is that powering on a power-domain should make > the power domain deliver some power, and if a specific performace state > is needed further requests has to be made. > > But in contrast with other power-domain implementations (e.g. rpmpd) the > RPMh does not have an interface to enable the power, so the driver has > to vote for a particular corner (performance level) in rpmh_power_on(). > > But the corner is never initialized, so a typical request to simply > enable the power domain would not actually turn on the hardware. Further > more, when no more clients vote for a performance state (i.e. the > aggregated vote is 0) the power domain would be turn off. > > Fix both of these issues by always voting for a corner with non-zero > value, when the power domain is enabled. > > The tracking of the lowest non-zero corner is performed to handle the > corner case if there's ever a domain with a non-zero lowest corner, in > which case both rpmh_power_on() and rpmh_rpmhpd_set_performance_state() > would be allowed to use this lowest corner. > > Fixes: 279b7e8a62cc ("soc: qcom: rpmhpd: Add RPMh power domain driver") > Signed-off-by: Bjorn Andersson > --- > > Resending because the hunk in rpmhpd_update_level_mapping() was left in the > index. So, colleagues, what is the fate of this patch? Is it going to be applied? Or we agree that current approach (power_on + set_performance_state) is the expected behaviour? My patches on gdsc rework depend on this patch, but I can rework in them in favour of required-opp approach. > > drivers/soc/qcom/rpmhpd.c | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > > diff --git a/drivers/soc/qcom/rpmhpd.c b/drivers/soc/qcom/rpmhpd.c > index fa209b479ab3..76ea6b053ef0 100644 > --- a/drivers/soc/qcom/rpmhpd.c > +++ b/drivers/soc/qcom/rpmhpd.c > @@ -30,6 +30,7 @@ > * @active_only: True if it represents an Active only peer > * @corner: current corner > * @active_corner: current active corner > + * @enable_corner: lowest non-zero corner > * @level: An array of level (vlvl) to corner (hlvl) mappings > * derived from cmd-db > * @level_count: Number of levels supported by the power domain. max > @@ -47,6 +48,7 @@ struct rpmhpd { > const bool active_only; > unsigned int corner; > unsigned int active_corner; > + unsigned int enable_corner; > u32 level[RPMH_ARC_MAX_LEVELS]; > size_t level_count; > bool enabled; > @@ -385,13 +387,13 @@ static int rpmhpd_aggregate_corner(struct rpmhpd *pd, unsigned int corner) > static int rpmhpd_power_on(struct generic_pm_domain *domain) > { > struct rpmhpd *pd = domain_to_rpmhpd(domain); > - int ret = 0; > + unsigned int corner; > + int ret; > > mutex_lock(&rpmhpd_lock); > > - if (pd->corner) > - ret = rpmhpd_aggregate_corner(pd, pd->corner); > - > + corner = max(pd->corner, pd->enable_corner); > + ret = rpmhpd_aggregate_corner(pd, corner); > if (!ret) > pd->enabled = true; > > @@ -436,6 +438,10 @@ static int rpmhpd_set_performance_state(struct generic_pm_domain *domain, > i--; > > if (pd->enabled) { > + /* Ensure that the domain isn't turn off */ > + if (i < pd->enable_corner) > + i = pd->enable_corner; > + > ret = rpmhpd_aggregate_corner(pd, i); > if (ret) > goto out; > @@ -472,6 +478,10 @@ static int rpmhpd_update_level_mapping(struct rpmhpd *rpmhpd) > for (i = 0; i < rpmhpd->level_count; i++) { > rpmhpd->level[i] = buf[i]; > > + /* Remember the first non-zero corner */ > + if (!rpmhpd->enable_corner) > + rpmhpd->enable_corner = i; > + > /* > * The AUX data may be zero padded. These 0 valued entries at > * the end of the map must be ignored. > -- With best wishes Dmitry