[v2,2/2] memory: tegra: set BPMP msg flags to reset IPC channels

Message ID 20231009100557.18224-3-sumitg@nvidia.com
State New
Headers
Series Fix hang due to CPU BW request as BPMP suspended |

Commit Message

Sumit Gupta Oct. 9, 2023, 10:05 a.m. UTC
  From: Thierry Reding <treding@nvidia.com>

Set the 'TEGRA_BPMP_MESSAGE_RESET' bit in newly added 'flags' field
of 'struct tegra_bpmp_message' to request for the reset of BPMP IPC
channels. This is used along with the 'suspended' check in BPMP driver
for handling early bandwidth requests due to the hotplug of CPU's
during system resume before the driver gets resumed.

Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth")
Signed-off-by: Thierry Reding <treding@nvidia.com>
Co-developed-by: Sumit Gupta <sumitg@nvidia.com>
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
---
 drivers/memory/tegra/tegra234.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Thierry Reding Oct. 12, 2023, 11 a.m. UTC | #1
On Mon, Oct 09, 2023 at 03:35:57PM +0530, Sumit Gupta wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Set the 'TEGRA_BPMP_MESSAGE_RESET' bit in newly added 'flags' field
> of 'struct tegra_bpmp_message' to request for the reset of BPMP IPC
> channels. This is used along with the 'suspended' check in BPMP driver
> for handling early bandwidth requests due to the hotplug of CPU's
> during system resume before the driver gets resumed.
> 
> Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth")
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> Co-developed-by: Sumit Gupta <sumitg@nvidia.com>
> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> ---
>  drivers/memory/tegra/tegra234.c | 4 ++++
>  1 file changed, 4 insertions(+)

Krzysztof,

this one has a build-time dependency on patch 1/2, so it'd make sense
for me to pick this up into the Tegra tree along with patch 1/2. That
is slightly easier because I already have a BPMP patch in the tree.

There should be no conflict between this and the Tegra tree, though,
so if you feel strongly about it, you could also pick up both patches,
in which case:

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

> 
> diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c
> index 9e5b5dbd9c8d..2845041f32d6 100644
> --- a/drivers/memory/tegra/tegra234.c
> +++ b/drivers/memory/tegra/tegra234.c
> @@ -986,6 +986,10 @@ static int tegra234_mc_icc_set(struct icc_node *src, struct icc_node *dst)
>  	msg.rx.data = &bwmgr_resp;
>  	msg.rx.size = sizeof(bwmgr_resp);
>  
> +	if (pclient->bpmp_id >= TEGRA_ICC_BPMP_CPU_CLUSTER0 &&
> +	    pclient->bpmp_id <= TEGRA_ICC_BPMP_CPU_CLUSTER2)
> +		msg.flags = TEGRA_BPMP_MESSAGE_RESET;
> +
>  	ret = tegra_bpmp_transfer(mc->bpmp, &msg);
>  	if (ret < 0) {
>  		dev_err(mc->dev, "BPMP transfer failed: %d\n", ret);
> -- 
> 2.17.1
>
  
Krzysztof Kozlowski Oct. 12, 2023, 1:28 p.m. UTC | #2
On 09/10/2023 12:05, Sumit Gupta wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Set the 'TEGRA_BPMP_MESSAGE_RESET' bit in newly added 'flags' field
> of 'struct tegra_bpmp_message' to request for the reset of BPMP IPC
> channels. This is used along with the 'suspended' check in BPMP driver
> for handling early bandwidth requests due to the hotplug of CPU's
> during system resume before the driver gets resumed.
> 
> Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth")
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> Co-developed-by: Sumit Gupta <sumitg@nvidia.com>
> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>


Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
  
Krzysztof Kozlowski Oct. 12, 2023, 1:32 p.m. UTC | #3
On 12/10/2023 13:00, Thierry Reding wrote:
> On Mon, Oct 09, 2023 at 03:35:57PM +0530, Sumit Gupta wrote:
>> From: Thierry Reding <treding@nvidia.com>
>>
>> Set the 'TEGRA_BPMP_MESSAGE_RESET' bit in newly added 'flags' field
>> of 'struct tegra_bpmp_message' to request for the reset of BPMP IPC
>> channels. This is used along with the 'suspended' check in BPMP driver
>> for handling early bandwidth requests due to the hotplug of CPU's
>> during system resume before the driver gets resumed.
>>
>> Fixes: f41e1442ac5b ("cpufreq: tegra194: add OPP support and set bandwidth")
>> Signed-off-by: Thierry Reding <treding@nvidia.com>
>> Co-developed-by: Sumit Gupta <sumitg@nvidia.com>
>> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
>> ---
>>  drivers/memory/tegra/tegra234.c | 4 ++++
>>  1 file changed, 4 insertions(+)
> 
> Krzysztof,
> 
> this one has a build-time dependency on patch 1/2, so it'd make sense
> for me to pick this up into the Tegra tree along with patch 1/2. That
> is slightly easier because I already have a BPMP patch in the tree.

Sounds good.

Best regards,
Krzysztof
  

Patch

diff --git a/drivers/memory/tegra/tegra234.c b/drivers/memory/tegra/tegra234.c
index 9e5b5dbd9c8d..2845041f32d6 100644
--- a/drivers/memory/tegra/tegra234.c
+++ b/drivers/memory/tegra/tegra234.c
@@ -986,6 +986,10 @@  static int tegra234_mc_icc_set(struct icc_node *src, struct icc_node *dst)
 	msg.rx.data = &bwmgr_resp;
 	msg.rx.size = sizeof(bwmgr_resp);
 
+	if (pclient->bpmp_id >= TEGRA_ICC_BPMP_CPU_CLUSTER0 &&
+	    pclient->bpmp_id <= TEGRA_ICC_BPMP_CPU_CLUSTER2)
+		msg.flags = TEGRA_BPMP_MESSAGE_RESET;
+
 	ret = tegra_bpmp_transfer(mc->bpmp, &msg);
 	if (ret < 0) {
 		dev_err(mc->dev, "BPMP transfer failed: %d\n", ret);