Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2593860ybb; Mon, 30 Mar 2020 09:08:05 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvE9mrX1As0cBHzP3jdMaCN4Y/yRxA+PCMYv3nC4DafJ/w5vd0qnCaOrgezWOt2sKl4Vp63 X-Received: by 2002:aca:3983:: with SMTP id g125mr33163oia.13.1585584485614; Mon, 30 Mar 2020 09:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585584485; cv=none; d=google.com; s=arc-20160816; b=jlyO4Kq/Y3cSz8b9xlorZShV8lIpTvImn6pJXlm2Yimd7sSlGjBgLNjVwL2TqHwWFA V4p/pIJDQndPnW7SiKkpAEzz39oGIJTBjkULAUL4RhizxsLceWIBLZL4fC5jPKFiaKQa 8qg5G2f37e0RZ0lkD+jO9TzQQUjlnIgaHpBY/+x6z+jS8zLZM4ptATVYuB+UKSwBbo0w sg7iYaGJsZ/ZcBbN5vZYuhXi/ndtvREKNS6GbuPFEx1A/gLRze+nwPieUr8vx95sct4N yBlk+RQZnbRIpAoyeS2cRnRmoThMJUeKnOr8revqgd24y864c3+Ov0euolIe0blv2Gkv 3D1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5bpA+uRoS/xe1TwgteXV8ewe8pRcRq8994ynAclRq9k=; b=UkBUCuR1/6VEC63wP1wRKL8kYRg9tJRze+cjvDLAhO5J5xzQKcvop0OEh7gvHJkker roqXZyyIo2R0DqvGkkftYlC5CYCNTXYVd4yEFR4cDGbL3CnVgaus8fNJ8obrrD8b7Y7T iH6uDYef5m7C5uFmr1E4/zFdHcrus3giY5BJm+Y3y1NSjOAe/V/BnKHInecaEhr3yXQQ CdmiWVzxOfvKcZ8ZaaKmhhHCWpjGR53IAHwsehGbd7Go7s8l6d/tQKYSv1zgV/r9gAvg adQ9c90k0p5wemIBvtSx9Y6s/gjUUJ0NU8mnL96Q0XCtDA25M5aYX0h8BJLjKf8qBjwd MY8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zg0kJwvi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id z13si5504667oix.27.2020.03.30.09.07.49; Mon, 30 Mar 2020 09:08:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zg0kJwvi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729827AbgC3QG0 (ORCPT + 99 others); Mon, 30 Mar 2020 12:06:26 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:36108 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728579AbgC3QG0 (ORCPT ); Mon, 30 Mar 2020 12:06:26 -0400 Received: by mail-io1-f68.google.com with SMTP id n10so4273947iom.3 for ; Mon, 30 Mar 2020 09:06:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5bpA+uRoS/xe1TwgteXV8ewe8pRcRq8994ynAclRq9k=; b=zg0kJwviZ8ywmhJ/+iqExvFo0kWah9E2N2+mhaTXVOgTvy87nxb7qU7388NFfwtXQ2 bWeD+H2L4fCMWBLgSrZOsSXl/rYZpAKNWBwYp8J/eEKHFEZbRvH4sTApiipPE1lq3FYb PPBLHdDGqr6+gKTCUWKUhrjNgaDXvQIQYTIv25Wg0j6dbGRsUlO0xF10kxSb/dGOygYv cOxNRn3RGedI+dwnAghT8fL3OrexhcJifX1pMjyyuBPccb/NvFuTEw5kTjGSsgGxSyIE zUsTbRqcM2ZDj7xm7Nu/m0KP/l6SgeD3nQSvVLv8ZCm9AOGB6xoQEfTyA79gd/OWejlC uitA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5bpA+uRoS/xe1TwgteXV8ewe8pRcRq8994ynAclRq9k=; b=d8iO2QqyJLPPOCWOekYTGRRFOIxg91J/ESq/ZW72qcfji/p8zc8NazBIRSHbtcb1wc AcVw0sLqM5m+mSrVTVpGqj3oARxOcasoS/ylB2SQ3O7Qpwio4iwywMN05lrfcCtS5oDY o+6QsMe58lu+2/zWDw+Tf4nZhfkaO/AYlJysAx0AdsK9Ux5R+vKyyZC/t2Ia4Lk0XHv8 qFCUdekTbDJIOPDGc4BfTnCF4XWLfjTuPu6y6dzKzaS0ZSBLEuBzYcqxwgzXAAqJ79Pa /fHeNe4JW9VBs6CxgYMJ7q/uZ0ygnpuvSCXKIx50NMyPZd3prP/UuhWViEbHEfLxmW1P 0JvA== X-Gm-Message-State: ANhLgQ1OYrh3+5/bMOJMygCdUAzD4IpLK18ugIf85hCfVI9S5rV1txDy HBfgbfmqE3uLdY4oQBpV3GTu3zjH0egfZsHiiTKvd6ES5xo= X-Received: by 2002:a02:a1c2:: with SMTP id o2mr11273993jah.98.1585584385286; Mon, 30 Mar 2020 09:06:25 -0700 (PDT) MIME-Version: 1.0 References: <1585357147-4616-1-git-send-email-rishabhb@codeaurora.org> In-Reply-To: <1585357147-4616-1-git-send-email-rishabhb@codeaurora.org> From: Mathieu Poirier Date: Mon, 30 Mar 2020 10:06:12 -0600 Message-ID: Subject: Re: [PATCH 1/2] remoteproc: qcom: Add bus scaling capability during bootup To: Rishabh Bhatnagar Cc: Linux Kernel Mailing List , linux-remoteproc , Bjorn Andersson , psodagud@codeaurora.org, tsoni@codeaurora.org, Siddharth Gupta Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rishabh, On Fri, 27 Mar 2020 at 18:59, Rishabh Bhatnagar wrote: > > During bootup since remote processors cannot request for > additional bus bandwidth from the interconect framework, > platform driver should provide the proxy resources. This > is useful for scenarios where the Q6 tries to access the DDR > memory in the initial stages of bootup. For e.g. during > bootup or after recovery modem Q6 tries to zero out the bss > section in the DDR. Since this is a big chunk of memory if > don't bump up the bandwidth we might encounter timeout issues. > This patch makes a proxy vote for maximizing the bus bandwidth > during bootup and removes it once processor is up. > > Signed-off-by: Rishabh Bhatnagar The title of this patch contains "[PATCH 1/2]" but only one patch was sent to the linux-remoteproc mailing list. Is this a mistake and this is a stand alone patch or another patch did not reach the list? Thanks, Mathieu > --- > drivers/remoteproc/qcom_q6v5_pas.c | 43 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c > index edf9d0e..8f5db8d 100644 > --- a/drivers/remoteproc/qcom_q6v5_pas.c > +++ b/drivers/remoteproc/qcom_q6v5_pas.c > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -28,6 +29,9 @@ > #include "qcom_q6v5.h" > #include "remoteproc_internal.h" > > +#define PIL_TZ_AVG_BW 0 > +#define PIL_TZ_PEAK_BW UINT_MAX > + > struct adsp_data { > int crash_reason_smem; > const char *firmware_name; > @@ -62,6 +66,7 @@ struct qcom_adsp { > int proxy_pd_count; > > int pas_id; > + struct icc_path *bus_client; > int crash_reason_smem; > bool has_aggre2_clk; > > @@ -124,6 +129,25 @@ static int adsp_load(struct rproc *rproc, const struct firmware *fw) > > } > > +static int do_bus_scaling(struct qcom_adsp *adsp, bool enable) > +{ > + int rc; > + u32 avg_bw = enable ? PIL_TZ_AVG_BW : 0; > + u32 peak_bw = enable ? PIL_TZ_PEAK_BW : 0; > + > + if (adsp->bus_client) { > + rc = icc_set_bw(adsp->bus_client, avg_bw, peak_bw); > + if (rc) { > + dev_err(adsp->dev, "bandwidth request failed(rc:%d)\n", > + rc); > + return rc; > + } > + } else > + dev_info(adsp->dev, "Bus scaling not setup for %s\n", > + adsp->rproc->name); > + return 0; > +} > + > static int adsp_start(struct rproc *rproc) > { > struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv; > @@ -131,9 +155,13 @@ static int adsp_start(struct rproc *rproc) > > qcom_q6v5_prepare(&adsp->q6v5); > > + ret = do_bus_scaling(adsp, true); > + if (ret) > + goto disable_irqs; > + > ret = adsp_pds_enable(adsp, adsp->active_pds, adsp->active_pd_count); > if (ret < 0) > - goto disable_irqs; > + goto unscale_bus; > > ret = adsp_pds_enable(adsp, adsp->proxy_pds, adsp->proxy_pd_count); > if (ret < 0) > @@ -183,6 +211,8 @@ static int adsp_start(struct rproc *rproc) > adsp_pds_disable(adsp, adsp->proxy_pds, adsp->proxy_pd_count); > disable_active_pds: > adsp_pds_disable(adsp, adsp->active_pds, adsp->active_pd_count); > +unscale_bus: > + do_bus_scaling(adsp, false); > disable_irqs: > qcom_q6v5_unprepare(&adsp->q6v5); > > @@ -198,6 +228,7 @@ static void qcom_pas_handover(struct qcom_q6v5 *q6v5) > clk_disable_unprepare(adsp->aggre2_clk); > clk_disable_unprepare(adsp->xo); > adsp_pds_disable(adsp, adsp->proxy_pds, adsp->proxy_pd_count); > + do_bus_scaling(adsp, false); > } > > static int adsp_stop(struct rproc *rproc) > @@ -280,6 +311,14 @@ static int adsp_init_regulator(struct qcom_adsp *adsp) > return PTR_ERR_OR_ZERO(adsp->px_supply); > } > > +static void adsp_init_bus_scaling(struct qcom_adsp *adsp) > +{ > + adsp->bus_client = of_icc_get(adsp->dev, NULL); > + if (!adsp->bus_client) > + dev_warn(adsp->dev, "%s: unable to get bus client \n", > + __func__); > +} > + > static int adsp_pds_attach(struct device *dev, struct device **devs, > char **pd_names) > { > @@ -410,6 +449,8 @@ static int adsp_probe(struct platform_device *pdev) > if (ret) > goto free_rproc; > > + adsp_init_bus_scaling(adsp); > + > ret = adsp_pds_attach(&pdev->dev, adsp->active_pds, > desc->active_pd_names); > if (ret < 0) > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project