[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/25] Correct CPACR reset value for v7 cores
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 09/25] Correct CPACR reset value for v7 cores |
Date: |
Thu, 31 May 2018 15:23:41 +0100 |
In commit f0aff255700 we made cpacr_write() enforce that some CPACR
bits are RAZ/WI and some are RAO/WI for ARMv7 cores. Unfortunately
we forgot to also update the register's reset value. The effect
was that (a) a guest that read CPACR on reset would not see ones in
the RAO bits, and (b) if you did a migration before the guest did
a write to the CPACR then the migration would fail because the
destination would enforce the RAO bits and then complain that they
didn't match the zero value from the source.
Implement reset for the CPACR using a custom reset function
that just calls cpacr_write(), to avoid having to duplicate
the logic for which bits are RAO.
This bug would affect migration for TCG CPUs which are ARMv7
with VFP but without one of Neon or VFPv3.
Reported-by: Cédric Le Goater <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>
Tested-by: Cédric Le Goater <address@hidden>
Message-id: address@hidden
---
target/arm/helper.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index a4bfac3932..f75aa6e9ca 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -863,6 +863,14 @@ static void cpacr_write(CPUARMState *env, const
ARMCPRegInfo *ri,
env->cp15.cpacr_el1 = value;
}
+static void cpacr_reset(CPUARMState *env, const ARMCPRegInfo *ri)
+{
+ /* Call cpacr_write() so that we reset with the correct RAO bits set
+ * for our CPU features.
+ */
+ cpacr_write(env, ri, 0);
+}
+
static CPAccessResult cpacr_access(CPUARMState *env, const ARMCPRegInfo *ri,
bool isread)
{
@@ -920,7 +928,7 @@ static const ARMCPRegInfo v6_cp_reginfo[] = {
{ .name = "CPACR", .state = ARM_CP_STATE_BOTH, .opc0 = 3,
.crn = 1, .crm = 0, .opc1 = 0, .opc2 = 2, .accessfn = cpacr_access,
.access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.cpacr_el1),
- .resetvalue = 0, .writefn = cpacr_write },
+ .resetfn = cpacr_reset, .writefn = cpacr_write },
REGINFO_SENTINEL
};
--
2.17.1
- [Qemu-devel] [PULL 00/25] target-arm queue, Peter Maydell, 2018/05/31
- [Qemu-devel] [PULL 11/25] Make tb_invalidate_phys_addr() take a MemTxAttrs argument, Peter Maydell, 2018/05/31
- [Qemu-devel] [PULL 09/25] Correct CPACR reset value for v7 cores,
Peter Maydell <=
- [Qemu-devel] [PULL 12/25] Make address_space_translate{, _cached}() take a MemTxAttrs argument, Peter Maydell, 2018/05/31
- [Qemu-devel] [PULL 10/25] memory.h: Improve IOMMU related documentation, Peter Maydell, 2018/05/31
- [Qemu-devel] [PULL 08/25] xlnx-zdma: Correct mem leaks and memset to zero on desc unaligned errors, Peter Maydell, 2018/05/31
- [Qemu-devel] [PULL 03/25] hw/intc/arm_gicv3: Fix APxR<n> register dispatching, Peter Maydell, 2018/05/31
- [Qemu-devel] [PULL 16/25] Make memory_region_access_valid() take a MemTxAttrs argument, Peter Maydell, 2018/05/31
- [Qemu-devel] [PULL 13/25] Make address_space_map() take a MemTxAttrs argument, Peter Maydell, 2018/05/31
- [Qemu-devel] [PULL 15/25] Make flatview_extend_translation() take a MemTxAttrs argument, Peter Maydell, 2018/05/31
- [Qemu-devel] [PULL 07/25] arm: fix malloc type mismatch, Peter Maydell, 2018/05/31
- [Qemu-devel] [PULL 06/25] arm: fix qemu crash on startup with -bios option, Peter Maydell, 2018/05/31
- [Qemu-devel] [PULL 04/25] arm_gicv3_kvm: increase clroffset accordingly, Peter Maydell, 2018/05/31