lib: sbi_hsm: Restor hart state to stop when fails to start
PATCH 1/1 lib: sbi_hsm: Restor hart state to stop when fails to start
Hart state should change back to hart stop when hsm_device_hart_start() or sbi_ipi_raw_send() fails to perform hart start.
--- lib/sbi/sbi_hsm.c | 4 ++++ 1 file changed, 4 insertions(+)
lib/sbi/sbi_hsm.c +4 -0
@@ -360,6 +360,10 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch,if (!rc)return 0 ; + +/* If it fails to start, change hart state back to stop */ +__sbi_hsm_hart_change_state (hdata,SBI_HSM_STATE_START_PENDING , +SBI_HSM_STATE_STOPPED ); err:hsm_start_ticket_release (hdata);return rc;
Signature · 1 line
2.25.1
PATCH 1/1 lib: sbi_hsm: Restor hart state to stop when fails to start
? 2024-02-19???? 15:14 +0800?Joshua Yeong???
Quoted 16 lines
Hart state should change back to hart stop when
hsm_device_hart_start()orsbi_ipi_raw_send()fails to perform hart start.Signed-off-by Joshua Yeong <[email protected]>---
?lib/sbi/sbi_hsm.c | 4 ++++
?1 file changed, 4 insertions(+)lib/sbi/sbi_hsm.c +0
-0@@ -360,6 +360,10 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch,?
? if (!rc)
? return 0;
lib/sbi/sbi_hsm.c int sbi_hsm_hart_start(struct sbi_scratch *scratch,
Quoted 4 lines
lib/sbi/sbi_hsm.c +4
-0+ +/* If it fails to start, change hart state back to stop */ +__sbi_hsm_hart_change_state (hdata,SBI_HSM_STATE_START_PENDING , + ??? SBI_HSM_STATE_STOPPED);
This is not needed. Because if hdata->state is not equal to SBI_HSM_STATE_STOPPED, SBI_HSM_STATE_START_PENDING will not be written.
Regards,
Xiang W
Quoted 7 lines
?err:
?hsm_start_ticket_release(hdata);
? return rc;Signature · 1 line
2.25.1
PATCH 1/1 lib: sbi_hsm: Restor hart state to stop when fails to start
Quoted 22 lines · Joshua Yeong
? 2024-02-19???? 15:14 +0800?Joshua Yeong???
Quoted 13 lines
Hart state should change back to hart stop when
hsm_device_hart_start()orsbi_ipi_raw_send()fails to perform hart start.Signed-off-by Joshua Yeong <[email protected]>---
?lib/sbi/sbi_hsm.c | 4 ++++
?1 file changed, 4 insertions(+)lib/sbi/sbi_hsm.c index renamed from lib/sbi/sbi_hsm.c +0
-03d60ceb..be48d64 100644
lib/sbi/sbi_hsm.c int sbi_hsm_hart_start(struct sbi_scratch · line 366
Quoted 7 lines
lib/sbi/sbi_hsm.c +3
-0@@ -360,6 +360,10 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch, ? if (!rc) ? return 0; + + /* If it fails to start, change hart state back to stop */ + __sbi_hsm_hart_change_state(hdata,
SBI_HSM_STATE_START_PENDING,
Quoted 8 lines
lib/sbi/sbi_hsm.c int sbi_hsm_hart_start(struct sbi_scratch · line 367
Quoted 1 line
lib/sbi/sbi_hsm.c +1
-0+ ??? SBI_HSM_STATE_STOPPED);This is not needed. Because if
hdata->stateis not equal toSBI_HSM_STATE_STOPPED,SBI_HSM_STATE_START_PENDINGwill not be written.Regards,
Xiang W
The scenario is that the Hart is in SBI_HSM_STATE_STOPPED and then it switches to SBI_HSM_STATE_START_PENDING, but it got stuck in SBI_HSM_STATE_START_PENDING if it fails to start. The hart's state has impact on other process where hart's state is taken into consideration, for example system suspend.
Regards,
Joshua
Quoted 8 lines
Quoted 8 lines
?err:
?hsm_start_ticket_release(hdata);
? return rc;
--
2.25.1
PATCH 1/1 lib: sbi_hsm: Restor hart state to stop when fails to start
? 2024-02-19???? 09:44 +0000?Joshua Yeong???
Quoted 29 lines · Joshua Yeong
Quoted 28 lines
? 2024-02-19???? 15:14 +0800?Joshua Yeong???
Quoted 13 lines
Hart state should change back to hart stop when
hsm_device_hart_start()orsbi_ipi_raw_send()fails to perform hart start.Signed-off-by Joshua Yeong <[email protected]>---
?lib/sbi/sbi_hsm.c | 4 ++++
?1 file changed, 4 insertions(+)lib/sbi/sbi_hsm.c index renamed from lib/sbi/sbi_hsm.c +0
-03d60ceb..be48d64 100644
lib/sbi/sbi_hsm.c int sbi_hsm_hart_start(struct sbi_scratch · line 366
Quoted 7 lines
lib/sbi/sbi_hsm.c +3
-0@@ -360,6 +360,10 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch, ? if (!rc) ? return 0; + + /* If it fails to start, change hart state back to stop */ + __sbi_hsm_hart_change_state(hdata,
SBI_HSM_STATE_START_PENDING,lib/sbi/sbi_hsm.c int sbi_hsm_hart_start(struct sbi_scratch · line 367
Quoted 1 line
lib/sbi/sbi_hsm.c +1
-0+ ??? SBI_HSM_STATE_STOPPED);This is not needed. Because if
hdata->stateis not equal toSBI_HSM_STATE_STOPPED,SBI_HSM_STATE_START_PENDINGwill not be written.
Quoted 6 lines
Quoted 2 lines
Regards,
Xiang WThe scenario is that the Hart is in
SBI_HSM_STATE_STOPPEDand then it switches toSBI_HSM_STATE_START_PENDING, but it got stuck inSBI_HSM_STATE_START_PENDINGif it fails to start. The hart's state has impact on other process where hart's state is taken into consideration, for example system suspend.
Sorry. I mistakenly thought that these codes were added after the err tag.
Quoted 13 lines
Regards,
JoshuaQuoted 8 lines
Quoted 8 lines
?err:
?hsm_start_ticket_release(hdata);
? return rc;
--
2.25.1
Anup Patel
AppliedPATCH 1/1 lib: sbi_hsm: Restor hart state to stop when fails to start
In reply to Joshua YeongQuoted 5 lines · On Mon, Feb 19, 2024 at 12:44?PM Joshua Yeong <[email protected]>…
Hart state should change back to hart stop when
hsm_device_hart_start()orsbi_ipi_raw_send()fails to perform hart start.Signed-off-by Joshua Yeong <[email protected]>
LGTM.
Applied this patch to the riscv/opensbi repo.
Thanks,
Anup
Quoted 27 lines
--- lib/sbi/sbi_hsm.c | 4 ++++ 1 file changed, 4 insertions(+)lib/sbi/sbi_hsm.c +4
-1@@ -360,6 +360,10 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch,if (!rc)return 0 ; + +/* If it fails to start, change hart state back to stop */ +__sbi_hsm_hart_change_state (hdata,SBI_HSM_STATE_START_PENDING , +SBI_HSM_STATE_STOPPED ); err:hsm_start_ticket_release (hdata);return rc; --2.25.1
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi