/* PLIC will mask all interrupts of a priority less than or equal to threshold. Maximum threshold is 7. For example, a threshold value of zero permits all interrupts with non-zero priority, whereas a value of 7 masks all interrupts. Notice, the threshold is global for PLIC, not for each interrupt source.  */
void plic_set_threshold(int threshold)
/* PLIC will mask all interrupts of a priority less than or equal to threshold. Maximum threshold is 7. For example, a threshold value of zero permits all interrupts with non-zero priority, whereas a value of 7 masks all interrupts. Notice, the threshold is global for PLIC, not for each interrupt source.  */
void plic_set_threshold(int threshold)
{
    int hart = __raw_hartid();
    *(uint32_t *)PLIC_THRESHOLD(hart) = threshold;
}