Skip to contentSkip to conversation

riscv: Rework riscv_cpu_probe for current event macros

PATCH In review Tom Rini 4 participants 8 messages Sep 4, 2023 – Sep 6, 2023 RISC-V

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/2 riscv: Rework riscv_cpu_probe for current event macros

This function should now be a EVENT_SPY_SIMPLE call, update it.

---
 arch/riscv/cpu/cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/cpu/cpu.c +2 -2
index d64aa330f206..cfe9fdc9df55 100644
@@ -66,7 +66,7 @@ static inline bool supports_extension(char ext)
 #endif /* CONFIG_CPU */
 }
 
-static int riscv_cpu_probe(void *ctx, struct event *event)
+static int riscv_cpu_probe(void)
 {
 #ifdef CONFIG_CPU
 	int ret;
@@ -79,7 +79,7 @@ static int riscv_cpu_probe(void *ctx, struct event *event)
 
 	return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_R, riscv_cpu_probe);
 
 /*
  * This is called on secondary harts just after the IPI is init'd. Currently
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/2 riscv: Correct event usage for riscv_cpu_probe/setup

With having both an EVENT_SPY_SIMPLE setup for both riscv_cpu_probe and riscv_cpu_setup we do not need the latter function to call the former function as it will already have been done in time.

Fixes 1c55d62fb9cc ("riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback")

---
Cc: Rick Chen <[email protected]>
Cc: Leo Yu-Chi Liang <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Nikita Shubin <[email protected]>
Cc: Chanho Park <[email protected]>
Cc: Yu Chien Peter Lin <[email protected]>

---
 arch/riscv/cpu/cpu.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
arch/riscv/cpu/cpu.c +1 -5
index cfe9fdc9df55..c1a9638c1ab7 100644
@@ -94,11 +94,7 @@ static void dummy_pending_ipi_clear(ulong hart, ulong arg0, ulong arg1)
 
 int riscv_cpu_setup(void)
 {
-	int ret;
-
-	ret = riscv_cpu_probe(ctx, event);
-	if (ret)
-		return ret;
+	int __maybe_unused ret;
 
 	/* Enable FPU */
 	if (supports_extension('d') || supports_extension('f')) {
Signature · 1 line
2.34.1
Tested-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] riscv: Correct event usage for riscv_cpu_probe/setup

Quoted 6 lines · Tom Rini

With having both an EVENT_SPY_SIMPLE setup for both riscv_cpu_probe and riscv_cpu_setup we do not need the latter function to call the former function as it will already have been done in time.

Fixes 1c55d62fb9cc ("riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback")
Signed-off-by Tom Rini <trini at konsulko.com>
Quoted 31 lines

---
Cc: Rick Chen <rick at andestech.com>
Cc: Leo Yu-Chi Liang <ycliang at andestech.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Nikita Shubin <n.shubin at yadro.com>
Cc: Chanho Park <chanho61.park at samsung.com>
Cc: Yu Chien Peter Lin <peterlin at andestech.com>

---
 arch/riscv/cpu/cpu.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
arch/riscv/cpu/cpu.c +1 -5
index cfe9fdc9df55..c1a9638c1ab7 100644
@@ -94,11 +94,7 @@ static void dummy_pending_ipi_clear(ulong hart, ulong arg0, ulong arg1)
 
 int riscv_cpu_setup(void)
 {
-	int ret;
-
-	ret = riscv_cpu_probe(ctx, event);
-	if (ret)
-		return ret;
+	int __maybe_unused ret;
 
 	/* Enable FPU */
 	if (supports_extension('d') || supports_extension('f')) {
Signature · 1 line
2.34.1
#3 lore raw
In reply to Tom Rini

Hi Tom,

Quoted 21 lines · Tom Rini

This function should now be a EVENT_SPY_SIMPLE call, update it.

---
 arch/riscv/cpu/cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/cpu/cpu.c +1 -1
index d64aa330f206..cfe9fdc9df55 100644
@@ -66,7 +66,7 @@ static inline bool supports_extension(char ext)
 #endif /* CONFIG_CPU */
 }
 
-static int riscv_cpu_probe(void *ctx, struct event *event)
+static int riscv_cpu_probe(void)
 {
 #ifdef CONFIG_CPU
 	int ret;

arch/riscv/cpu/cpu.c static int riscv_cpu_probe(void *ctx, struct event *event) · line 82

Quoted 5 lines
arch/riscv/cpu/cpu.c +1 -1
@@ -79,7 +79,7 @@ static int riscv_cpu_probe(void *ctx, struct event *event)
 
 	return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_R, riscv_cpu_probe);

I cannot seem to find macro "EVENT_SPY_SIMPLE".
Is there anything that should be added?
Or did I miss anything?

Best regards,
Leo

Quoted 6 lines
arch/riscv/cpu/cpu.c +0 -0
 /*
  * This is called on secondary harts just after the IPI is init'd. Currently
Signature · 1 line
2.34.1
#4 lore raw
Quoted 25 lines · Leo Liang

Hi Tom,

Quoted 22 lines · Tom Rini

This function should now be a EVENT_SPY_SIMPLE call, update it.

---
  arch/riscv/cpu/cpu.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/cpu/cpu.c +1 -1
index d64aa330f206..cfe9fdc9df55 100644
@@ -66,7 +66,7 @@ static inline bool supports_extension(char ext)
  #endif /* CONFIG_CPU */
  }
 
-static int riscv_cpu_probe(void *ctx, struct event *event)
+static int riscv_cpu_probe(void)
  {
  #ifdef CONFIG_CPU
  	int ret;
@@ -79,7 +79,7 @@ static int riscv_cpu_probe(void *ctx, struct event *event)
 
Quoted 8 lines

arch/riscv/cpu/cpu.c static int riscv_cpu_probe(void *ctx, struct event *event) · line 82

Quoted 4 lines
arch/riscv/cpu/cpu.c +1 -1
  	return 0;
  }
-EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_R, riscv_cpu_probe);

I cannot seem to find macro "EVENT_SPY_SIMPLE".
Is there anything that should be added?
Or did I miss anything?

This patch is only applicable to origin/next. The definition there is in include/event.h:311.

#5 lore raw

Hi Heinrich,

Quoted 33 lines · Heinrich Schuchardt
Quoted 23 lines · Leo Liang

Hi Tom,

Quoted 20 lines · Tom Rini

This function should now be a EVENT_SPY_SIMPLE call, update it.

---
  arch/riscv/cpu/cpu.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/cpu/cpu.c +1 -1
index d64aa330f206..cfe9fdc9df55 100644
@@ -66,7 +66,7 @@ static inline bool supports_extension(char ext)
  #endif /* CONFIG_CPU */
  }
-static int riscv_cpu_probe(void *ctx, struct event *event)
+static int riscv_cpu_probe(void)
  {
  #ifdef CONFIG_CPU
  	int ret;
@@ -79,7 +79,7 @@ static int riscv_cpu_probe(void *ctx, struct event *event)
Quoted 8 lines

arch/riscv/cpu/cpu.c static int riscv_cpu_probe(void *ctx, struct event *event) · line 82

Quoted 4 lines
arch/riscv/cpu/cpu.c +1 -1
  	return 0;
  }
-EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_R, riscv_cpu_probe);

I cannot seem to find macro "EVENT_SPY_SIMPLE".
Is there anything that should be added?
Or did I miss anything?

Quoted 3 lines

This patch is only applicable to origin/next. The definition there is in include/event.h:311.

Thanks for the pointer!

Best regards,
Leo

Quoted 2 lines
Tested-by on v1 1/2
#6 lore raw
In reply to Tom Rini
Quoted 3 lines · Tom Rini

This function should now be a EVENT_SPY_SIMPLE call, update it.

Signed-off-by Tom Rini <trini at konsulko.com>
Quoted 29 lines
---
 arch/riscv/cpu/cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/cpu/cpu.c +2 -2
index d64aa330f206..cfe9fdc9df55 100644
@@ -66,7 +66,7 @@ static inline bool supports_extension(char ext)
 #endif /* CONFIG_CPU */
 }
 
-static int riscv_cpu_probe(void *ctx, struct event *event)
+static int riscv_cpu_probe(void)
 {
 #ifdef CONFIG_CPU
 	int ret;
@@ -79,7 +79,7 @@ static int riscv_cpu_probe(void *ctx, struct event *event)
 
 	return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_R, riscv_cpu_probe);
 
 /*
  * This is called on secondary harts just after the IPI is init'd. Currently
Signature · 1 line
2.34.1
author
#7 lore raw
In reply to Tom Rini
Quoted 3 lines · Tom Rini

This function should now be a EVENT_SPY_SIMPLE call, update it.

Applied to u-boot/next, thanks!

Signature · 1 line
Tom