lib: sbi: Add option to select boot hart
PATCH v2 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 | 6 ++++++ 2 files changed, 10 insertions(+)
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 +6 -0
@@ -447,7 +447,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
@@ -498,7 +500,11 @@ void __noreturn sbi_init(struct sbi_scratch *scratch)* HARTs which satisfy above condition. */ +#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 coldboot = TRUE;/*
Signature · 1 line
2.25.1
PATCH v2 1/1 lib: sbi: Add option to select boot hart
Quoted 41 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.
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 | 6 ++++++ 2 files changed, 10 insertions(+)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_PADDINGlib/sbi/sbi_init.c +2
-0@@ -447,7 +447,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
lib/sbi/sbi_init.c void __noreturn sbi_init(struct sbi_scratch *scratch) · line 505
Quoted 6 lines
lib/sbi/sbi_init.c +3
-0@@ -498,7 +500,11 @@ void __noreturn sbi_init(struct sbi_scratch *scratch)* HARTs which satisfy above condition. */ +#ifdef FW_BOOT_HART_ID +if (next_mode_supported && hartid ==FW_BOOT_HART_ID ) +#else
This breaks the CPU hotplug for boot HART.
In other words, the boot HART will now always take coldboot path when it is stopped (sbi_hsm_hart_stop()) and started (sbi_hsm_hart_start()) at runtime.
Quoted 9 lines
lib/sbi/sbi_init.c +1
-1if (next_mode_supported && atomic_xchg(&coldboot_lottery, 1) == 0) +#endif coldboot = TRUE;/* -- 2.25.1
Quoted 4 lines
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
Regards,
Anup
PATCH v2 1/1 lib: sbi: Add option to select boot hart
Quoted 53 lines · Anup Patel
Quoted 41 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.
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 | 6 ++++++ 2 files changed, 10 insertions(+)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_PADDINGlib/sbi/sbi_init.c +2
-0@@ -447,7 +447,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 lib/sbi/sbi_init.c void __noreturn sbi_init(struct sbi_scratch *scratch) · line 505
Quoted 6 lines
lib/sbi/sbi_init.c +3
-0@@ -498,7 +500,11 @@ void __noreturn sbi_init(struct sbi_scratch *scratch)* HARTs which satisfy above condition. */ +#ifdef FW_BOOT_HART_ID +if (next_mode_supported && hartid ==FW_BOOT_HART_ID ) +#elseThis breaks the CPU hotplug for boot HART.
Quoted 3 lines
In other words, the boot HART will now always take coldboot path when it is stopped (
sbi_hsm_hart_stop()) and started (sbi_hsm_hart_start()) at runtime.
Can you try the two experimental patches from preferred_cold_boot_hart_v1 branch at: https://github.com/avpatel/opensbi.git ?
You will need to implement your platform specific override on top of these patches to decide which HARTs are allowed to do cold boot. If it works for you then include these patches in your v3 patches.
Regards,
Anup
Quoted 17 lines
Quoted 10 lines
lib/sbi/sbi_init.c +1
-1if (next_mode_supported && atomic_xchg(&coldboot_lottery, 1) == 0) +#endif coldboot = TRUE;/* -- 2.25.1
Quoted 4 lines
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbiRegards,
Anup
PATCH v2 1/1 lib: sbi: Add option to select boot hart
Quoted 69 lines
-----Original Message-----
From: Anup Patel <[email protected]>
Sent: Friday, December 2, 2022 7:36 PM
To: WeiLiang Lim <[email protected]>
Cc: opensbi at lists.infradead.org; Cheehong Ang <[email protected]>; JunLiang Tan <[email protected]>
Subject: Re: [PATCH v2] lib: sbi: Add option to select boot hartQuoted 5 lines · Anup Patel
Quoted 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.
Quoted 16 lines
Quoted 16 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 | 6 ++++++ 2 files changed, 10 insertions(+)firmware/objects.mk index renamed from firmware/objects.mk +0
-0a1704c4..2b41718 100644
firmware/objects.mk +0
-1@@ -28,6 +28,10 @@ ifdef FW_TEXT_START firmware-genflags-y += -DFW_TEXT_START=$(FW_TEXT_START) endifQuoted 12 lines
lib/sbi/sbi_init.c static void __noreturn init_warmboot(struct
Quoted 12 lines
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)\" ifdef FW_FDT_PADDINGlib/sbi/sbi_init.c index renamed from lib/sbi/sbi_init.c +0
-0a8500e5..28698f1 100644
lib/sbi/sbi_init.c +0
-0@@ -447,7 +447,9 @@ static void __noreturn init_warmboot(struct
sbi_scratch*scratch, u32 hartid)Quoted 12 lines
Quoted 12 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 @@ -498,7 +500,11 @@ void __noreturn sbi_init(struct sbi_scratch *scratch) * HARTs which satisfy above condition. */ Quoted 8 lines
lib/sbi/sbi_init.c
Quoted 2 lines
lib/sbi/sbi_init.c +2
-0+#ifdef FW_BOOT_HART_ID + if (next_mode_supported && hartid == FW_BOOT_HART_ID) #elseThis breaks the CPU hotplug for boot HART.
In other words, the boot HART will now always take coldboot path when it is stopped (
sbi_hsm_hart_stop()) and started (sbi_hsm_hart_start()) at runtime.Can you try the two experimental patches from
preferred_cold_boot_hart_v1branch at: https://github.com/avpatel/opensbi.git ?
Quoted 6 lines
You will need to implement your platform specific override on top of these patches to decide which HARTs are allowed to do cold boot. If it works for you then include these patches in your v3 patches.
Regards,
Anup
Great! Thanks! This is exactly what we are looking for. This is so much better as we can override the preferred cold boot hart behaviour in platform specific code.
We will integrate these 2 patches and test with our platform code.
BTW, our platform specific code is not quite ready to be upstreamed with these 2 patches for now yet. Can we get back to you with the test result and you can just merge these 2 patches into mainline ? Or you expect us to include these 2 patches as well when we upstream our platform code later ?
Quoted 19 lines
Quoted 19 lines
Quoted 8 lines
if (next_mode_supported && atomic_xchg(&coldboot_lottery, 1) == 0) +#endif coldboot = TRUE; /*Quoted 8 lines
--
2.25.1--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbiRegards,
Anup
PATCH v2 1/1 lib: sbi: Add option to select boot hart
Quoted 74 lines · Cheehong Ang
Quoted 74 lines
-----Original Message-----
From: Anup Patel <[email protected]>
Sent: Friday, December 2, 2022 7:36 PM
To: WeiLiang Lim <[email protected]>
Cc: opensbi at lists.infradead.org; Cheehong Ang <[email protected]>; JunLiang Tan <[email protected]>
Subject: Re: [PATCH v2] lib: sbi: Add option to select boot hartQuoted 5 lines · Anup Patel
Quoted 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.
Quoted 16 lines
Quoted 16 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 | 6 ++++++ 2 files changed, 10 insertions(+)firmware/objects.mk index renamed from firmware/objects.mk +0
-0a1704c4..2b41718 100644
firmware/objects.mk +0
-1@@ -28,6 +28,10 @@ ifdef FW_TEXT_START firmware-genflags-y += -DFW_TEXT_START=$(FW_TEXT_START) endifQuoted 12 lines
lib/sbi/sbi_init.c static void __noreturn init_warmboot(struct
Quoted 12 lines
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)\" ifdef FW_FDT_PADDINGlib/sbi/sbi_init.c index renamed from lib/sbi/sbi_init.c +0
-0a8500e5..28698f1 100644
lib/sbi/sbi_init.c +0
-0@@ -447,7 +447,9 @@ static void __noreturn init_warmboot(struct
sbi_scratch*scratch, u32 hartid)Quoted 12 lines
Quoted 12 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 @@ -498,7 +500,11 @@ void __noreturn sbi_init(struct sbi_scratch *scratch) * HARTs which satisfy above condition. */ Quoted 8 lines
lib/sbi/sbi_init.c
Quoted 2 lines
lib/sbi/sbi_init.c +2
-0+#ifdef FW_BOOT_HART_ID + if (next_mode_supported && hartid == FW_BOOT_HART_ID) #elseThis breaks the CPU hotplug for boot HART.
In other words, the boot HART will now always take coldboot path when it is stopped (
sbi_hsm_hart_stop()) and started (sbi_hsm_hart_start()) at runtime.Can you try the two experimental patches from
preferred_cold_boot_hart_v1branch at: https://github.com/avpatel/opensbi.git ?You will need to implement your platform specific override on top of these patches to decide which HARTs are allowed to do cold boot. If it works for you then include these patches in your v3 patches.
Quoted 8 lines
Quoted 2 lines
Regards,
AnupGreat! Thanks! This is exactly what we are looking for. This is so much better as we can override the preferred cold boot hart behaviour in platform specific code.
We will integrate these 2 patches and test with our platform code.
BTW, our platform specific code is not quite ready to be upstreamed with these 2 patches for now yet. Can we get back to you with the test result and you can just merge these 2 patches into mainline ? Or you expect us to include these 2 patches as well when we upstream our platform code later ?
I am glad that these patches are useful.
I suggest you send these patches along with your platform support whenever you upstream it.
Regards,
Anup
Quoted 23 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
if (next_mode_supported && atomic_xchg(&coldboot_lottery, 1) == 0) +#endif coldboot = TRUE; /*--
2.25.1Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbiRegards,
Anup--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi