[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/23] hw/intc/armv7m_nvic: Correct handling of CCR.BFHFNMIGN
From: |
Peter Maydell |
Subject: |
[PULL 04/23] hw/intc/armv7m_nvic: Correct handling of CCR.BFHFNMIGN |
Date: |
Fri, 8 Jan 2021 15:36:02 +0000 |
The CCR is a register most of whose bits are banked between security
states but where BFHFNMIGN is not, and we keep it in the non-secure
entry of the v7m.ccr[] array. The logic which tries to handle this
bit fails to implement the "RAZ/WI from Nonsecure if AIRCR.BFHFNMINS
is zero" requirement; correct the omission.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20201210201433.26262-2-peter.maydell@linaro.org
---
hw/intc/armv7m_nvic.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
index f63aa2d8713..0d8426dafc9 100644
--- a/hw/intc/armv7m_nvic.c
+++ b/hw/intc/armv7m_nvic.c
@@ -1106,6 +1106,12 @@ static uint32_t nvic_readl(NVICState *s, uint32_t
offset, MemTxAttrs attrs)
*/
val = cpu->env.v7m.ccr[attrs.secure];
val |= cpu->env.v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIGN_MASK;
+ /* BFHFNMIGN is RAZ/WI from NS if AIRCR.BFHFNMINS is 0 */
+ if (!attrs.secure) {
+ if (!(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) {
+ val &= ~R_V7M_CCR_BFHFNMIGN_MASK;
+ }
+ }
return val;
case 0xd24: /* System Handler Control and State (SHCSR) */
if (!arm_feature(&cpu->env, ARM_FEATURE_V7)) {
@@ -1683,6 +1689,15 @@ static void nvic_writel(NVICState *s, uint32_t offset,
uint32_t value,
(cpu->env.v7m.ccr[M_REG_NS] & ~R_V7M_CCR_BFHFNMIGN_MASK)
| (value & R_V7M_CCR_BFHFNMIGN_MASK);
value &= ~R_V7M_CCR_BFHFNMIGN_MASK;
+ } else {
+ /*
+ * BFHFNMIGN is RAZ/WI from NS if AIRCR.BFHFNMINS is 0, so
+ * preserve the state currently in the NS element of the array
+ */
+ if (!(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) {
+ value &= ~R_V7M_CCR_BFHFNMIGN_MASK;
+ value |= cpu->env.v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIGN_MASK;
+ }
}
cpu->env.v7m.ccr[attrs.secure] = value;
--
2.20.1
- [PULL 00/23] target-arm queue, Peter Maydell, 2021/01/08
- [PULL 01/23] intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs, Peter Maydell, 2021/01/08
- [PULL 02/23] hw/arm/virt: Remove virt machine state 'smp_cpus', Peter Maydell, 2021/01/08
- [PULL 03/23] target/arm: Fix MTE0_ACTIVE, Peter Maydell, 2021/01/08
- [PULL 04/23] hw/intc/armv7m_nvic: Correct handling of CCR.BFHFNMIGN,
Peter Maydell <=
- [PULL 05/23] target/arm: Correct store of FPSCR value via FPCXT_S, Peter Maydell, 2021/01/08
- [PULL 06/23] target/arm: Implement FPCXT_NS fp system register, Peter Maydell, 2021/01/08
- [PULL 07/23] target/arm: Implement Cortex-M55 model, Peter Maydell, 2021/01/08
- [PULL 08/23] hw/arm/highbank: Drop dead KVM support code, Peter Maydell, 2021/01/08
- [PULL 10/23] scripts/coccinelle: New script to remove unnecessary timer_del() calls, Peter Maydell, 2021/01/08
- [PULL 09/23] util/qemu-timer: Make timer_free() imply timer_del(), Peter Maydell, 2021/01/08
- [PULL 12/23] target/arm: Remove timer_del()/timer_deinit() before timer_free(), Peter Maydell, 2021/01/08
- [PULL 11/23] Remove superfluous timer_del() calls, Peter Maydell, 2021/01/08
- [PULL 14/23] allwinner-a10-pit: Use ptimer_free() in the finalize function to avoid memleaks, Peter Maydell, 2021/01/08
- [PULL 16/23] exynos4210_pwm: Use ptimer_free() in the finalize function to avoid memleaks, Peter Maydell, 2021/01/08