pmdomain: tegra: Add support for multi-socket platforms
Subsystems (2)
Jon Hunter
maintainerPATCH v2 1/1 pmdomain: tegra: Add support for multi-socket platforms
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.
---
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(+)
drivers/pmdomain/tegra/powergate-bpmp.c +5 -0
@@ -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 ); }
Signature · 1 line
2.43.0
Thierry Reding
maintainerQuoted 20 lines · 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 <[email protected]>---
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(+)drivers/pmdomain/tegra/powergate-bpmp.c +0
-0
drivers/pmdomain/tegra/powergate-bpmp.c static char *tegra_bpmp_powergate_get_name(struct tegra_bpmp *bpmp, · line 145
Quoted 9 lines
drivers/pmdomain/tegra/powergate-bpmp.c +5
-0@@ -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
Jon Hunter
maintainerQuoted 24 lines · Thierry Reding
Quoted 23 lines · 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 <[email protected]>---
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(+)drivers/pmdomain/tegra/powergate-bpmp.c +0
-0@@ -137,6 +137,11 @@ static char *tegra_bpmp_powergate_get_name(struct tegra_bpmp *bpmp,if (err <0 || msg.rx.ret <0 )return NULL ;
Quoted 10 lines
drivers/pmdomain/tegra/powergate-bpmp.c static char *tegra_bpmp_powergate_get_name(struct tegra_bpmp *bpmp, · line 145
Quoted 6 lines
drivers/pmdomain/tegra/powergate-bpmp.c +5
-0+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.
Quoted 6 lines
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
Signature · 1 line
nvpublic