Skip to contentSkip to conversation

clk: tegra: Support unique names for multi-socket platforms

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

Subsystems (3)
lore
Share & tools
lore

Jon Hunter

author maintainer
#0 lore raw

PATCH v2 1/1 clk: tegra: Support unique names for multi-socket platforms

On multi-socket platforms each socket has its own BPMP which exposes the same clock names. Fix this by using the NUMA ID as a prefix for the clock names on multi-socket platforms.

Use 'sizeof(info->name)' in the strscpy() and snprintf() functions to future proof against anyone changing the size of the 'name' array.

---
Changes since V1:
- Use NUMA ID as a prefix and not a suffix for the clock name.

 drivers/clk/tegra/clk-bpmp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-bpmp.c +9 -1
index f6d2b934228b..067a8555c4e7 100644
@@ -367,7 +367,15 @@ static int tegra_bpmp_clk_get_info(struct tegra_bpmp *bpmp, unsigned int id,
 	if (err < 0)
 		return err;
 
-	strscpy(info->name, response.name, MRQ_CLK_NAME_MAXLEN);
+	if (dev_to_node(bpmp->dev) == NUMA_NO_NODE) {
+		strscpy(info->name, response.name, sizeof(info->name));
+	} else {
+		err = snprintf(info->name, sizeof(info->name), "%d-%s",
+			       dev_to_node(bpmp->dev), response.name);
+		if (WARN_ON(err >= sizeof(info->name)))
+			return -E2BIG;
+	}
+
 	info->num_parents = response.num_parents;
 
 	for (i = 0; i < info->num_parents; i++)
Signature · 1 line
2.43.0
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Jon Hunter

On multi-socket platforms each socket has its own BPMP which exposes the same clock names. Fix this by using the NUMA ID as a prefix for the clock names on multi-socket platforms.

Use 'sizeof(info->name)' in the strscpy() and snprintf() functions to future proof against anyone changing the size of the 'name' array.

Quoted 6 lines

---
Changes since V1:
- Use NUMA ID as a prefix and not a suffix for the clock name.

 drivers/clk/tegra/clk-bpmp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
author maintainer
#2 lore raw

Hi Mike, Stephen,

Quoted 15 lines · Thierry Reding
Quoted 14 lines · Jon Hunter

On multi-socket platforms each socket has its own BPMP which exposes the same clock names. Fix this by using the NUMA ID as a prefix for the clock names on multi-socket platforms.

Use 'sizeof(info->name)' in the strscpy() and snprintf() functions to future proof against anyone changing the size of the 'name' array.

---
Changes since V1:
- Use NUMA ID as a prefix and not a suffix for the clock name.

Quoted 4 lines
Quoted 2 lines
  drivers/clk/tegra/clk-bpmp.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)

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
#3 lore raw

Hi Jon,

Quoted 16 lines · Jon Hunter
Quoted 15 lines · Thierry Reding
Quoted 14 lines · Jon Hunter

On multi-socket platforms each socket has its own BPMP which exposes the same clock names. Fix this by using the NUMA ID as a prefix for the clock names on multi-socket platforms.

Use 'sizeof(info->name)' in the strscpy() and snprintf() functions to future proof against anyone changing the size of the 'name' array.

---
Changes since V1:
- Use NUMA ID as a prefix and not a suffix for the clock name.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
  drivers/clk/tegra/clk-bpmp.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)

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

I made a pull for Stephen last week for various clk patches that were missed during the last merge window. I included your patch.

https://lore.kernel.org/linux-clk/[email protected]/

I'm going to collect up stuff at rc6 this development cycle and assemble another pull then.

Brian

author maintainer
#4 lore raw

Hi Brian,

Quoted 28 lines · Brian Masney

Hi Jon,

Quoted 16 lines · Jon Hunter
Quoted 15 lines · Thierry Reding
Quoted 14 lines · Jon Hunter

On multi-socket platforms each socket has its own BPMP which exposes the same clock names. Fix this by using the NUMA ID as a prefix for the clock names on multi-socket platforms.

Use 'sizeof(info->name)' in the strscpy() and snprintf() functions to future proof against anyone changing the size of the 'name' array.

---
Changes since V1:
- Use NUMA ID as a prefix and not a suffix for the clock name.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
   drivers/clk/tegra/clk-bpmp.c | 10 +++++++++-
   1 file changed, 9 insertions(+), 1 deletion(-)

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

Quoted 7 lines

I made a pull for Stephen last week for various clk patches that were missed during the last merge window. I included your patch.

https://lore.kernel.org/linux-clk/[email protected]/

I'm going to collect up stuff at rc6 this development cycle and assemble another pull then.

OK great! Thanks!

Jon

Signature · 1 line
nvpublic
Reviewed-by on v2 1/1
#5 lore raw
In reply to Jon Hunter
Quoted 10 lines · Jon Hunter

On multi-socket platforms each socket has its own BPMP which exposes the same clock names. Fix this by using the NUMA ID as a prefix for the clock names on multi-socket platforms.

Use 'sizeof(info->name)' in the strscpy() and snprintf() functions to future proof against anyone changing the size of the 'name' array.