diff mbox series

[11/19] nvic: Compare group priority for escalation to HF

Message ID 1505240046-11454-12-git-send-email-peter.maydell@linaro.org
State Superseded
Headers show
Series ARMv8M: support security extn in the NVIC | expand

Commit Message

Peter Maydell Sept. 12, 2017, 6:13 p.m. UTC
In armv7m_nvic_set_pending() we have to compare the
priority of an exception against the execution priority
to decide whether it needs to be escalated to HardFault.
In the specification this is a comparison against the
exception's group priority; for v7M we implemented it
as a comparison against the raw exception priority
because the two comparisons will always give the
same answer. For v8M the existence of AIRCR.PRIS and
the possibility of different PRIGROUP values for secure
and nonsecure exceptions means we need to explicitly
calculate the vector's group priority for this check.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 hw/intc/armv7m_nvic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4

Comments

Richard Henderson Sept. 19, 2017, 6:48 p.m. UTC | #1
On 09/12/2017 01:13 PM, Peter Maydell wrote:
> In armv7m_nvic_set_pending() we have to compare the

> priority of an exception against the execution priority

> to decide whether it needs to be escalated to HardFault.

> In the specification this is a comparison against the

> exception's group priority; for v7M we implemented it

> as a comparison against the raw exception priority

> because the two comparisons will always give the

> same answer. For v8M the existence of AIRCR.PRIS and

> the possibility of different PRIGROUP values for secure

> and nonsecure exceptions means we need to explicitly

> calculate the vector's group priority for this check.

> 

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

> ---

>  hw/intc/armv7m_nvic.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
index 00c03b4..3361a28 100644
--- a/hw/intc/armv7m_nvic.c
+++ b/hw/intc/armv7m_nvic.c
@@ -478,7 +478,7 @@  void armv7m_nvic_set_pending(void *opaque, int irq, bool secure)
         int running = nvic_exec_prio(s);
         bool escalate = false;
 
-        if (vec->prio >= running) {
+        if (exc_group_prio(s, vec->prio, secure) >= running) {
             trace_nvic_escalate_prio(irq, vec->prio, running);
             escalate = true;
         } else if (!vec->enabled) {