linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Mikko Perttunen <mperttunen@nvidia.com>
Cc: rafael@kernel.org, thierry.reding@gmail.com,
	jonathanh@nvidia.com, krzysztof.kozlowski@canonical.com,
	lorenzo.pieralisi@arm.com, robh@kernel.org, kw@linux.com,
	p.zabel@pengutronix.de, rui.zhang@intel.com,
	daniel.lezcano@linaro.org, amitk@kernel.org,
	linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH 4/5] cpufreq: tegra186/tegra194: Handle errors in BPMP response
Date: Mon, 4 Oct 2021 12:31:45 +0530	[thread overview]
Message-ID: <20211004070145.pp3rafkinffk2pyh@vireshk-i7> (raw)
In-Reply-To: <20210915085517.1669675-4-mperttunen@nvidia.com>

On 15-09-21, 11:55, Mikko Perttunen wrote:
> The return value from tegra_bpmp_transfer indicates the success or
> failure of the IPC transaction with BPMP. If the transaction
> succeeded, we also need to check the actual command's result code.
> Add code to do this.
> 
> While at it, explicitly handle missing CPU clusters, which can
> occur on floorswept chips. This worked before as well, but
> possibly only by accident.
> 
> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
> ---
>  drivers/cpufreq/tegra186-cpufreq.c | 4 ++++
>  drivers/cpufreq/tegra194-cpufreq.c | 8 +++++++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/tegra186-cpufreq.c b/drivers/cpufreq/tegra186-cpufreq.c
> index 5d1943e787b0..6c88827f4e62 100644
> --- a/drivers/cpufreq/tegra186-cpufreq.c
> +++ b/drivers/cpufreq/tegra186-cpufreq.c
> @@ -159,6 +159,10 @@ static struct cpufreq_frequency_table *init_vhint_table(
>  		table = ERR_PTR(err);
>  		goto free;
>  	}
> +	if (msg.rx.ret) {
> +		table = ERR_PTR(-EINVAL);
> +		goto free;
> +	}
>  
>  	for (i = data->vfloor; i <= data->vceil; i++) {
>  		u16 ndiv = data->ndiv[i];
> diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
> index a9620e4489ae..ac381db25dbe 100644
> --- a/drivers/cpufreq/tegra194-cpufreq.c
> +++ b/drivers/cpufreq/tegra194-cpufreq.c
> @@ -242,7 +242,7 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
>  
>  	smp_call_function_single(policy->cpu, get_cpu_cluster, &cl, true);
>  
> -	if (cl >= data->num_clusters)
> +	if (cl >= data->num_clusters || !data->tables[cl])
>  		return -EINVAL;
>  
>  	/* set same policy for all cpus in a cluster */
> @@ -310,6 +310,12 @@ init_freq_table(struct platform_device *pdev, struct tegra_bpmp *bpmp,
>  	err = tegra_bpmp_transfer(bpmp, &msg);
>  	if (err)
>  		return ERR_PTR(err);
> +	if (msg.rx.ret == -BPMP_EINVAL) {
> +		/* Cluster not available */
> +		return NULL;
> +	}
> +	if (msg.rx.ret)
> +		return ERR_PTR(-EINVAL);
>  
>  	/*
>  	 * Make sure frequency table step is a multiple of mdiv to match

Applied. Thanks.

-- 
viresh

  parent reply	other threads:[~2021-10-04  7:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15  8:55 [PATCH 1/5] thermal: tegra-bpmp: Handle errors in BPMP response Mikko Perttunen
2021-09-15  8:55 ` [PATCH 2/5] reset: " Mikko Perttunen
2021-10-05  9:55   ` Philipp Zabel
2021-10-28 11:54   ` Jon Hunter
2021-11-02 13:10     ` Philipp Zabel
2021-11-12 11:30       ` Jon Hunter
2021-09-15  8:55 ` [PATCH 3/5] memory: tegra186-emc: " Mikko Perttunen
2021-09-20  8:34   ` (subset) " Krzysztof Kozlowski
2021-09-15  8:55 ` [PATCH 4/5] cpufreq: tegra186/tegra194: " Mikko Perttunen
2021-10-04  6:37   ` Viresh Kumar
2021-10-04  6:51     ` Mikko Perttunen
2021-10-04  7:01   ` Viresh Kumar [this message]
2021-10-04  7:02     ` Mikko Perttunen
2021-09-15  8:55 ` [PATCH 5/5] PCI: tegra194: " Mikko Perttunen
2021-10-07 18:21   ` Thierry Reding
2021-10-13 12:59     ` Lorenzo Pieralisi
2021-11-29 12:19       ` Lorenzo Pieralisi
2022-02-03 12:22         ` Lorenzo Pieralisi
2021-10-07 18:20 ` [PATCH 1/5] thermal: tegra-bpmp: " Thierry Reding
2022-02-25 12:22   ` Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211004070145.pp3rafkinffk2pyh@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mperttunen@nvidia.com \
    --cc=p.zabel@pengutronix.de \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).