lib: sbi: Simplify the initialization of root_hmask in sbi_domain_init
authorXiang W <wxjstz@126.com>
Mon, 11 Dec 2023 13:29:50 +0000 (21:29 +0800)
committerAnup Patel <anup@brainfault.org>
Mon, 18 Dec 2023 14:21:45 +0000 (19:51 +0530)
The original code has multiple conversions between hartid and
hartindex. Can call sbi_hartmask_set_hartindex directly to
avoid conversion.

Signed-off-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
lib/sbi/sbi_domain.c

index 88d25deb100208d42707f039c962d117bbf4b1eb..4e9f7428a52fc4aeb776330aad611af2aa27146e 100644 (file)
@@ -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);