Skip to content

Commit a8a2fa9

Browse files
author
matthew.gui
committed
conf/evalsoc: update opensbi to fixup guest-index-bits err when geilen==0.
Signed-off-by: matthew.gui <guibing@nuclei.com>
1 parent 752f9e1 commit a8a2fa9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

conf/evalsoc/opensbi/evalsoc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ static void fdt_imsic_guest_index_fixup(void *fdt)
4343
{
4444
int offset, len, i;
4545
const uint32_t *prop;
46+
int geilen;
4647

4748
if (!fdt)
4849
return;
@@ -67,7 +68,8 @@ static void fdt_imsic_guest_index_fixup(void *fdt)
6768
* if GEILEN=3 then hw_smsi_align_bits=2,
6869
* if GEILEN=4 then hw_smsi_align_bits=3.
6970
*/
70-
hw_smsi_align_bits = sbi_fls(nuclei_evalsoc_get_geilen()) + 1;
71+
geilen = nuclei_evalsoc_get_geilen();
72+
hw_smsi_align_bits = geilen ? (sbi_fls(geilen) + 1) : 0;
7173
if (guest_index_bits != hw_smsi_align_bits) {
7274
fdt_setprop_u32(fdt, offset, "riscv,guest-index-bits", hw_smsi_align_bits);
7375
}

0 commit comments

Comments
 (0)