Skip to contentSkip to conversation

lib: sbi: Simplify the initialization of root_hmask in sbi_domain_init

PATCH New Xiang W 2 participants 2 messages Dec 11, 2023 – Dec 18, 2023

lore
Share & tools
lore

Xiang W

author
#0 lore raw

PATCH 1/1 lib: sbi: Simplify the initialization of root_hmask in sbi_domain_init

The original code has multiple conversions between hartid and hartindex. Can call sbi_hartmask_set_hartindex directly to avoid conversion.

---
 lib/sbi/sbi_domain.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/sbi/sbi_domain.c +1 -2
index 88d25de..4e9f742 100644
@@ -815,8 +815,7 @@ int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid)
 
 	/* Root domain possible and assigned HARTs */
 	for (i = 0; i < plat->hart_count; i++)
-		sbi_hartmask_set_hartid(sbi_hartindex_to_hartid(i),
-					root_hmask);
+		sbi_hartmask_set_hartindex(i, root_hmask);
 
 	/* Finally register the root domain */
 	rc = sbi_domain_register(&root, root_hmask);
Signature · 1 line
2.42.0
Applied
#1 lore raw

PATCH 1/1 lib: sbi: Simplify the initialization of root_hmask in sbi_domain_init

Quoted 6 lines · On Mon, Dec 11, 2023 at 7:00?PM Xiang W <[email protected]> wrote:

The original code has multiple conversions between hartid and hartindex. Can call sbi_hartmask_set_hartindex directly to avoid conversion.

LGTM.

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 26 lines
---
 lib/sbi/sbi_domain.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/sbi/sbi_domain.c +1 -3
index 88d25de..4e9f742 100644
@@ -815,8 +815,7 @@ int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid)
 
        /* Root domain possible and assigned HARTs */
        for (i = 0; i < plat->hart_count; i++)
-               sbi_hartmask_set_hartid(sbi_hartindex_to_hartid(i),
-                                       root_hmask);
+               sbi_hartmask_set_hartindex(i, root_hmask);
 
        /* Finally register the root domain */
        rc = sbi_domain_register(&root, root_hmask);
--

2.42.0

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi