* [PATCH v2 0/2] introduce EVT_DM_POST_INIT_R to fix VF2 boot fail [not found] <CGME20230818052645epcas2p47dad71943937119bbfe3652d178d769d@epcas2p4.samsung.com> @ 2023-08-18 5:11 ` Chanho Park 2023-08-18 5:11 ` [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type Chanho Park 2023-08-18 5:11 ` [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback Chanho Park 0 siblings, 2 replies; 12+ messages in thread From: Chanho Park @ 2023-08-18 5:11 UTC (permalink / raw) To: Simon Glass, Rick Chen, Leo, u-boot; +Cc: Chanho Park Since the Patch 55171aedda88, VisionFive2 booting has been broken [1]. VisionFive2 board requires to enable CONFIG_TIMER_EARLY but booting went to panic from initr_dm_devices due to lack of a timer device. - Error logs initcall sequence 00000000fffd8d38 failed at call 00000000402185e4 (err=-19) We can reproduce it on Qemu Sifive HiFive Unleashed emulation[2] after enabling CONFIG_TIMER_EARLY manually. As suggested by Simon[3], we can address this by adding EVT_DM_POST_INIT_R event and it's spy-callback function. Changes from v1: - Add EVT_DM_POST_INIT_R event type and emit it after relocation - Make riscv_cpu_probe as the callback of EVT_DM_POST_INIT_R [1]: https://lists.denx.de/pipermail/u-boot/2023-June/521220.html [2]: https://www.qemu.org/docs/master/system/riscv/sifive_u.html#running-u-boot [3]: https://lore.kernel.org/u-boot/CAPnjgZ2PbHVY_WLVq7XCd-HYKKwoh8R3LGXfOo7S6Sbvj0+ETA@mail.gmail.com/ Chanho Park (2): dm: event: add EVT_DM_POST_INIT_R event type riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback arch/riscv/cpu/cpu.c | 11 +++-------- drivers/core/root.c | 6 ++++-- include/event.h | 1 + 3 files changed, 8 insertions(+), 10 deletions(-) -- 2.39.2 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type 2023-08-18 5:11 ` [PATCH v2 0/2] introduce EVT_DM_POST_INIT_R to fix VF2 boot fail Chanho Park @ 2023-08-18 5:11 ` Chanho Park 2023-08-19 11:01 ` Milan P. Stanić ` (3 more replies) 2023-08-18 5:11 ` [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback Chanho Park 1 sibling, 4 replies; 12+ messages in thread From: Chanho Park @ 2023-08-18 5:11 UTC (permalink / raw) To: Simon Glass, Rick Chen, Leo, u-boot; +Cc: Chanho Park, Bin Meng This patch introduces EVT_DM_POST_INIT_R event type for handling hooks after relocation. Fixes: 55171aedda88 ("dm: Emit the arch_cpu_init_dm() even only before relocation") Suggested-by: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Chanho Park <chanho61.park@samsung.com> --- drivers/core/root.c | 6 ++++-- include/event.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/core/root.c b/drivers/core/root.c index 6775fb0b6575..79d871ab291a 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -436,8 +436,10 @@ int dm_init_and_scan(bool pre_reloc_only) return ret; } } - if (CONFIG_IS_ENABLED(DM_EVENT) && !(gd->flags & GD_FLG_RELOC)) { - ret = event_notify_null(EVT_DM_POST_INIT_F); + if (CONFIG_IS_ENABLED(DM_EVENT)) { + ret = event_notify_null(gd->flags & GD_FLG_RELOC ? + EVT_DM_POST_INIT_R : + EVT_DM_POST_INIT_F); if (ret) return log_msg_ret("ev", ret); } diff --git a/include/event.h b/include/event.h index daf44bf8a83b..bb38ba98e73b 100644 --- a/include/event.h +++ b/include/event.h @@ -24,6 +24,7 @@ enum event_t { /* Events related to driver model */ EVT_DM_POST_INIT_F, + EVT_DM_POST_INIT_R, EVT_DM_PRE_PROBE, EVT_DM_POST_PROBE, EVT_DM_PRE_REMOVE, -- 2.39.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type 2023-08-18 5:11 ` [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type Chanho Park @ 2023-08-19 11:01 ` Milan P. Stanić 2023-08-19 20:44 ` Simon Glass ` (2 subsequent siblings) 3 siblings, 0 replies; 12+ messages in thread From: Milan P. Stanić @ 2023-08-19 11:01 UTC (permalink / raw) To: Chanho Park; +Cc: u-boot It works. On Fri, 2023-08-18 at 14:11, Chanho Park wrote: > This patch introduces EVT_DM_POST_INIT_R event type for handling hooks > after relocation. > > Fixes: 55171aedda88 ("dm: Emit the arch_cpu_init_dm() even only before relocation") > Suggested-by: Simon Glass <sjg at chromium.org> > Cc: Bin Meng <bmeng.cn at gmail.com> > Signed-off-by: Chanho Park <chanho61.park at samsung.com> Tested-by: Milan P. Stanić <mps@arvanta.net> > --- > drivers/core/root.c | 6 ++++-- > include/event.h | 1 + > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/core/root.c b/drivers/core/root.c > index 6775fb0b6575..79d871ab291a 100644 > --- a/drivers/core/root.c > +++ b/drivers/core/root.c > @@ -436,8 +436,10 @@ int dm_init_and_scan(bool pre_reloc_only) > return ret; > } > } > - if (CONFIG_IS_ENABLED(DM_EVENT) && !(gd->flags & GD_FLG_RELOC)) { > - ret = event_notify_null(EVT_DM_POST_INIT_F); > + if (CONFIG_IS_ENABLED(DM_EVENT)) { > + ret = event_notify_null(gd->flags & GD_FLG_RELOC ? > + EVT_DM_POST_INIT_R : > + EVT_DM_POST_INIT_F); > if (ret) > return log_msg_ret("ev", ret); > } > diff --git a/include/event.h b/include/event.h > index daf44bf8a83b..bb38ba98e73b 100644 > --- a/include/event.h > +++ b/include/event.h > @@ -24,6 +24,7 @@ enum event_t { > > /* Events related to driver model */ > EVT_DM_POST_INIT_F, > + EVT_DM_POST_INIT_R, > EVT_DM_PRE_PROBE, > EVT_DM_POST_PROBE, > EVT_DM_PRE_REMOVE, > -- > 2.39.2 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type 2023-08-18 5:11 ` [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type Chanho Park 2023-08-19 11:01 ` Milan P. Stanić @ 2023-08-19 20:44 ` Simon Glass 2023-08-21 17:59 ` Roland Ruckerbauer 2023-08-21 18:05 ` [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type (resend) Roland Ruckerbauer 3 siblings, 0 replies; 12+ messages in thread From: Simon Glass @ 2023-08-19 20:44 UTC (permalink / raw) To: Chanho Park; +Cc: Rick Chen, Leo, u-boot, Bin Meng On Thu, 17 Aug 2023 at 23:26, Chanho Park <chanho61.park@samsung.com> wrote: > > This patch introduces EVT_DM_POST_INIT_R event type for handling hooks > after relocation. > > Fixes: 55171aedda88 ("dm: Emit the arch_cpu_init_dm() even only before relocation") > Suggested-by: Simon Glass <sjg@chromium.org> > Cc: Bin Meng <bmeng.cn@gmail.com> > Signed-off-by: Chanho Park <chanho61.park@samsung.com> > --- > drivers/core/root.c | 6 ++++-- > include/event.h | 1 + > 2 files changed, 5 insertions(+), 2 deletions(-) > Reviewed-by: Simon Glass <sjg@chromium.org> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type 2023-08-18 5:11 ` [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type Chanho Park 2023-08-19 11:01 ` Milan P. Stanić 2023-08-19 20:44 ` Simon Glass @ 2023-08-21 17:59 ` Roland Ruckerbauer 2023-08-23 13:36 ` Simon Glass 2023-08-21 18:05 ` [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type (resend) Roland Ruckerbauer 3 siblings, 1 reply; 12+ messages in thread From: Roland Ruckerbauer @ 2023-08-21 17:59 UTC (permalink / raw) To: Chanho Park; +Cc: u-boot Tested on visionfive2 board, it works. Thanks for taking a look into this. On 18.08.23 07:11, Chanho Park wrote: > This patch introduces EVT_DM_POST_INIT_R event type for handling hooks > after relocation. > > Fixes: 55171aedda88 ("dm: Emit the arch_cpu_init_dm() even only before relocation") > Suggested-by: Simon Glass <sjg@chromium.org> > Cc: Bin Meng <bmeng.cn@gmail.com> > Signed-off-by: Chanho Park <chanho61.park@samsung.com> Tested-by: Roland Ruckerbauer <mail@ruabmbua.dev> > --- > drivers/core/root.c | 6 ++++-- > include/event.h | 1 + > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/core/root.c b/drivers/core/root.c > index 6775fb0b6575..79d871ab291a 100644 > --- a/drivers/core/root.c > +++ b/drivers/core/root.c > @@ -436,8 +436,10 @@ int dm_init_and_scan(bool pre_reloc_only) > return ret; > } > } > - if (CONFIG_IS_ENABLED(DM_EVENT) && !(gd->flags & GD_FLG_RELOC)) { > - ret = event_notify_null(EVT_DM_POST_INIT_F); > + if (CONFIG_IS_ENABLED(DM_EVENT)) { > + ret = event_notify_null(gd->flags & GD_FLG_RELOC ? > + EVT_DM_POST_INIT_R : > + EVT_DM_POST_INIT_F); > if (ret) > return log_msg_ret("ev", ret); > } > diff --git a/include/event.h b/include/event.h > index daf44bf8a83b..bb38ba98e73b 100644 > --- a/include/event.h > +++ b/include/event.h > @@ -24,6 +24,7 @@ enum event_t { > > /* Events related to driver model */ > EVT_DM_POST_INIT_F, > + EVT_DM_POST_INIT_R, > EVT_DM_PRE_PROBE, > EVT_DM_POST_PROBE, > EVT_DM_PRE_REMOVE, ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type 2023-08-21 17:59 ` Roland Ruckerbauer @ 2023-08-23 13:36 ` Simon Glass 0 siblings, 0 replies; 12+ messages in thread From: Simon Glass @ 2023-08-23 13:36 UTC (permalink / raw) To: Roland Ruckerbauer; +Cc: Chanho Park, u-boot On Mon, 21 Aug 2023 at 21:47, Roland Ruckerbauer <roland@rucky.eu> wrote: > > Tested on visionfive2 board, it works. Thanks for taking a look into this. > > On 18.08.23 07:11, Chanho Park wrote: > > This patch introduces EVT_DM_POST_INIT_R event type for handling hooks > > after relocation. > > > > Fixes: 55171aedda88 ("dm: Emit the arch_cpu_init_dm() even only before relocation") > > Suggested-by: Simon Glass <sjg@chromium.org> > > Cc: Bin Meng <bmeng.cn@gmail.com> > > Signed-off-by: Chanho Park <chanho61.park@samsung.com> > > Tested-by: Roland Ruckerbauer <mail@ruabmbua.dev> > > > --- > > drivers/core/root.c | 6 ++++-- > > include/event.h | 1 + > > 2 files changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/core/root.c b/drivers/core/root.c > > index 6775fb0b6575..79d871ab291a 100644 > > --- a/drivers/core/root.c > > +++ b/drivers/core/root.c > > @@ -436,8 +436,10 @@ int dm_init_and_scan(bool pre_reloc_only) > > return ret; > > } > > } > > - if (CONFIG_IS_ENABLED(DM_EVENT) && !(gd->flags & GD_FLG_RELOC)) { > > - ret = event_notify_null(EVT_DM_POST_INIT_F); > > + if (CONFIG_IS_ENABLED(DM_EVENT)) { > > + ret = event_notify_null(gd->flags & GD_FLG_RELOC ? > > + EVT_DM_POST_INIT_R : > > + EVT_DM_POST_INIT_F); > > if (ret) > > return log_msg_ret("ev", ret); > > } > > diff --git a/include/event.h b/include/event.h > > index daf44bf8a83b..bb38ba98e73b 100644 > > --- a/include/event.h > > +++ b/include/event.h > > @@ -24,6 +24,7 @@ enum event_t { > > > > /* Events related to driver model */ > > EVT_DM_POST_INIT_F, > > + EVT_DM_POST_INIT_R, > > EVT_DM_PRE_PROBE, > > EVT_DM_POST_PROBE, > > EVT_DM_PRE_REMOVE, Applied to u-boot-dm, thanks! ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type (resend) 2023-08-18 5:11 ` [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type Chanho Park ` (2 preceding siblings ...) 2023-08-21 17:59 ` Roland Ruckerbauer @ 2023-08-21 18:05 ` Roland Ruckerbauer 3 siblings, 0 replies; 12+ messages in thread From: Roland Ruckerbauer @ 2023-08-21 18:05 UTC (permalink / raw) To: Chanho Park; +Cc: u-boot Tested on visionfive2 board, it works. Thanks for taking a look into this. On 18.08.23 07:11, Chanho Park wrote: > This patch introduces EVT_DM_POST_INIT_R event type for handling hooks > after relocation. > > Fixes: 55171aedda88 ("dm: Emit the arch_cpu_init_dm() even only before > relocation") > Suggested-by: Simon Glass <sjg@chromium.org> > Cc: Bin Meng <bmeng.cn@gmail.com> > Signed-off-by: Chanho Park <chanho61.park@samsung.com> Tested-by: Roland Ruckerbauer <mail@ruabmbua.dev> > --- > drivers/core/root.c | 6 ++++-- > include/event.h | 1 + > 2 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/core/root.c b/drivers/core/root.c > index 6775fb0b6575..79d871ab291a 100644 > --- a/drivers/core/root.c > +++ b/drivers/core/root.c > @@ -436,8 +436,10 @@ int dm_init_and_scan(bool pre_reloc_only) > return ret; > } > } > - if (CONFIG_IS_ENABLED(DM_EVENT) && !(gd->flags & GD_FLG_RELOC)) { > - ret = event_notify_null(EVT_DM_POST_INIT_F); > + if (CONFIG_IS_ENABLED(DM_EVENT)) { > + ret = event_notify_null(gd->flags & GD_FLG_RELOC ? > + EVT_DM_POST_INIT_R : > + EVT_DM_POST_INIT_F); > if (ret) > return log_msg_ret("ev", ret); > } > diff --git a/include/event.h b/include/event.h > index daf44bf8a83b..bb38ba98e73b 100644 > --- a/include/event.h > +++ b/include/event.h > @@ -24,6 +24,7 @@ enum event_t { > /* Events related to driver model */ > EVT_DM_POST_INIT_F, > + EVT_DM_POST_INIT_R, > EVT_DM_PRE_PROBE, > EVT_DM_POST_PROBE, > EVT_DM_PRE_REMOVE, ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback 2023-08-18 5:11 ` [PATCH v2 0/2] introduce EVT_DM_POST_INIT_R to fix VF2 boot fail Chanho Park 2023-08-18 5:11 ` [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type Chanho Park @ 2023-08-18 5:11 ` Chanho Park 2023-08-19 11:04 ` Milan P. Stanić ` (3 more replies) 1 sibling, 4 replies; 12+ messages in thread From: Chanho Park @ 2023-08-18 5:11 UTC (permalink / raw) To: Simon Glass, Rick Chen, Leo, u-boot; +Cc: Chanho Park, Bin Meng Since the Patch 55171aedda88, VisionFive2 booting has been broken [1]. VisionFive2 board requires to enable CONFIG_TIMER_EARLY but booting went to panic from initr_dm_devices due to lack of a timer device. - Error logs initcall sequence 00000000fffd8d38 failed at call 00000000402185e4 (err=-19) Thus, we need to move riscv_cpu_probe function in order to register the timer earlier than initr_dm_devices. Fixes: 7fe32b3442f0 ("event: Convert arch_cpu_init_dm() to use events") Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Chanho Park <chanho61.park@samsung.com> --- arch/riscv/cpu/cpu.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c index ecfb1fb08c4b..0b4208e72199 100644 --- a/arch/riscv/cpu/cpu.c +++ b/arch/riscv/cpu/cpu.c @@ -66,7 +66,7 @@ static inline bool supports_extension(char ext) #endif /* CONFIG_CPU */ } -static int riscv_cpu_probe(void) +static int riscv_cpu_probe(void *ctx, struct event *event) { #ifdef CONFIG_CPU int ret; @@ -79,6 +79,7 @@ static int riscv_cpu_probe(void) return 0; } +EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe); /* * This is called on secondary harts just after the IPI is init'd. Currently @@ -95,7 +96,7 @@ int riscv_cpu_setup(void *ctx, struct event *event) { int ret; - ret = riscv_cpu_probe(); + ret = riscv_cpu_probe(ctx, event); if (ret) return ret; @@ -149,12 +150,6 @@ EVENT_SPY(EVT_DM_POST_INIT_F, riscv_cpu_setup); int arch_early_init_r(void) { - int ret; - - ret = riscv_cpu_probe(); - if (ret) - return ret; - if (IS_ENABLED(CONFIG_SYSRESET_SBI)) device_bind_driver(gd->dm_root, "sbi-sysreset", "sbi-sysreset", NULL); -- 2.39.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback 2023-08-18 5:11 ` [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback Chanho Park @ 2023-08-19 11:04 ` Milan P. Stanić 2023-08-21 18:02 ` Roland Ruckerbauer ` (2 subsequent siblings) 3 siblings, 0 replies; 12+ messages in thread From: Milan P. Stanić @ 2023-08-19 11:04 UTC (permalink / raw) To: Chanho Park; +Cc: u-boot It works. On Fri, 2023-08-18 at 14:11, Chanho Park wrote: > Since the Patch 55171aedda88, VisionFive2 booting has been broken [1]. > VisionFive2 board requires to enable CONFIG_TIMER_EARLY but booting went > to panic from initr_dm_devices due to lack of a timer device. > > - Error logs > initcall sequence 00000000fffd8d38 failed at call 00000000402185e4 > (err=-19) > > Thus, we need to move riscv_cpu_probe function in order to register > the timer earlier than initr_dm_devices. > > Fixes: 7fe32b3442f0 ("event: Convert arch_cpu_init_dm() to use events") > Cc: Simon Glass <sjg at chromium.org> > Cc: Bin Meng <bmeng.cn at gmail.com> > Signed-off-by: Chanho Park <chanho61.park at samsung.com> Tested-by: Milan P. Stanić <mps@arvanta.net> > --- > arch/riscv/cpu/cpu.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c > index ecfb1fb08c4b..0b4208e72199 100644 > --- a/arch/riscv/cpu/cpu.c > +++ b/arch/riscv/cpu/cpu.c > @@ -66,7 +66,7 @@ static inline bool supports_extension(char ext) > #endif /* CONFIG_CPU */ > } > > -static int riscv_cpu_probe(void) > +static int riscv_cpu_probe(void *ctx, struct event *event) > { > #ifdef CONFIG_CPU > int ret; > @@ -79,6 +79,7 @@ static int riscv_cpu_probe(void) > > return 0; > } > +EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe); > > /* > * This is called on secondary harts just after the IPI is init'd. Currently > @@ -95,7 +96,7 @@ int riscv_cpu_setup(void *ctx, struct event *event) > { > int ret; > > - ret = riscv_cpu_probe(); > + ret = riscv_cpu_probe(ctx, event); > if (ret) > return ret; > > @@ -149,12 +150,6 @@ EVENT_SPY(EVT_DM_POST_INIT_F, riscv_cpu_setup); > > int arch_early_init_r(void) > { > - int ret; > - > - ret = riscv_cpu_probe(); > - if (ret) > - return ret; > - > if (IS_ENABLED(CONFIG_SYSRESET_SBI)) > device_bind_driver(gd->dm_root, "sbi-sysreset", > "sbi-sysreset", NULL); > -- > 2.39.2 > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback 2023-08-18 5:11 ` [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback Chanho Park 2023-08-19 11:04 ` Milan P. Stanić @ 2023-08-21 18:02 ` Roland Ruckerbauer 2023-08-21 18:06 ` [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback (resend) Roland Ruckerbauer 2023-08-23 13:36 ` [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback Simon Glass 3 siblings, 0 replies; 12+ messages in thread From: Roland Ruckerbauer @ 2023-08-21 18:02 UTC (permalink / raw) To: Chanho Park; +Cc: u-boot Tested on visionfive2, it works. On 18.08.23 07:11, Chanho Park wrote: > Since the Patch 55171aedda88, VisionFive2 booting has been broken [1]. > VisionFive2 board requires to enable CONFIG_TIMER_EARLY but booting went > to panic from initr_dm_devices due to lack of a timer device. > > - Error logs > initcall sequence 00000000fffd8d38 failed at call 00000000402185e4 > (err=-19) > > Thus, we need to move riscv_cpu_probe function in order to register > the timer earlier than initr_dm_devices. > > Fixes: 7fe32b3442f0 ("event: Convert arch_cpu_init_dm() to use events") > Cc: Simon Glass <sjg@chromium.org> > Cc: Bin Meng <bmeng.cn@gmail.com> > Signed-off-by: Chanho Park <chanho61.park@samsung.com> Tested-by: Roland Ruckerbauer <mail@ruabmbua.dev> > --- > arch/riscv/cpu/cpu.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c > index ecfb1fb08c4b..0b4208e72199 100644 > --- a/arch/riscv/cpu/cpu.c > +++ b/arch/riscv/cpu/cpu.c > @@ -66,7 +66,7 @@ static inline bool supports_extension(char ext) > #endif /* CONFIG_CPU */ > } > > -static int riscv_cpu_probe(void) > +static int riscv_cpu_probe(void *ctx, struct event *event) > { > #ifdef CONFIG_CPU > int ret; > @@ -79,6 +79,7 @@ static int riscv_cpu_probe(void) > > return 0; > } > +EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe); > > /* > * This is called on secondary harts just after the IPI is init'd. Currently > @@ -95,7 +96,7 @@ int riscv_cpu_setup(void *ctx, struct event *event) > { > int ret; > > - ret = riscv_cpu_probe(); > + ret = riscv_cpu_probe(ctx, event); > if (ret) > return ret; > > @@ -149,12 +150,6 @@ EVENT_SPY(EVT_DM_POST_INIT_F, riscv_cpu_setup); > > int arch_early_init_r(void) > { > - int ret; > - > - ret = riscv_cpu_probe(); > - if (ret) > - return ret; > - > if (IS_ENABLED(CONFIG_SYSRESET_SBI)) > device_bind_driver(gd->dm_root, "sbi-sysreset", > "sbi-sysreset", NULL); ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback (resend) 2023-08-18 5:11 ` [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback Chanho Park 2023-08-19 11:04 ` Milan P. Stanić 2023-08-21 18:02 ` Roland Ruckerbauer @ 2023-08-21 18:06 ` Roland Ruckerbauer 2023-08-23 13:36 ` [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback Simon Glass 3 siblings, 0 replies; 12+ messages in thread From: Roland Ruckerbauer @ 2023-08-21 18:06 UTC (permalink / raw) To: Chanho Park; +Cc: u-boot Tested on visionfive2, it works. On 18.08.23 07:11, Chanho Park wrote: > Since the Patch 55171aedda88, VisionFive2 booting has been broken [1]. > VisionFive2 board requires to enable CONFIG_TIMER_EARLY but booting went > to panic from initr_dm_devices due to lack of a timer device. > > - Error logs > initcall sequence 00000000fffd8d38 failed at call 00000000402185e4 > (err=-19) > > Thus, we need to move riscv_cpu_probe function in order to register > the timer earlier than initr_dm_devices. > > Fixes: 7fe32b3442f0 ("event: Convert arch_cpu_init_dm() to use events") > Cc: Simon Glass <sjg@chromium.org> > Cc: Bin Meng <bmeng.cn@gmail.com> > Signed-off-by: Chanho Park <chanho61.park@samsung.com> Tested-by: Roland Ruckerbauer <mail@ruabmbua.dev> > --- > arch/riscv/cpu/cpu.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c > index ecfb1fb08c4b..0b4208e72199 100644 > --- a/arch/riscv/cpu/cpu.c > +++ b/arch/riscv/cpu/cpu.c > @@ -66,7 +66,7 @@ static inline bool supports_extension(char ext) > #endif /* CONFIG_CPU */ > } > -static int riscv_cpu_probe(void) > +static int riscv_cpu_probe(void *ctx, struct event *event) > { > #ifdef CONFIG_CPU > int ret; > @@ -79,6 +79,7 @@ static int riscv_cpu_probe(void) > return 0; > } > +EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe); > /* > * This is called on secondary harts just after the IPI is init'd. > Currently > @@ -95,7 +96,7 @@ int riscv_cpu_setup(void *ctx, struct event *event) > { > int ret; > - ret = riscv_cpu_probe(); > + ret = riscv_cpu_probe(ctx, event); > if (ret) > return ret; > @@ -149,12 +150,6 @@ EVENT_SPY(EVT_DM_POST_INIT_F, riscv_cpu_setup); > int arch_early_init_r(void) > { > - int ret; > - > - ret = riscv_cpu_probe(); > - if (ret) > - return ret; > - > if (IS_ENABLED(CONFIG_SYSRESET_SBI)) > device_bind_driver(gd->dm_root, "sbi-sysreset", > "sbi-sysreset", NULL); ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback 2023-08-18 5:11 ` [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback Chanho Park ` (2 preceding siblings ...) 2023-08-21 18:06 ` [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback (resend) Roland Ruckerbauer @ 2023-08-23 13:36 ` Simon Glass 3 siblings, 0 replies; 12+ messages in thread From: Simon Glass @ 2023-08-23 13:36 UTC (permalink / raw) To: Chanho Park; +Cc: Rick Chen, Leo, u-boot, Bin Meng On Thu, 17 Aug 2023 at 23:26, Chanho Park <chanho61.park@samsung.com> wrote: > > Since the Patch 55171aedda88, VisionFive2 booting has been broken [1]. > VisionFive2 board requires to enable CONFIG_TIMER_EARLY but booting went > to panic from initr_dm_devices due to lack of a timer device. > > - Error logs > initcall sequence 00000000fffd8d38 failed at call 00000000402185e4 > (err=-19) > > Thus, we need to move riscv_cpu_probe function in order to register > the timer earlier than initr_dm_devices. > > Fixes: 7fe32b3442f0 ("event: Convert arch_cpu_init_dm() to use events") > Cc: Simon Glass <sjg@chromium.org> > Cc: Bin Meng <bmeng.cn@gmail.com> > Signed-off-by: Chanho Park <chanho61.park@samsung.com> > --- > arch/riscv/cpu/cpu.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) Applied to u-boot-dm, thanks! > > diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c > index ecfb1fb08c4b..0b4208e72199 100644 > --- a/arch/riscv/cpu/cpu.c > +++ b/arch/riscv/cpu/cpu.c > @@ -66,7 +66,7 @@ static inline bool supports_extension(char ext) > #endif /* CONFIG_CPU */ > } > > -static int riscv_cpu_probe(void) > +static int riscv_cpu_probe(void *ctx, struct event *event) > { > #ifdef CONFIG_CPU > int ret; > @@ -79,6 +79,7 @@ static int riscv_cpu_probe(void) > > return 0; > } > +EVENT_SPY(EVT_DM_POST_INIT_R, riscv_cpu_probe); > > /* > * This is called on secondary harts just after the IPI is init'd. Currently > @@ -95,7 +96,7 @@ int riscv_cpu_setup(void *ctx, struct event *event) > { > int ret; > > - ret = riscv_cpu_probe(); > + ret = riscv_cpu_probe(ctx, event); > if (ret) > return ret; > > @@ -149,12 +150,6 @@ EVENT_SPY(EVT_DM_POST_INIT_F, riscv_cpu_setup); > > int arch_early_init_r(void) > { > - int ret; > - > - ret = riscv_cpu_probe(); > - if (ret) > - return ret; > - > if (IS_ENABLED(CONFIG_SYSRESET_SBI)) > device_bind_driver(gd->dm_root, "sbi-sysreset", > "sbi-sysreset", NULL); > -- > 2.39.2 > ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2023-08-23 13:36 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20230818052645epcas2p47dad71943937119bbfe3652d178d769d@epcas2p4.samsung.com>
2023-08-18 5:11 ` [PATCH v2 0/2] introduce EVT_DM_POST_INIT_R to fix VF2 boot fail Chanho Park
2023-08-18 5:11 ` [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type Chanho Park
2023-08-19 11:01 ` Milan P. Stanić
2023-08-19 20:44 ` Simon Glass
2023-08-21 17:59 ` Roland Ruckerbauer
2023-08-23 13:36 ` Simon Glass
2023-08-21 18:05 ` [PATCH v2 1/2] dm: event: add EVT_DM_POST_INIT_R event type (resend) Roland Ruckerbauer
2023-08-18 5:11 ` [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback Chanho Park
2023-08-19 11:04 ` Milan P. Stanić
2023-08-21 18:02 ` Roland Ruckerbauer
2023-08-21 18:06 ` [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback (resend) Roland Ruckerbauer
2023-08-23 13:36 ` [PATCH v2 2/2] riscv: cpu: make riscv_cpu_probe to EVT_DM_POST_INIT_R callback Simon Glass
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox