Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp578095ybm; Wed, 27 May 2020 02:50:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKnBqCF6hXKT9jRXzbq6iHYlPMzHaD/J2AKqB0thISoXyA3EgJa+8LuLyax5MQdSotgjbi X-Received: by 2002:a17:906:1d55:: with SMTP id o21mr4994772ejh.491.1590573045902; Wed, 27 May 2020 02:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590573045; cv=none; d=google.com; s=arc-20160816; b=F5dYQNcCzXLpaJDaonC1vQ9i2isVVWggQuTMCYTLs3GPakyuVdswjkfP3ihbBXj0fG xZABv0KUZ9vvD8QvvmnUS9L6wst5Gzu/dk59BXoKHZBqDtI/OiHMBpMG5N9yTcb7+6Ue Iq9+WxrJl1u9bvXhlF9C0UbYqhLdjrwrAf8yGv/P3xqstov5X6y5EL0sBSUUn1kH9xm5 2221cYwV7Jh/R93/jDjoGFp0xJaPyPSrzQd2rnPbBlN4nY5ZPSWYjG6upag+aDcvni54 UUVpmQom8x/CdFkzFZ+NQ39t8K2tms0KeppSrscgUszZpUEzzSMttCJOlswo0cq7Aa/S eyuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=c7mmaWIhliSekrXxz20ZW1Ppbz2gcfDYDdhA8q0rEGw=; b=X8jnCu+KSsGR8gNUgZPl0fQK3EgzyMIj6ELujCCrKpe1l3SVLw0lYoWKNCusHdcRYQ aDBbzL5rR1OuvFdUAOljpzd6pAMn9R3JpyMAjIDyru9IyCu7ZCah7Ha5wEpFK7xlwPD1 lB5QWsSwHZVed8gUh1KDvAxZt2meVxjHQHOX993JL/0DGH5pOj6Wj/eVPjttD6T2TUmG lamQyTEz378HWEgRcudEPXSvIWO9a7OVXxJYxJeDIiu4eYnml1d6GK9pn4v3fkj1Hre4 nl1ruhLmd/4Z6vL04tzI00ZN0eXiI57TGZ7lHx7Bk7re29c4F88YqBBZsOC6W/yumyVz 77gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WdYG8D0J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oy4si1579117ejb.433.2020.05.27.02.50.22; Wed, 27 May 2020 02:50:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WdYG8D0J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727993AbgE0EGE (ORCPT + 99 others); Wed, 27 May 2020 00:06:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725385AbgE0EGD (ORCPT ); Wed, 27 May 2020 00:06:03 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D972DC061A0F for ; Tue, 26 May 2020 21:06:03 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id s10so11175581pgm.0 for ; Tue, 26 May 2020 21:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=c7mmaWIhliSekrXxz20ZW1Ppbz2gcfDYDdhA8q0rEGw=; b=WdYG8D0JMfocNaSyB3kzR5gMVArCgT76OxP6MQ+pOzljOaoPmsxhznQi5FqWaStJFl lmTeWzYx5wPIgZAgg5ZFh1BQ4Yr9gqWGLEB7F4urpZ1Jnzq7IObLbhJNfUvMvWly+R+k uIzi49ZKS2aYnGejb8FjLfdye2J/j+BkLJZxdG64a0ETBYOjwhc09VIKUQESULFfdTCK G9S93Jd404+Mqzi2cpaNktkrpkuj2pKavzR+KPzN5uwVxxzBN/r8yWL1muX8SJ/54zJo H+yIYntYyYAwe+XkogvmXQcO5urNUSM7I1UFZ2l/b9ZS8OSJNlY6yxsp8jByejOISnvi ofqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=c7mmaWIhliSekrXxz20ZW1Ppbz2gcfDYDdhA8q0rEGw=; b=lBZcj1M3MJiCHmlOBgIh28CK8T+VHMzvzdzzZnT8BkGamwlJCUNbtvx7MtfVsCNv/K CeMj1SsGAeyZuCq2QrIbT3DMb0x2i8tdCVKKbuNJ/i0UXEJg2AibuwmgMrsmwXu9kzxD 85s6WlqE8XPvW1syhRdDhM4beUrJbkga8OiUUpX4kRaP96RfqqPv2tqhyYI0cOwa9e9X THcBk1Uf317d0lecYXoCKgcqqJNWE7qhr7SJF+udMPvjxwi7b0eUI065eyS7I2Lzvp5h nZPSxqmZxhIYoc7VoPiO2j0V60OX17KmrYxNx2sBMvOUZzxldeyGHYvXveW4fmYzFy3x OAsQ== X-Gm-Message-State: AOAM532fbaxcgO2Skmly77dtGj8i4dcStq2VcyiEBCbCcTbvOa8IQy7R lyjuY8CC3dvw3y4Rhq2JnTp5Iw== X-Received: by 2002:a63:8f46:: with SMTP id r6mr2123412pgn.257.1590552363359; Tue, 26 May 2020 21:06:03 -0700 (PDT) Received: from localhost ([122.172.60.59]) by smtp.gmail.com with ESMTPSA id m2sm798738pfe.141.2020.05.26.21.06.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 May 2020 21:06:01 -0700 (PDT) Date: Wed, 27 May 2020 09:35:59 +0530 From: Viresh Kumar To: Sibi Sankar Cc: sboyd@kernel.org, georgi.djakov@linaro.org, bjorn.andersson@linaro.org, saravanak@google.com, mka@chromium.org, nm@ti.com, agross@kernel.org, david.brown@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, rjw@rjwysocki.net, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dianders@chromium.org, vincent.guittot@linaro.org, amit.kucheria@linaro.org, ulf.hansson@linaro.org, lukasz.luba@arm.com, sudeep.holla@arm.com Subject: Re: [PATCH v4 06/12] cpufreq: qcom: Update the bandwidth levels on frequency change Message-ID: <20200527040559.5dryuxbf5ejzvpst@vireshk-i7> References: <20200504202243.5476-1-sibis@codeaurora.org> <20200504202243.5476-7-sibis@codeaurora.org> <20200505045012.zfx2e6chqo5f3e4n@vireshk-i7> <8fc5b72c9af6fd6a707a280cfc678677@codeaurora.org> <20200527035349.mrvvxeg3lqv53jm2@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200527035349.mrvvxeg3lqv53jm2@vireshk-i7> User-Agent: NeoMutt/20180716-391-311a52 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27-05-20, 09:23, Viresh Kumar wrote: > On 26-05-20, 23:18, Sibi Sankar wrote: > > https://patchwork.kernel.org/cover/11548479/ > > GPU driver uses Georgi's series > > for scaling and will need a way to > > remove the icc votes in the suspend > > path, (this looks like a pattern > > that might be used by other clients > > as well) I could probably update > > opp_set_bw to support removing bw > > when NULL opp is specified. Similarly > > opp_set_rate will need to support > > set bw to 0 when set_rate is passed > > 0 as target freq for the same use case. > > Sure, please send a patch for that. On a second thought, here is the patch. Please test it. -------------------------8<------------------------- Subject: [PATCH] opp: Remove bandwidth votes when target_freq is zero We already drop several votes when target_freq is set to zero, drop bandwidth votes as well. Reported-by: Sibi Sankar Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 47 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 56d3022c1ca2..0c259d5ed232 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -725,6 +725,34 @@ static int _generic_set_opp_regulator(struct opp_table *opp_table, return ret; } +static int _set_opp_bw(const struct opp_table *opp_table, + struct dev_pm_opp *opp, bool remove) +{ + u32 avg, peak; + int i, ret; + + if (!opp_table->paths) + return 0; + + for (i = 0; i < opp_table->path_count; i++) { + if (remove) { + avg = 0; + peak = 0; + } else { + avg = opp->bandwidth[i].avg; + peak = opp->bandwidth[i].peak; + } + ret = icc_set_bw(opp_table->paths[i], avg, peak); + if (ret) { + dev_err(dev, "Failed to %s bandwidth[%d]: %d\n", + remove ? "remove" : "set", i, ret); + retrun ret; + } + } + + return 0; +} + static int _set_opp_custom(const struct opp_table *opp_table, struct device *dev, unsigned long old_freq, unsigned long freq, @@ -837,12 +865,17 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) if (!_get_opp_count(opp_table)) return 0; - if (!opp_table->required_opp_tables && !opp_table->regulators) { + if (!opp_table->required_opp_tables && !opp_table->regulators && + !opp_table->paths) { dev_err(dev, "target frequency can't be 0\n"); ret = -EINVAL; goto put_opp_table; } + ret = _set_opp_bw(opp_table, opp, true); + if (ret) + return ret; + if (opp_table->regulator_enabled) { regulator_disable(opp_table->regulators[0]); opp_table->regulator_enabled = false; @@ -932,16 +965,8 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) dev_err(dev, "Failed to set required opps: %d\n", ret); } - if (!ret && opp_table->paths) { - for (i = 0; i < opp_table->path_count; i++) { - ret = icc_set_bw(opp_table->paths[i], - opp->bandwidth[i].avg, - opp->bandwidth[i].peak); - if (ret) - dev_err(dev, "Failed to set bandwidth[%d]: %d\n", - i, ret); - } - } + if (!ret) + ret = _set_opp_bw(opp_table, opp, false); put_opp: dev_pm_opp_put(opp);