[Patch RESEND 4/4] memory: tegra: make icc_set_bw return zero if BWMGR not supported

Sumit Gupta posted 4 patches 2 years, 7 months ago
[Patch RESEND 4/4] memory: tegra: make icc_set_bw return zero if BWMGR not supported
Posted by Sumit Gupta 2 years, 7 months ago
Return zero from icc_set_bw() to MC client driver if MRQ_BWMGR_INT
is not supported by the BPMP-FW. Currently, 'EINVAL' is returned
which causes error message in client drivers even when the platform
doesn't support scaling.

Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
 drivers/memory/tegra/tegra234.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c
index bc73be7fe143..07aba301a173 100644
--- a/drivers/memory/tegra/tegra234.c
+++ b/drivers/memory/tegra/tegra234.c
@@ -951,7 +951,7 @@ static int tegra234_mc_icc_set(struct icc_node *src, struct icc_node *dst)
 		return 0;
 
 	if (!mc->bwmgr_mrq_supported)
-		return -EINVAL;
+		return 0;
 
 	if (!mc->bpmp) {
 		dev_err(mc->dev, "BPMP reference NULL\n");
@@ -998,7 +998,7 @@ static int tegra234_mc_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
 	struct tegra_mc *mc = icc_provider_to_tegra_mc(p);
 
 	if (!mc->bwmgr_mrq_supported)
-		return -EINVAL;
+		return 0;
 
 	if (node->id == TEGRA_ICC_MC_CPU_CLUSTER0 ||
 	    node->id == TEGRA_ICC_MC_CPU_CLUSTER1 ||
-- 
2.17.1
Re: [Patch RESEND 4/4] memory: tegra: make icc_set_bw return zero if BWMGR not supported
Posted by Jon Hunter 2 years, 6 months ago
Hi Krzysztof,

On 21/06/2023 14:44, Sumit Gupta wrote:
> Return zero from icc_set_bw() to MC client driver if MRQ_BWMGR_INT
> is not supported by the BPMP-FW. Currently, 'EINVAL' is returned
> which causes error message in client drivers even when the platform
> doesn't support scaling.
> 
> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> ---
>   drivers/memory/tegra/tegra234.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c
> index bc73be7fe143..07aba301a173 100644
> --- a/drivers/memory/tegra/tegra234.c
> +++ b/drivers/memory/tegra/tegra234.c
> @@ -951,7 +951,7 @@ static int tegra234_mc_icc_set(struct icc_node *src, struct icc_node *dst)
>   		return 0;
>   
>   	if (!mc->bwmgr_mrq_supported)
> -		return -EINVAL;
> +		return 0;
>   
>   	if (!mc->bpmp) {
>   		dev_err(mc->dev, "BPMP reference NULL\n");
> @@ -998,7 +998,7 @@ static int tegra234_mc_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
>   	struct tegra_mc *mc = icc_provider_to_tegra_mc(p);
>   
>   	if (!mc->bwmgr_mrq_supported)
> -		return -EINVAL;
> +		return 0;
>   
>   	if (node->id == TEGRA_ICC_MC_CPU_CLUSTER0 ||
>   	    node->id == TEGRA_ICC_MC_CPU_CLUSTER1 ||


I have also found that this change is needed for Linux v6.5 in order to 
work with current BPMP firmware. Without this patch PCIe does not work 
on Tegra234. We should probably also add the following fixes tag for 
this patch ...

Fixes: 9365bf006f53 ("PCI: tegra194: Add interconnect support in Tegra234")

Thanks
Jon

-- 
nvpublic
Re: [Patch RESEND 4/4] memory: tegra: make icc_set_bw return zero if BWMGR not supported
Posted by Krzysztof Kozlowski 2 years, 6 months ago
On 25/07/2023 20:29, Jon Hunter wrote:
> Hi Krzysztof,
> 
> On 21/06/2023 14:44, Sumit Gupta wrote:
>> Return zero from icc_set_bw() to MC client driver if MRQ_BWMGR_INT
>> is not supported by the BPMP-FW. Currently, 'EINVAL' is returned
>> which causes error message in client drivers even when the platform
>> doesn't support scaling.
>>
>> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
>> ---
>>   drivers/memory/tegra/tegra234.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c
>> index bc73be7fe143..07aba301a173 100644
>> --- a/drivers/memory/tegra/tegra234.c
>> +++ b/drivers/memory/tegra/tegra234.c
>> @@ -951,7 +951,7 @@ static int tegra234_mc_icc_set(struct icc_node *src, struct icc_node *dst)
>>   		return 0;
>>   
>>   	if (!mc->bwmgr_mrq_supported)
>> -		return -EINVAL;
>> +		return 0;
>>   
>>   	if (!mc->bpmp) {
>>   		dev_err(mc->dev, "BPMP reference NULL\n");
>> @@ -998,7 +998,7 @@ static int tegra234_mc_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
>>   	struct tegra_mc *mc = icc_provider_to_tegra_mc(p);
>>   
>>   	if (!mc->bwmgr_mrq_supported)
>> -		return -EINVAL;
>> +		return 0;
>>   
>>   	if (node->id == TEGRA_ICC_MC_CPU_CLUSTER0 ||
>>   	    node->id == TEGRA_ICC_MC_CPU_CLUSTER1 ||
> 
> 
> I have also found that this change is needed for Linux v6.5 in order to 
> work with current BPMP firmware. Without this patch PCIe does not work 
> on Tegra234. We should probably also add the following fixes tag for 
> this patch ...
> 
> Fixes: 9365bf006f53 ("PCI: tegra194: Add interconnect support in Tegra234")

Thank you, I moved the commit to fixes branch. I hope other patches do
not depend on the order (it was part of the patchset as 3/4 commit).

Since I re-shuffled everything, I will send pull for current RC
tomorrow, not today.

Best regards,
Krzysztof
Re: [Patch RESEND 4/4] memory: tegra: make icc_set_bw return zero if BWMGR not supported
Posted by Thierry Reding 2 years, 6 months ago
On Wed, Jun 21, 2023 at 07:14:00PM +0530, Sumit Gupta wrote:
> Return zero from icc_set_bw() to MC client driver if MRQ_BWMGR_INT
> is not supported by the BPMP-FW. Currently, 'EINVAL' is returned
> which causes error message in client drivers even when the platform
> doesn't support scaling.
> 
> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> ---
>  drivers/memory/tegra/tegra234.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>