[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/15] hw/arm/armv7m_nvic: Check subpriority in nvic_
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 11/15] hw/arm/armv7m_nvic: Check subpriority in nvic_recompute_state_secure() |
Date: |
Tue, 7 May 2019 13:00:07 +0100 |
Rule R_CQRV says that if two pending interrupts have the same
group priority then ties are broken by looking at the subpriority.
We had a comment describing this but had forgotten to actually
implement the subpriority comparison. Correct the omission.
(The further tie break rules of "lowest exception number" and
"secure before non-secure" are handled implicitly by the order
in which we iterate through the exceptions in the loops.)
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Message-id: address@hidden
---
hw/intc/armv7m_nvic.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
index fff6e694e60..131b5938b9a 100644
--- a/hw/intc/armv7m_nvic.c
+++ b/hw/intc/armv7m_nvic.c
@@ -213,6 +213,7 @@ static void nvic_recompute_state_secure(NVICState *s)
int active_prio = NVIC_NOEXC_PRIO;
int pend_irq = 0;
bool pending_is_s_banked = false;
+ int pend_subprio = 0;
/* R_CQRV: precedence is by:
* - lowest group priority; if both the same then
@@ -226,7 +227,7 @@ static void nvic_recompute_state_secure(NVICState *s)
for (i = 1; i < s->num_irq; i++) {
for (bank = M_REG_S; bank >= M_REG_NS; bank--) {
VecInfo *vec;
- int prio;
+ int prio, subprio;
bool targets_secure;
if (bank == M_REG_S) {
@@ -241,8 +242,12 @@ static void nvic_recompute_state_secure(NVICState *s)
}
prio = exc_group_prio(s, vec->prio, targets_secure);
- if (vec->enabled && vec->pending && prio < pend_prio) {
+ subprio = vec->prio & ~nvic_gprio_mask(s, targets_secure);
+ if (vec->enabled && vec->pending &&
+ ((prio < pend_prio) ||
+ (prio == pend_prio && prio >= 0 && subprio < pend_subprio))) {
pend_prio = prio;
+ pend_subprio = subprio;
pend_irq = i;
pending_is_s_banked = (bank == M_REG_S);
}
--
2.20.1
- [Qemu-devel] [PULL 00/15] target-arm queue, Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 02/15] pflash_cfi01: New pflash_cfi01_legacy_drive(), Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 01/15] pc: Rearrange pc_system_firmware_init()'s legacy -drive loop, Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 05/15] arm: Allow system registers for KVM guests to be changed by QEMU code, Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 09/15] util/cacheinfo: Use uint64_t on LLP64 model to satisfy Windows ARM64, Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 04/15] hw/arm/raspi: Diagnose requests for too much RAM, Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 07/15] QEMU_PACKED: Remove gcc_struct attribute in Windows non x86 targets, Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 10/15] osdep: Fix mingw compilation regarding stdio formats, Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 08/15] qga: Fix mingw compilation warnings on enum conversion, Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 06/15] arm: aspeed: Set SDRAM size, Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 11/15] hw/arm/armv7m_nvic: Check subpriority in nvic_recompute_state_secure(),
Peter Maydell <=
- [Qemu-devel] [PULL 03/15] hw/arm/virt: Support firmware configuration with -blockdev, Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 13/15] hw/intc/armv7m_nvic: Don't enable ARMV7M_EXCP_DEBUG from reset, Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 14/15] target/arm: Implement XPSR GE bits, Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 15/15] target/arm: Stop using variable length array in dc_zva, Peter Maydell, 2019/05/07
- [Qemu-devel] [PULL 12/15] hw/intc/armv7m_nvic: NS BFAR and BFSR are RAZ/WI if BFHFNMINS == 0, Peter Maydell, 2019/05/07
- Re: [Qemu-devel] [PULL 00/15] target-arm queue, Peter Maydell, 2019/05/08