lib: sbi: Add option to select boot hart
PATCH 1/1 lib: sbi: Add option to select boot hart
In certain scenario, user needs to select a particular hart ID as the boot hart. This option provide the flexibility for user to select the preferred boot hart.
--- firmware/objects.mk | 4 ++++ lib/sbi/sbi_init.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
firmware/objects.mk +4 -0
@@ -28,6 +28,10 @@ ifdef FW_TEXT_START firmware-genflags-y += -DFW_TEXT_START=$(FW_TEXT_START) endif +ifdef FW_BOOT_HART_ID +firmware-genflags-y += -DFW_BOOT_HART_ID=$(FW_BOOT_HART_ID) +endif + ifdef FW_FDT_PATH firmware-genflags-y += -DFW_FDT_PATH=\"$(FW_FDT_PATH)\" ifdef FW_FDT_PADDING
lib/sbi/sbi_init.c +8 -1
@@ -443,7 +443,9 @@ static void __noreturn init_warmboot(struct sbi_scratch *scratch, u32 hartid) scratch->next_mode, FALSE); } +#ifndef FW_BOOT_HART_ID static atomic_t coldboot_lottery =ATOMIC_INITIALIZER (0 ); +#endif /** * Initialize OpenSBI library for current HART and jump to next
@@ -494,7 +496,12 @@ void __noreturn sbi_init(struct sbi_scratch *scratch)* HARTs which satisfy above condition. */ -if (next_mode_supported &&atomic_xchg (&coldboot_lottery,1 ) ==0 ) + if (next_mode_supported && +#ifdef FW_BOOT_HART_ID + hartid == FW_BOOT_HART_ID) +#else + atomic_xchg(&coldboot_lottery, 1) == 0) +#endif coldboot = TRUE;/*
Signature · 1 line
2.25.1
PATCH 1/1 lib: sbi: Add option to select boot hart
? 2022-11-29???? 13:21 +0800?Wei Liang Lim???
Quoted 46 lines
In certain scenario, user needs to select a particular hart ID as the boot hart. This option provide the flexibility for user to select the preferred boot hart.
Signed-off-by Wei Liang Lim <[email protected]>Reviewed-by Chee Hong Ang <[email protected]>Reviewed-by Jun Liang Tan <[email protected]>---
?firmware/objects.mk | 4 ++++
?lib/sbi/sbi_init.c? | 9 ++++++++-
?2 files changed, 12 insertions(+), 1 deletion(-)firmware/objects.mk +0
-0@@ -28,6 +28,10 @@ ifdef FW_TEXT_START ?firmware-genflags-y += -DFW_TEXT_START=$(FW_TEXT_START)?endif
?firmware/objects.mk +4
-0+ifdef FW_BOOT_HART_ID +firmware-genflags-y += -DFW_BOOT_HART_ID=$(FW_BOOT_HART_ID) +endif +?ifdef
FW_FDT_PATH
?firmware-genflags-y += -DFW_FDT_PATH=\"$(FW_FDT_PATH)\" ?ifdefFW_FDT_PADDINGlib/sbi/sbi_init.c +0
-0@@ -443,7 +443,9 @@ static void __noreturn init_warmboot(struct sbi_scratch *scratch, u32 hartid) ???????????????????????????? scratch->next_mode, FALSE); ?}?
+#ifndefFW_BOOT_HART_ID
?staticatomic_tcoldboot_lottery=ATOMIC_INITIALIZER(0); +#endif
?
?/**
? * Initialize OpenSBI library for current HART and jump to nextlib/sbi/sbi_init.c +0
-0@@ -494,7 +496,12 @@ void __noreturn sbi_init(struct sbi_scratch *scratch)???????? * HARTs which satisfy above condition.
???????? */
?
-???????if (next_mode_supported&&atomic_xchg(&coldboot_lottery, 1)== 0) +???????if (next_mode_supported&&
lib/sbi/sbi_init.c void __noreturn sbi_init(struct sbi_scratch *scratch) · line 504
Quoted 5 lines
lib/sbi/sbi_init.c +5
-0+#ifdef FW_BOOT_HART_ID +???????????????hartid == FW_BOOT_HART_ID) +#else +???????????????atomic_xchg(&coldboot_lottery, 1) == 0) +#endif
Look good to me. I recommend
#ifdef FW_BOOT_HART_ID
if (next_mode_supported && hartid == FW_BOOT_HART_ID)
#else
if (next_mode_supported && atomic_xchg(&coldboot_lottery, 1) == 0)endif
Quoted 7 lines
????????????????coldboot = TRUE;
?
????????/*Signature · 1 line
2.25.1
PATCH 1/1 lib: sbi: Add option to select boot hart
In reply to Wei Liang LimQuoted 2 lines · Wei Liang Lim
In certain scenario, user needs to select a particular hart ID as the boot hart. This option provide the flexibility for user to select the preferred boot hart.
Why? What?s wrong with the others?
Jess
Quoted 59 lines
Signed-off-by Wei Liang Lim <[email protected]>Reviewed-by Chee Hong Ang <[email protected]>Reviewed-by Jun Liang Tan <[email protected]>---
firmware/objects.mk| 4 ++++lib/sbi/sbi_init.c| 9 ++++++++-2 files changed, 12 insertions(+), 1 deletion(-)firmware/objects.mk +0
-0@@ -28,6 +28,10 @@ ifdef FW_TEXT_START firmware-genflags-y += -DFW_TEXT_START=$(FW_TEXT_START)endif
firmware/objects.mk +4
-0+ifdef FW_BOOT_HART_ID +firmware-genflags-y += -DFW_BOOT_HART_ID=$(FW_BOOT_HART_ID) +endif +ifdef
FW_FDT_PATH
firmware-genflags-y += -DFW_FDT_PATH=\"$(FW_FDT_PATH)\" ifdefFW_FDT_PADDINGlib/sbi/sbi_init.c +8
-1@@ -443,7 +443,9 @@ static void __noreturn init_warmboot(struct sbi_scratch *scratch, u32 hartid) scratch->next_mode, FALSE); } +#ifndef FW_BOOT_HART_ID static atomic_t coldboot_lottery =ATOMIC_INITIALIZER (0 ); +#endif /** * Initialize OpenSBI library for current HART and jump to next @@ -494,7 +496,12 @@ void __noreturn sbi_init(struct sbi_scratch *scratch)* HARTs which satisfy above condition. */ -if (next_mode_supported &&atomic_xchg (&coldboot_lottery,1 ) ==0 ) + if (next_mode_supported && +#ifdef FW_BOOT_HART_ID + hartid == FW_BOOT_HART_ID) +#else + atomic_xchg(&coldboot_lottery, 1) == 0) +#endif coldboot = TRUE;/* Signature · 7 lines
2.25.1 -- opensbi mailing list opensbi at lists.infradead.org http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 1/1 lib: sbi: Add option to select boot hart
Quoted 12 lines
-----Original Message-----
From: Jessica Clarke <[email protected]>
Sent: Wednesday, November 30, 2022 12:18 AM
To: WeiLiang Lim <[email protected]>
Cc: opensbi at lists.infradead.org; Cheehong Ang <[email protected]>; JunLiang Tan <[email protected]>
Subject: Re: [PATCH] lib: sbi: Add option to select boot hartQuoted 1 line · Wei Liang Lim
Quoted 7 lines
Quoted 1 line
In certain scenario, user needs to select a particular hart ID as the boot hart.
This option provide the flexibility for user to select the preferred boot hart.
Why? What?s wrong with the others?
Jess
We need this patch for 2 scenarios below:
1) On our architecture, there are some harts supporting MMU sv39/sv48 and some harts only supporting sv39. When those harts with sv48 support is picked as boot hart, the OS automatically assumes all the other non-boot harts support sv48 as well. Therefore, we need to select the harts with sv39 supports only as the boot hart to avoid the incorrect page table issues in non-boot harts.
2) We have use case which requires the same boot hart to save OS context before going into 'hibernation' mode and to restore the OS context after resuming from 'hibernation' mode.
Quoted 58 lines
lib/sbi/sbi_init.c static void __noreturn init_warmboot(struct
Quoted 27 lines
Signed-off-by Wei Liang Lim <[email protected]>Reviewed-by Chee Hong Ang <[email protected]>Reviewed-by Jun Liang Tan <[email protected]>---
firmware/objects.mk| 4 ++++lib/sbi/sbi_init.c| 9 ++++++++-2 files changed, 12 insertions(+), 1 deletion(-)firmware/objects.mk index renamed from firmware/objects.mk +0
-0a1704c4..2b41718 100644
firmware/objects.mk +4
-1@@ -28,6 +28,10 @@ ifdef FW_TEXT_START firmware-genflags-y += -DFW_TEXT_START=$(FW_TEXT_START) endif +ifdef FW_BOOT_HART_ID +firmware-genflags-y += -DFW_BOOT_HART_ID=$(FW_BOOT_HART_ID) +endif +ifdef
FW_FDT_PATH
firmware-genflags-y += -DFW_FDT_PATH=\"$(FW_FDT_PATH)\" ifdefFW_FDT_PADDINGlib/sbi/sbi_init.c index renamed from lib/sbi/sbi_init.c +0
-0d57efa7..5abfa79 100644
lib/sbi/sbi_init.c +0
-0@@ -443,7 +443,9 @@ static void __noreturn init_warmboot(struct
sbi_scratch*scratch, u32 hartid)Quoted 30 lines
lib/sbi/sbi_init.c +2
-1scratch->next_mode, FALSE); } +#ifndef FW_BOOT_HART_ID static atomic_t coldboot_lottery =ATOMIC_INITIALIZER (0 ); +#endif /** * Initialize OpenSBI library for current HART and jump to next @@ -494,7 +496,12 @@ void __noreturn sbi_init(struct sbi_scratch *scratch) * HARTs which satisfy above condition. */lib/sbi/sbi_init.c +5
-1-if (next_mode_supported &&atomic_xchg (&coldboot_lottery,1 ) ==0 ) + if (next_mode_supported && +#ifdef FW_BOOT_HART_ID + hartid == FW_BOOT_HART_ID) +#else + atomic_xchg(&coldboot_lottery, 1) == 0) #endifcoldboot = TRUE; /*--
2.25.1--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 1/1 lib: sbi: Add option to select boot hart
Quoted 14 lines · WeiLiang Lim
Quoted 14 lines
-----Original Message-----
From: Jessica Clarke <[email protected]>
Sent: Wednesday, November 30, 2022 12:18 AM
To: WeiLiang Lim <[email protected]>
Cc: opensbi at lists.infradead.org; Cheehong Ang <[email protected]>; JunLiang Tan <[email protected]>
Subject: Re: [PATCH] lib: sbi: Add option to select boot hartQuoted 2 lines · Wei Liang Lim
In certain scenario, user needs to select a particular hart ID as the boot hart.
Quoted 8 lines
Quoted 6 lines
This option provide the flexibility for user to select the preferred boot hart.
Why? What?s wrong with the others?
Jess
We need this patch for 2 scenarios below:
1) On our architecture, there are some harts supporting MMU sv39/sv48 and some harts only supporting sv39. When those harts with sv48 support is picked as boot hart, the OS automatically assumes all the other non-boot harts support sv48 as well. Therefore, we need to select the harts with sv39 supports only as the boot hart to avoid the incorrect page table issues in non-boot harts.
If you have a heterogenous environment then this isn?t the right fix, OSes need to be aware of heterogeneity otherwise other things can easily go wrong. And if they?re aware of that then you don?t need to control which OS boots. Nothing in the RISC-V world currently says that OSes should do their feature detection on the first hart that boots...
Quoted 1 line
2) We have use case which requires the same boot hart to save OS context before going into 'hibernation' mode and to restore the OS context after resuming from 'hibernation' mode.
I can?t imagine current OpenSBI+Linux is at all prepared for hibernation so don?t think that?s a sufficient justification for it today?
Jess
Quoted 59 lines
Quoted 58 lines
lib/sbi/sbi_init.c static void __noreturn init_warmboot(struct
Quoted 27 lines
Signed-off-by Wei Liang Lim <[email protected]>Reviewed-by Chee Hong Ang <[email protected]>Reviewed-by Jun Liang Tan <[email protected]>---
firmware/objects.mk| 4 ++++lib/sbi/sbi_init.c| 9 ++++++++-2 files changed, 12 insertions(+), 1 deletion(-)firmware/objects.mk index renamed from firmware/objects.mk +0
-0a1704c4..2b41718 100644
firmware/objects.mk +4
-1@@ -28,6 +28,10 @@ ifdef FW_TEXT_START firmware-genflags-y += -DFW_TEXT_START=$(FW_TEXT_START) endif +ifdef FW_BOOT_HART_ID +firmware-genflags-y += -DFW_BOOT_HART_ID=$(FW_BOOT_HART_ID) +endif +ifdef
FW_FDT_PATH
firmware-genflags-y += -DFW_FDT_PATH=\"$(FW_FDT_PATH)\" ifdefFW_FDT_PADDINGlib/sbi/sbi_init.c index renamed from lib/sbi/sbi_init.c +0
-0d57efa7..5abfa79 100644
lib/sbi/sbi_init.c +0
-0@@ -443,7 +443,9 @@ static void __noreturn init_warmboot(struct
sbi_scratch*scratch, u32 hartid)Quoted 30 lines
lib/sbi/sbi_init.c +2
-1scratch->next_mode, FALSE); } +#ifndef FW_BOOT_HART_ID static atomic_t coldboot_lottery =ATOMIC_INITIALIZER (0 ); +#endif /** * Initialize OpenSBI library for current HART and jump to next @@ -494,7 +496,12 @@ void __noreturn sbi_init(struct sbi_scratch *scratch) * HARTs which satisfy above condition. */lib/sbi/sbi_init.c +5
-1-if (next_mode_supported &&atomic_xchg (&coldboot_lottery,1 ) ==0 ) + if (next_mode_supported && +#ifdef FW_BOOT_HART_ID + hartid == FW_BOOT_HART_ID) +#else + atomic_xchg(&coldboot_lottery, 1) == 0) #endifcoldboot = TRUE; /*--
2.25.1--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 1/1 lib: sbi: Add option to select boot hart
Quoted 36 lines
Quoted 9 lines
Quoted 9 lines
-----Original Message-----
From: Jessica Clarke <[email protected]>
Sent: Wednesday, November 30, 2022 12:18 AM
To: WeiLiang Lim <[email protected]>
Cc: opensbi at lists.infradead.org; Cheehong Ang <[email protected]>; JunLiang Tan <[email protected]>
Subject: Re: [PATCH] lib: sbi: Add option to select boot hartQuoted 5 lines
Quoted 5 lines
Quoted 2 lines · Wei Liang Lim
In certain scenario, user needs to select a particular hart ID as the boot
hart.
Quoted 1 line
Quoted 1 line
This option provide the flexibility for user to select the preferred boot
hart.
Quoted 7 lines
Quoted 5 lines
Why? What?s wrong with the others?
Jess
We need this patch for 2 scenarios below:
1) On our architecture, there are some harts supporting MMU sv39/sv48and some harts only supporting sv39. When those harts with sv48 support is picked as boot hart, the OS automatically assumes all the other non-boot harts support sv48 as well. Therefore, we need to select the harts with sv39 supports only as the boot hart to avoid the incorrect page table issues in non-boot harts.
If you have a heterogenous environment then this isn?t the right fix, OSes need to be aware of heterogeneity otherwise other things can easily go wrong. And if they?re aware of that then you don?t need to control which OS boots. Nothing in the RISC-V world currently says that OSes should do their feature detection on the first hart that boots...
Quoted 7 lines
Quoted 1 line
2) We have use case which requires the same boot hart to save OS context
before going into 'hibernation' mode and to restore the OS context after resuming from 'hibernation' mode.
I can?t imagine current OpenSBI+Linux is at all prepared for hibernation so don?t think that?s a sufficient justification for it today?
Appreciate the comments and responses.
We agree that there are other better/proper ways to fix the issues that we have encountered above.
Just like Bin Meng highlighted in other threads that instead of fixing the boot hart order, CONFIG options can be added to kernel code to enforce certain MMU type.
There is nothing wrong with lottery mechanism boot flow. We are not trying fix the boot hart selection mechanism in OpenSBI to resolve our problems. We just try to provide another option for user to specify a boot hart for certain use cases. In some cases, we may also need to select certain hart as boot hart for debugging the SMP issues especially during hardware development stages.
My question here is do we think providing another option to select certain hart ID as boot hart is something unnecessary in RISC-V world at all ?
Quoted 62 lines
Jess
Quoted 35 lines
Quoted 35 lines
lib/sbi/sbi_init.c static void __noreturn init_warmboot(struct
Quoted 27 lines
Signed-off-by Wei Liang Lim <[email protected]>Reviewed-by Chee Hong Ang <[email protected]>Reviewed-by Jun Liang Tan <[email protected]>---
firmware/objects.mk| 4 ++++lib/sbi/sbi_init.c| 9 ++++++++-2 files changed, 12 insertions(+), 1 deletion(-)firmware/objects.mk index renamed from firmware/objects.mk +0
-0a1704c4..2b41718 100644
firmware/objects.mk +4
-1@@ -28,6 +28,10 @@ ifdef FW_TEXT_START firmware-genflags-y += -DFW_TEXT_START=$(FW_TEXT_START) endif +ifdef FW_BOOT_HART_ID +firmware-genflags-y += -DFW_BOOT_HART_ID=$(FW_BOOT_HART_ID) +endif +ifdef
FW_FDT_PATH
firmware-genflags-y += -DFW_FDT_PATH=\"$(FW_FDT_PATH)\" ifdefFW_FDT_PADDINGlib/sbi/sbi_init.c index renamed from lib/sbi/sbi_init.c +0
-0d57efa7..5abfa79 100644
lib/sbi/sbi_init.c +0
-0@@ -443,7 +443,9 @@ static void __noreturn init_warmboot(struct
sbi_scratch*scratch, u32 hartid)Quoted 7 lines
lib/sbi/sbi_init.c +2
-0scratch->next_mode, FALSE); } +#ifndef FW_BOOT_HART_ID static atomic_t coldboot_lottery =ATOMIC_INITIALIZER (0 ); +#endif Quoted 7 lines
Quoted 7 lines
lib/sbi/sbi_init.c
Quoted 7 lines
lib/sbi/sbi_init.c +0
-1/** * Initialize OpenSBI library for current HART and jump to next @@ -494,7 +496,12 @@ void __noreturn sbi_init(struct sbi_scratch *scratch) * HARTs which satisfy above condition. */lib/sbi/sbi_init.c +0
-1- if (next_mode_supported && atomic_xchg(&coldboot_lottery, 1) ==0)
Quoted 17 lines
Quoted 16 lines
Quoted 16 lines
lib/sbi/sbi_init.c +5
-0+ if (next_mode_supported && +#ifdef FW_BOOT_HART_ID + hartid == FW_BOOT_HART_ID) +#else + atomic_xchg(&coldboot_lottery, 1) == 0) #endifcoldboot = TRUE; /*--
2.25.1--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 1/1 lib: sbi: Add option to select boot hart
Quoted 56 lines
-----Original Message-----
From: Cheehong Ang <[email protected]>
Sent: Wednesday, November 30, 2022 1:26 PM
To: Jessica Clarke <[email protected]>; WeiLiang Lim <[email protected]>; Bin Meng <[email protected]>
Cc: opensbi at lists.infradead.org; JunLiang Tan <[email protected]>
Subject: RE: [PATCH] lib: sbi: Add option to select boot hartQuoted 39 lines
Quoted 9 lines
Quoted 9 lines
-----Original Message-----
From: Jessica Clarke <[email protected]>
Sent: Wednesday, November 30, 2022 12:18 AM
To: WeiLiang Lim <[email protected]>
Cc: opensbi at lists.infradead.org; Cheehong Ang <[email protected]>; JunLiang Tan <[email protected]>
Subject: Re: [PATCH] lib: sbi: Add option to select boot hartQuoted 6 lines
Quoted 6 lines
Quoted 3 lines · Wei Liang Lim
In certain scenario, user needs to select a particular hart ID as the boot
hart.
Quoted 2 lines
Quoted 2 lines
This option provide the flexibility for user to select the preferred boot
hart.
Quoted 8 lines
Quoted 5 lines
Why? What?s wrong with the others?
Jess
We need this patch for 2 scenarios below:
1) On our architecture, there are some harts supporting MMU sv39/sv48and some harts only supporting sv39. When those harts with sv48 support is picked as boot hart, the OS automatically assumes all the other non-boot harts support sv48 as well. Therefore, we need to select the harts with sv39 supports only as the boot hart to avoid the incorrect page table issues in non-boot harts.
If you have a heterogenous environment then this isn?t the right fix, OSes need to be aware of heterogeneity otherwise other things can easily go wrong. And if they?re aware of that then you don?t need to control which OS boots. Nothing in the RISC-V world currently says that OSes should do their feature detection on the first hart that boots...
Quoted 8 lines
Quoted 2 lines
2) We have use case which requires the same boot hart to save OS context
before going into 'hibernation' mode and to restore the OS context after resuming from 'hibernation' mode.
I can?t imagine current OpenSBI+Linux is at all prepared for hibernation so don?t think that?s a sufficient justification for it today?
Quoted 15 lines
Appreciate the comments and responses.
We agree that there are other better/proper ways to fix the issues that we have encountered above.
Just like Bin Meng highlighted in other threads that instead of fixing the boot hart order, CONFIG options can be added to kernel code to enforce certain MMU type.
There is nothing wrong with lottery mechanism boot flow. We are not trying fix the boot hart selection mechanism in OpenSBI to resolve our problems. We just try to provide another option for user to specify a boot hart for certain use cases.
In some cases, we may also need to select certain hart as boot hart for debugging the SMP issues especially during hardware development stages. My question here is do we think providing another option to select certain hart ID as boot hart is something unnecessary in RISC-V world at all ?
Thanks for all the great feedbacks and suggestions.
Just want to clarify that the intention is not to alter the existing boot flow lottery mechanism. But to provide an additional option/flexibility for user to specify the preferred boot hart for whatever reason.
Quoted 61 lines
Quoted 61 lines
Jess
Quoted 34 lines
Quoted 34 lines
lib/sbi/sbi_init.c static void __noreturn init_warmboot(struct
Quoted 27 lines
Signed-off-by Wei Liang Lim <[email protected]>Reviewed-by Chee Hong Ang <[email protected]>Reviewed-by Jun Liang Tan <[email protected]>---
firmware/objects.mk| 4 ++++lib/sbi/sbi_init.c| 9 ++++++++-2 files changed, 12 insertions(+), 1 deletion(-)firmware/objects.mk index renamed from firmware/objects.mk +0
-0a1704c4..2b41718 100644
firmware/objects.mk +4
-1@@ -28,6 +28,10 @@ ifdef FW_TEXT_START firmware-genflags-y += -DFW_TEXT_START=$(FW_TEXT_START) endif +ifdef FW_BOOT_HART_ID +firmware-genflags-y += -DFW_BOOT_HART_ID=$(FW_BOOT_HART_ID) +endif +ifdef
FW_FDT_PATH
firmware-genflags-y += -DFW_FDT_PATH=\"$(FW_FDT_PATH)\" ifdefFW_FDT_PADDINGlib/sbi/sbi_init.c index renamed from lib/sbi/sbi_init.c +0
-0d57efa7..5abfa79 100644
lib/sbi/sbi_init.c +0
-0@@ -443,7 +443,9 @@ static void __noreturn init_warmboot(struct
sbi_scratch*scratch, u32 hartid)Quoted 6 lines
lib/sbi/sbi_init.c +2
-0scratch->next_mode, FALSE); } +#ifndef FW_BOOT_HART_ID static atomic_t coldboot_lottery =ATOMIC_INITIALIZER (0 ); +#endif Quoted 7 lines
Quoted 7 lines
lib/sbi/sbi_init.c
Quoted 7 lines
lib/sbi/sbi_init.c +0
-1/** * Initialize OpenSBI library for current HART and jump to next @@ -494,7 +496,12 @@ void __noreturn sbi_init(struct sbi_scratch *scratch) * HARTs which satisfy above condition. */lib/sbi/sbi_init.c +0
-1- if (next_mode_supported && atomic_xchg(&coldboot_lottery, 1) ==0)
Quoted 17 lines
Quoted 16 lines
Quoted 16 lines
lib/sbi/sbi_init.c +5
-0+ if (next_mode_supported && +#ifdef FW_BOOT_HART_ID + hartid == FW_BOOT_HART_ID) +#else + atomic_xchg(&coldboot_lottery, 1) == 0) #endifcoldboot = TRUE; /*--
2.25.1--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 1/1 lib: sbi: Add option to select boot hart
In reply to WeiLiang LimQuoted 14 lines · WeiLiang Lim
Quoted 14 lines
-----Original Message-----
From: Jessica Clarke <[email protected]>
Sent: Wednesday, November 30, 2022 12:18 AM
To: WeiLiang Lim <[email protected]>
Cc: opensbi at lists.infradead.org; Cheehong Ang <[email protected]>; JunLiang Tan <[email protected]>
Subject: Re: [PATCH] lib: sbi: Add option to select boot hartQuoted 2 lines · Wei Liang Lim
In certain scenario, user needs to select a particular hart ID as the boot hart.
Quoted 8 lines
Quoted 6 lines
This option provide the flexibility for user to select the preferred boot hart.
Why? What?s wrong with the others?
Jess
We need this patch for 2 scenarios below:
1) On our architecture, there are some harts supporting MMU sv39/sv48 and some harts only supporting sv39. When those harts with sv48 support is picked as boot hart, the OS automatically assumes all the other non-boot harts support sv48 as well. Therefore, we need to select the harts with sv39 supports only as the boot hart to avoid the incorrect page table issues in non-boot harts.
For such a case, you probably need to add a CONFIG option in the Linux kernel to force an MMU type instead of auto probing the highest MMU type on the boot hart.
Quoted 11 lines
2) We have use case which requires the same boot hart to save OS context before going into 'hibernation' mode and to restore the OS context after resuming from 'hibernation' mode.
Quoted 8 lines
Quoted 8 lines
Signed-off-by Wei Liang Lim <[email protected]>Reviewed-by Chee Hong Ang <[email protected]>Reviewed-by Jun Liang Tan <[email protected]>---
firmware/objects.mk| 4 ++++lib/sbi/sbi_init.c| 9 ++++++++-2 files changed, 12 insertions(+), 1 deletion(-)
Regards,
Bin
PATCH 1/1 lib: sbi: Add option to select boot hart
Quoted 21 lines · Bin Meng
Quoted 18 lines · WeiLiang Lim
Quoted 18 lines
-----Original Message-----
From: Jessica Clarke <[email protected]>
Sent: Wednesday, November 30, 2022 12:18 AM
To: WeiLiang Lim <[email protected]>
Cc: opensbi at lists.infradead.org; Cheehong Ang <[email protected]>; JunLiang Tan <[email protected]>
Subject: Re: [PATCH] lib: sbi: Add option to select boot hartQuoted 2 lines · Wei Liang Lim
In certain scenario, user needs to select a particular hart ID as the boot hart.
This option provide the flexibility for user to select the preferred boot hart.
Why? What?s wrong with the others?
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Jess
We need this patch for 2 scenarios below:
1) On our architecture, there are some harts supporting MMU sv39/sv48 and some harts only supporting sv39. When those harts with sv48 support is picked as boot hart, the OS automatically assumes all the other non-boot harts support sv48 as well. Therefore, we need to select the harts with sv39 supports only as the boot hart to avoid the incorrect page table issues in non-boot harts.For such a case, you probably need to add a CONFIG option in the Linux kernel to force an MMU type instead of auto probing the highest MMU type on the boot hart.
Another option is to add a RISC-V specific kernel parameter and parse this parameter very early in setup_vm().
Regards,
Anup
Quoted 20 lines
Quoted 12 lines
2) We have use case which requires the same boot hart to save OS context before going into 'hibernation' mode and to restore the OS context after resuming from 'hibernation' mode.
Quoted 8 lines
Quoted 8 lines
Signed-off-by Wei Liang Lim <[email protected]>Reviewed-by Chee Hong Ang <[email protected]>Reviewed-by Jun Liang Tan <[email protected]>---
firmware/objects.mk| 4 ++++lib/sbi/sbi_init.c| 9 ++++++++-2 files changed, 12 insertions(+), 1 deletion(-)Regards,
Bin--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi