lib: sbi: Try to make each domain have boot hart
PATCH 1/1 lib: sbi: Try to make each domain have boot hart
domain register will move the hart from the old domain to the new domain, and should not move the boot hart to prevent the old domain from losing the boot hart.
--- lib/sbi/sbi_domain.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
lib/sbi/sbi_domain.c +15 -1
@@ -543,9 +543,23 @@ int sbi_domain_register(struct sbi_domain *dom,continue ; tdom =sbi_hartid_to_domain (i); -if (tdom) +if (tdom) { +if (i == tdom->boot_hartid) { +/* Newly registered domain should not +* take up the boot hart of the older domain */ +if (i == dom->boot_hartid) +sbi_printf ("%s: failed assign Hart%d to %s, " +"conflict with %s\n" , + __func__, i, dom->name, tdom->name); +else +sbi_printf ("%s: skip assign Hart%d to %s, " +"because Hart%d is boot hart of %s\n" , + __func__, i, dom->name, i, tdom->name); +continue ; + }sbi_hartmask_clear_hart (i, &tdom->assigned_harts); + }update_hartid_to_domain (i, dom);sbi_hartmask_set_hart (i, &dom->assigned_harts);
Signature · 1 line
2.39.2
PATCH 1/1 lib: sbi: Try to make each domain have boot hart
Quoted 23 lines · On Tue, Jun 20, 2023 at 6:02?PM Xiang W <[email protected]> wrote:
domain register will move the hart from the old domain to the new domain, and should not move the boot hart to prevent the old domain from losing the boot hart.
Signed-off-by Xiang W <[email protected]>--- lib/sbi/sbi_domain.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)lib/sbi/sbi_domain.c +4
-1@@ -543,9 +543,23 @@ int sbi_domain_register(struct sbi_domain *dom,continue ; tdom =sbi_hartid_to_domain (i); -if (tdom) +if (tdom) { +if (i == tdom->boot_hartid) { +/* Newly registered domain should not +* take up the boot hart of the older domain */
lib/sbi/sbi_domain.c int sbi_domain_register(struct sbi_domain *dom, · line 559
Quoted 10 lines
lib/sbi/sbi_domain.c +10
-0+if (i == dom->boot_hartid) +sbi_printf ("%s: failed assign Hart%d to %s, " +"conflict with %s\n" , + __func__, i, dom->name, tdom->name); +else +sbi_printf ("%s: skip assign Hart%d to %s, " +"because Hart%d is boot hart of %s\n" , + __func__, i, dom->name, i, tdom->name); +continue ; + }
This is not needed because sbi_domain_finalize() already checks that dom->boot_hartid is assigned to dom before starting dom->boot_hartid.
The cold boot HART is by default boot HART of the root domain and assigned to the root domain. This patch prevents cold boot HART from changing its own domain.
NACK for this patch.
Regards,
Anup
Quoted 14 lines
lib/sbi/sbi_domain.c +1
-1sbi_hartmask_clear_hart (i, &tdom->assigned_harts); + }update_hartid_to_domain (i, dom);sbi_hartmask_set_hart (i, &dom->assigned_harts); --2.39.2
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 1/1 lib: sbi: Try to make each domain have boot hart
? 2023-07-04???? 09:18 +0530?Anup Patel???
Quoted 38 lines · On Tue, Jun 20, 2023 at 6:02?PM Xiang W <[email protected]> wrote:
Quoted 23 lines
domain register will move the hart from the old domain to the new domain, and should not move the boot hart to prevent the old domain from losing the boot hart.
Signed-off-by Xiang W <[email protected]>---
?lib/sbi/sbi_domain.c | 16 +++++++++++++++-
?1 file changed, 15 insertions(+), 1 deletion(-)lib/sbi/sbi_domain.c +4
-1@@ -543,9 +543,23 @@ int sbi_domain_register(struct sbi_domain *dom, ??????????????????????? continue; ??????????????? tdom = sbi_hartid_to_domain(i); -?????????????? if (tdom) +?????????????? if (tdom) { +?????????????????????? if (i == tdom->boot_hartid) { +?????????????????????????????? /* Newly registered domain should not +??????????????????????????????? * take up the boot hart of the older domain */ lib/sbi/sbi_domain.c int sbi_domain_register(struct sbi_domain *dom, · line 559
Quoted 10 lines
lib/sbi/sbi_domain.c +10
-0+?????????????????????????????? if (i == dom->boot_hartid) +?????????????????????????????????????? sbi_printf("%s: failed assign Hart%d to %s, " +?????????????????????????????????????????????? "conflict with %s\n", +?????????????????????????????????????????????? __func__, i, dom->name, tdom->name); +?????????????????????????????? else +?????????????????????????????????????? sbi_printf("%s: skip assign Hart%d to %s, " +?????????????????????????????????????????????? "because Hart%d is boot hart of %s\n", +?????????????????????????????????????????????? __func__, i, dom->name, i, tdom->name); +?????????????????????????????? continue; +?????????????????????? }This is not needed because
sbi_domain_finalize()already checks thatdom->boot_hartidis assigned to dom before startingdom->boot_hartid.
Quoted 3 lines
The cold boot HART is by default boot HART of the root domain and assigned to the root domain. This patch prevents cold boot HART from changing its own domain.
If the cold boot hart changes its own domain, the root domain will not lost boot hart and will not be able to start.
Is it not a mistake that root dmain cannot be started?
Regards,
Xiang W
Quoted 20 lines
NACK for this patch.
Regards,
AnupQuoted 14 lines
lib/sbi/sbi_domain.c +1
-1??????????????????????? sbi_hartmask_clear_hart(i, ??????????????????????????????????????? &tdom->assigned_harts); +?????????????? } ??????????????? update_hartid_to_domain(i, dom); ??????????????? sbi_hartmask_set_hart(i, &dom->assigned_harts); --2.39.2
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 1/1 lib: sbi: Try to make each domain have boot hart
Quoted 40 lines · On Tue, Jul 4, 2023 at 2:16?PM Xiang W <[email protected]> wrote:
? 2023-07-04???? 09:18 +0530?Anup Patel???
Quoted 38 lines · On Tue, Jun 20, 2023 at 6:02?PM Xiang W <[email protected]> wrote:
Quoted 23 lines
domain register will move the hart from the old domain to the new domain, and should not move the boot hart to prevent the old domain from losing the boot hart.
Signed-off-by Xiang W <[email protected]>--- lib/sbi/sbi_domain.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)lib/sbi/sbi_domain.c +4
-1@@ -543,9 +543,23 @@ int sbi_domain_register(struct sbi_domain *dom,continue ; tdom =sbi_hartid_to_domain (i); -if (tdom) +if (tdom) { +if (i == tdom->boot_hartid) { +/* Newly registered domain should not +* take up the boot hart of the older domain */ lib/sbi/sbi_domain.c int sbi_domain_register(struct sbi_domain *dom, · line 559
Quoted 10 lines
lib/sbi/sbi_domain.c +10
-0+if (i == dom->boot_hartid) +sbi_printf ("%s: failed assign Hart%d to %s, " +"conflict with %s\n" , + __func__, i, dom->name, tdom->name); +else +sbi_printf ("%s: skip assign Hart%d to %s, " +"because Hart%d is boot hart of %s\n" , + __func__, i, dom->name, i, tdom->name); +continue ; + }This is not needed because
sbi_domain_finalize()already checks thatdom->boot_hartidis assigned to dom before startingdom->boot_hartid.
Quoted 8 lines
Quoted 3 lines
The cold boot HART is by default boot HART of the root domain and assigned to the root domain. This patch prevents cold boot HART from changing its own domain.
If the cold boot hart changes its own domain, the root domain will not lost boot hart and will not be able to start.
Is it not a mistake that root dmain cannot be started?
No it's not a mistake. For instance, look at example in the docs/domain_support.md where we have two additional domains "trusted" and "untrusted" apart from the root domain which cover all HARTs already covered by the root domain. In this example, the root domain never runs because the boot HART changes its own domain to "untrusted" domain.
The root domain is a default/fallback domain which exists in the system even when no domains are defined via FDT. We can have many domains defined in the system but a HART is running in exactly one domain context.
Regards,
Anup
Quoted 24 lines
Regards,
Xiang WQuoted 20 lines
NACK for this patch.
Regards,
AnupQuoted 14 lines
lib/sbi/sbi_domain.c +1
-1sbi_hartmask_clear_hart (i, &tdom->assigned_harts); + }update_hartid_to_domain (i, dom);sbi_hartmask_set_hart (i, &dom->assigned_harts); --2.39.2
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 1/1 lib: sbi: Try to make each domain have boot hart
? 2023-07-04???? 14:41 +0530?Anup Patel???
Quoted 57 lines · On Tue, Jul 4, 2023 at 2:16?PM Xiang W <[email protected]> wrote:
Quoted 40 lines
? 2023-07-04???? 09:18 +0530?Anup Patel???
Quoted 38 lines · On Tue, Jun 20, 2023 at 6:02?PM Xiang W <[email protected]> wrote:
Quoted 23 lines
domain register will move the hart from the old domain to the new domain, and should not move the boot hart to prevent the old domain from losing the boot hart.
Signed-off-by Xiang W <[email protected]>---
?lib/sbi/sbi_domain.c | 16 +++++++++++++++-
?1 file changed, 15 insertions(+), 1 deletion(-)lib/sbi/sbi_domain.c +4
-1@@ -543,9 +543,23 @@ int sbi_domain_register(struct sbi_domain *dom, ??????????????????????? continue; ??????????????? tdom = sbi_hartid_to_domain(i); -?????????????? if (tdom) +?????????????? if (tdom) { +?????????????????????? if (i == tdom->boot_hartid) { +?????????????????????????????? /* Newly registered domain should not +??????????????????????????????? * take up the boot hart of the older domain */ lib/sbi/sbi_domain.c int sbi_domain_register(struct sbi_domain *dom, · line 559
Quoted 10 lines
lib/sbi/sbi_domain.c +10
-0+?????????????????????????????? if (i == dom->boot_hartid) +?????????????????????????????????????? sbi_printf("%s: failed assign Hart%d to %s, " +?????????????????????????????????????????????? "conflict with %s\n", +?????????????????????????????????????????????? __func__, i, dom->name, tdom->name); +?????????????????????????????? else +?????????????????????????????????????? sbi_printf("%s: skip assign Hart%d to %s, " +?????????????????????????????????????????????? "because Hart%d is boot hart of %s\n", +?????????????????????????????????????????????? __func__, i, dom->name, i, tdom->name); +?????????????????????????????? continue; +?????????????????????? }This is not needed because
sbi_domain_finalize()already checks thatdom->boot_hartidis assigned to dom before startingdom->boot_hartid.Quoted 8 lines
Quoted 3 lines
The cold boot HART is by default boot HART of the root domain and assigned to the root domain. This patch prevents cold boot HART from changing its own domain.
If the cold boot hart changes its own domain, the root domain will not lost boot hart and will not be able to start.
Is it not a mistake that root dmain cannot be started?
No it's not a mistake. For instance, look at example in the
docs/domain_support.mdwhere we have two additional domains "trusted" and "untrusted" apart from the root domain which cover all HARTs already covered by the root domain. In this example, the root domain never runs because the boot HART changes its own domain to "untrusted" domain.
Quoted 4 lines
The root domain is a default/fallback domain which exists in the system even when no domains are defined via FDT. We can have many domains defined in the system but a HART is running in exactly one domain context.
Thank you for the explanation
Regards,
Xiang W
Quoted 28 lines
Regards,
AnupQuoted 24 lines
Regards,
Xiang WQuoted 20 lines
NACK for this patch.
Regards,
AnupQuoted 14 lines
lib/sbi/sbi_domain.c +1
-1??????????????????????? sbi_hartmask_clear_hart(i, ??????????????????????????????????????? &tdom->assigned_harts); +?????????????? } ??????????????? update_hartid_to_domain(i, dom); ??????????????? sbi_hartmask_set_hart(i, &dom->assigned_harts); --2.39.2
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi