lib: irqchip/plic: Fix maximum priority threshold value
authorAtish Patra <atish.patra@wdc.com>
Fri, 3 Apr 2020 18:13:08 +0000 (11:13 -0700)
committerAnup Patel <anup@brainfault.org>
Mon, 6 Apr 2020 03:28:56 +0000 (08:58 +0530)
As per the PLIC specification, maximum priority threshold value is 0x7.
Even though, writing a higher value doesn't cause any error in qemu
hifive unleashed, there may be some implementation which checks the upper
and may result in an illegal access.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
lib/utils/irqchip/plic.c

index 40c4170..7c40d28 100644 (file)
@@ -66,11 +66,11 @@ int plic_warm_irqchip_init(u32 target_hart, int m_cntx_id, int s_cntx_id)
 
        /* By default, disable M-mode threshold */
        if (m_cntx_id > -1)
-               plic_set_thresh(m_cntx_id, 0xffffffff);
+               plic_set_thresh(m_cntx_id, 0x7);
 
        /* By default, disable S-mode threshold */
        if (s_cntx_id > -1)
-               plic_set_thresh(s_cntx_id, 0xffffffff);
+               plic_set_thresh(s_cntx_id, 0x7);
 
        return 0;
 }