Skip to content

Commit 9f64f06

Browse files
committed
lib: utils: Fix fdt_parse_aclint_node() for non-contiguous hartid
Currently, the fdt_parse_aclint_node() does not handle non-contiguous hartid correctly and returns incorrect first_hartid and hart_count. This is because the for-loop in fdt_parse_aclint_node() skips a hartid for which hartindex is not available (aka corresponding CPU DT node is disabled). For example, on a platform with 4 HARTs (hartid 0, 1, 2, and 3) where CPU DT nodes with hartid 0 and 2 are disabled, the fdt_parse_aclint_node() returns first_hartid = 1 and hart_count = 3 which is incorrect. To address the above issue, drop the sbi_hartid_to_hartindex() check from the for-loop of fdt_parse_aclint_node(). Fixes: 5e90e54 ("lib: utils:Check that hartid is valid") Reported-by: Maria Mbaye <[email protected]> Signed-off-by: Anup Patel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
1 parent 7dd09bf commit 9f64f06

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

lib/utils/fdt/fdt_helper.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,9 +1015,6 @@ int fdt_parse_aclint_node(const void *fdt, int nodeoffset,
10151015
if (rc)
10161016
continue;
10171017

1018-
if (SBI_HARTMASK_MAX_BITS <= sbi_hartid_to_hartindex(hartid))
1019-
continue;
1020-
10211018
if (match_hwirq == hwirq) {
10221019
if (hartid < first_hartid)
10231020
first_hartid = hartid;

0 commit comments

Comments
 (0)