diff options
| author | Anup Patel <apatel@ventanamicro.com> | 2025-06-06 11:28:10 +0530 |
|---|---|---|
| committer | Anup Patel <anup@brainfault.org> | 2025-06-16 09:41:03 +0530 |
| commit | 9f64f0619334eea34df66a1816b1be589870ac4e (patch) | |
| tree | 68c9e2218ad7fa66566d4e6a36b07f5ea6bc6092 /lib/utils | |
| parent | 7dd09bfeca310f540d73e29c600958faead0849e (diff) | |
| download | opensbi-9f64f0619334eea34df66a1816b1be589870ac4e.zip opensbi-9f64f0619334eea34df66a1816b1be589870ac4e.tar.gz opensbi-9f64f0619334eea34df66a1816b1be589870ac4e.tar.bz2 | |
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: 5e90e54a1a53 ("lib: utils:Check that hartid is valid")
Reported-by: Maria Mbaye <MameMaria.Mbaye@microchip.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Link: https://lore.kernel.org/r/20250606055810.237441-1-apatel@ventanamicro.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'lib/utils')
| -rw-r--r-- | lib/utils/fdt/fdt_helper.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/lib/utils/fdt/fdt_helper.c b/lib/utils/fdt/fdt_helper.c index af148fe..0f4859c 100644 --- a/lib/utils/fdt/fdt_helper.c +++ b/lib/utils/fdt/fdt_helper.c @@ -1015,9 +1015,6 @@ int fdt_parse_aclint_node(const void *fdt, int nodeoffset, if (rc) continue; - if (SBI_HARTMASK_MAX_BITS <= sbi_hartid_to_hartindex(hartid)) - continue; - if (match_hwirq == hwirq) { if (hartid < first_hartid) first_hartid = hartid; |
