* [PATCH V2] pmdomain: tegra: Add support for multi-socket platforms
@ 2026-06-02 8:39 Jon Hunter
2026-06-02 11:59 ` Thierry Reding
0 siblings, 1 reply; 3+ messages in thread
From: Jon Hunter @ 2026-06-02 8:39 UTC (permalink / raw)
To: Ulf Hansson, Thierry Reding; +Cc: linux-pm, linux-tegra, Jon Hunter
On multi-socket platforms each socket has its own BPMP that is
registered with the kernel. For such platforms prefix the NUMA ID for
each socket to the BPMP powergate name to ensure there is a unique name
for each power-domain. Note that we only add the NUMA ID for powergates
that return a valid name because an invalid name indicates that the
powergate ID is not supported.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
Changes since V1:
- Use NUMA ID as a prefix and not a suffix for the powergate name.
drivers/pmdomain/tegra/powergate-bpmp.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/pmdomain/tegra/powergate-bpmp.c b/drivers/pmdomain/tegra/powergate-bpmp.c
index 8cde4f384846..5e869b0eb96e 100644
--- a/drivers/pmdomain/tegra/powergate-bpmp.c
+++ b/drivers/pmdomain/tegra/powergate-bpmp.c
@@ -137,6 +137,11 @@ static char *tegra_bpmp_powergate_get_name(struct tegra_bpmp *bpmp,
if (err < 0 || msg.rx.ret < 0)
return NULL;
+ if (response.get_name.name[0] != '\0' &&
+ dev_to_node(bpmp->dev) != NUMA_NO_NODE)
+ return kasprintf(GFP_KERNEL, "%d-%s", dev_to_node(bpmp->dev),
+ response.get_name.name);
+
return kstrdup(response.get_name.name, GFP_KERNEL);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] pmdomain: tegra: Add support for multi-socket platforms
2026-06-02 8:39 [PATCH V2] pmdomain: tegra: Add support for multi-socket platforms Jon Hunter
@ 2026-06-02 11:59 ` Thierry Reding
2026-06-02 13:39 ` Jon Hunter
0 siblings, 1 reply; 3+ messages in thread
From: Thierry Reding @ 2026-06-02 11:59 UTC (permalink / raw)
To: Jon Hunter; +Cc: Ulf Hansson, linux-pm, linux-tegra
[-- Attachment #1: Type: text/plain, Size: 1951 bytes --]
On Tue, Jun 02, 2026 at 09:39:59AM +0100, Jon Hunter wrote:
> On multi-socket platforms each socket has its own BPMP that is
> registered with the kernel. For such platforms prefix the NUMA ID for
> each socket to the BPMP powergate name to ensure there is a unique name
> for each power-domain. Note that we only add the NUMA ID for powergates
> that return a valid name because an invalid name indicates that the
> powergate ID is not supported.
>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
> Changes since V1:
> - Use NUMA ID as a prefix and not a suffix for the powergate name.
>
> drivers/pmdomain/tegra/powergate-bpmp.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/pmdomain/tegra/powergate-bpmp.c b/drivers/pmdomain/tegra/powergate-bpmp.c
> index 8cde4f384846..5e869b0eb96e 100644
> --- a/drivers/pmdomain/tegra/powergate-bpmp.c
> +++ b/drivers/pmdomain/tegra/powergate-bpmp.c
> @@ -137,6 +137,11 @@ static char *tegra_bpmp_powergate_get_name(struct tegra_bpmp *bpmp,
> if (err < 0 || msg.rx.ret < 0)
> return NULL;
>
> + if (response.get_name.name[0] != '\0' &&
> + dev_to_node(bpmp->dev) != NUMA_NO_NODE)
> + return kasprintf(GFP_KERNEL, "%d-%s", dev_to_node(bpmp->dev),
> + response.get_name.name);
> +
> return kstrdup(response.get_name.name, GFP_KERNEL);
Why are we not checking response.get_name.name for the empty string in
the single socket case? Or the other way around: why is this important
for multi-socket if it isn't for single socket?
Looking at the caller of this function, it will check for this case
itself, so I'm thinking we should rework that as part of this patch and
simply return NULL early for both cases when name[0] == '\0'. That way
the caller is simplified and we get a bit more consistency in this
function. It is going to make for a slightly bigger diff, but I think
overall it'd be an improvement.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] pmdomain: tegra: Add support for multi-socket platforms
2026-06-02 11:59 ` Thierry Reding
@ 2026-06-02 13:39 ` Jon Hunter
0 siblings, 0 replies; 3+ messages in thread
From: Jon Hunter @ 2026-06-02 13:39 UTC (permalink / raw)
To: Thierry Reding; +Cc: Ulf Hansson, linux-pm, linux-tegra
On 02/06/2026 12:59, Thierry Reding wrote:
> On Tue, Jun 02, 2026 at 09:39:59AM +0100, Jon Hunter wrote:
>> On multi-socket platforms each socket has its own BPMP that is
>> registered with the kernel. For such platforms prefix the NUMA ID for
>> each socket to the BPMP powergate name to ensure there is a unique name
>> for each power-domain. Note that we only add the NUMA ID for powergates
>> that return a valid name because an invalid name indicates that the
>> powergate ID is not supported.
>>
>> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
>> ---
>> Changes since V1:
>> - Use NUMA ID as a prefix and not a suffix for the powergate name.
>>
>> drivers/pmdomain/tegra/powergate-bpmp.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/pmdomain/tegra/powergate-bpmp.c b/drivers/pmdomain/tegra/powergate-bpmp.c
>> index 8cde4f384846..5e869b0eb96e 100644
>> --- a/drivers/pmdomain/tegra/powergate-bpmp.c
>> +++ b/drivers/pmdomain/tegra/powergate-bpmp.c
>> @@ -137,6 +137,11 @@ static char *tegra_bpmp_powergate_get_name(struct tegra_bpmp *bpmp,
>> if (err < 0 || msg.rx.ret < 0)
>> return NULL;
>>
>> + if (response.get_name.name[0] != '\0' &&
>> + dev_to_node(bpmp->dev) != NUMA_NO_NODE)
>> + return kasprintf(GFP_KERNEL, "%d-%s", dev_to_node(bpmp->dev),
>> + response.get_name.name);
>> +
>> return kstrdup(response.get_name.name, GFP_KERNEL);
>
> Why are we not checking response.get_name.name for the empty string in
> the single socket case? Or the other way around: why is this important
> for multi-socket if it isn't for single socket?
Simply because we don't want to return a valid string such as '0-' or
'1-' for the case where we received a NULL terminated string. The caller
would interpret the name '0-' being valid when it is not.
> Looking at the caller of this function, it will check for this case
> itself, so I'm thinking we should rework that as part of this patch and
> simply return NULL early for both cases when name[0] == '\0'. That way
> the caller is simplified and we get a bit more consistency in this
> function. It is going to make for a slightly bigger diff, but I think
> overall it'd be an improvement.
Yes I agree that would be better and then just check for '\0' in one
place. OK I will send an update.
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-02 13:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02 8:39 [PATCH V2] pmdomain: tegra: Add support for multi-socket platforms Jon Hunter
2026-06-02 11:59 ` Thierry Reding
2026-06-02 13:39 ` Jon Hunter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox