Skip to contentSkip to conversation

pmdomain: tegra: Add support for multi-socket platforms

PATCH In review Jon Hunter 2 participants 3 messages Jun 2 – Jul 13

Subsystems (2)
lore
Share & tools
lore

Jon Hunter

author maintainer
#0 lore raw

PATCH v3 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.

Note the check for the NULL string is moved into the function tegra_bpmp_powergate_get_name(), because in the multi-socket case we must only add the prefix if we receive a valid name. A NULL string indicates that there is no valid powergate associated with the ID that is being queried.

---
Changes since V2:
- Moved the test for a NULL string to a common location that can be used for both single and multi-socket platforms.
Changes since V1:
- Use NUMA ID as a prefix and not a suffix for the powergate name.

 drivers/pmdomain/tegra/powergate-bpmp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/pmdomain/tegra/powergate-bpmp.c +8 -1
index 8cde4f384846..e6a7e025b012 100644
@@ -137,6 +137,13 @@ 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')
+		return NULL;
+
+	if (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);
 }
 
@@ -234,7 +241,7 @@ tegra_bpmp_probe_powergates(struct tegra_bpmp *bpmp,
 		struct tegra_powergate_info *info = &powergates[count];
 
 		info->name = tegra_bpmp_powergate_get_name(bpmp, id);
-		if (!info->name || info->name[0] == '\0') {
+		if (!info->name) {
 			num_holes++;
 			continue;
 		}
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

Hi Ulf,

Quoted 43 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.

Note the check for the NULL string is moved into the function tegra_bpmp_powergate_get_name(), because in the multi-socket case we must only add the prefix if we receive a valid name. A NULL string indicates that there is no valid powergate associated with the ID that is being queried.

---
Changes since V2:
- Moved the test for a NULL string to a common location that can be used for both single and multi-socket platforms.
Changes since V1:
- Use NUMA ID as a prefix and not a suffix for the powergate name.

  drivers/pmdomain/tegra/powergate-bpmp.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
drivers/pmdomain/tegra/powergate-bpmp.c +7 -0
index 8cde4f384846..e6a7e025b012 100644
@@ -137,6 +137,13 @@ 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')
+		return NULL;
+
+	if (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);
  }
 

drivers/pmdomain/tegra/powergate-bpmp.c tegra_bpmp_probe_powergates(struct tegra_bpmp *bpmp, · line 247

Quoted 8 lines
drivers/pmdomain/tegra/powergate-bpmp.c +1 -1
@@ -234,7 +241,7 @@ tegra_bpmp_probe_powergates(struct tegra_bpmp *bpmp,
  		struct tegra_powergate_info *info = &powergates[count];
 
  		info->name = tegra_bpmp_powergate_get_name(bpmp, id);
-		if (!info->name || info->name[0] == '\0') {
+		if (!info->name) {
  			num_holes++;
  			continue;
  		}

Please let me know if you have any comments on this or if this is OK to be picked up now?

Thanks
Jon

Signature · 1 line
nvpublic
#2 lore raw
In reply to Jon Hunter
Quoted 8 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.

Quoted 7 lines

Note the check for the NULL string is moved into the function tegra_bpmp_powergate_get_name(), because in the multi-socket case we must only add the prefix if we receive a valid name. A NULL string indicates that there is no valid powergate associated with the ID that is being queried.

Applied for next, thanks!

Kind regards
Uffe

Quoted 40 lines

---
Changes since V2:
- Moved the test for a NULL string to a common location that can be used for both single and multi-socket platforms.
Changes since V1:
- Use NUMA ID as a prefix and not a suffix for the powergate name.

 drivers/pmdomain/tegra/powergate-bpmp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/pmdomain/tegra/powergate-bpmp.c +8 -2
index 8cde4f384846..e6a7e025b012 100644
@@ -137,6 +137,13 @@ 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')
+               return NULL;
+
+       if (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);
 }
 
@@ -234,7 +241,7 @@ tegra_bpmp_probe_powergates(struct tegra_bpmp *bpmp,
                struct tegra_powergate_info *info = &powergates[count];
 
                info->name = tegra_bpmp_powergate_get_name(bpmp, id);
-               if (!info->name || info->name[0] == '\0') {
+               if (!info->name) {
                        num_holes++;
                        continue;
                }
--

2.43.0