From e53f9cb74c7f82f5de2e115cf3e53b853cb07812 Mon Sep 17 00:00:00 2001 From: Tilmann Bartsch Date: Mon, 22 Jan 2024 23:18:36 +0100 Subject: [PATCH] PLIC: Implement threshold masking Signed-off-by: Tilmann Bartsch --- riscv/plic.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/riscv/plic.cc b/riscv/plic.cc index 44f80cf9..01def705 100644 --- a/riscv/plic.cc +++ b/riscv/plic.cc @@ -113,6 +113,15 @@ uint32_t plic_t::context_best_pending(const plic_context_t *c) } } + /* + From Spec 1.0.0: 6. Priority Thresholds + The PLIC will mask all PLIC interrupts of a priority less than or equal to + threshold. + */ + if (best_id_prio <= c->priority_threshold) { + return 0; + } + return best_id; }