[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/18] target/arm: Make Cortex-M3 and M4 default to 8
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 03/18] target/arm: Make Cortex-M3 and M4 default to 8 PMSA regions |
Date: |
Mon, 17 Jul 2017 13:44:39 +0100 |
The Cortex-M3 and M4 CPUs always have 8 PMSA MPU regions (this isn't
a configurable option for the hardware). Make the default value of
the pmsav7-dregion property be set per-cpu, so we don't need to have
every user of these CPUs set it manually. (The existing default of
16 is correct for the other PMSAv7 core, the Cortex-R5.)
This fixes a bug where we were creating the M3 and M4 with
too many regions; most guest software would not notice or
care, though, since it would just not use the registers
associated with the unexpected extra regions.
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Message-id: address@hidden
---
target/arm/cpu.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 28a9141..96d1f84 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -543,8 +543,15 @@ static Property arm_cpu_has_pmu_property =
static Property arm_cpu_has_mpu_property =
DEFINE_PROP_BOOL("has-mpu", ARMCPU, has_mpu, true);
+/* This is like DEFINE_PROP_UINT32 but it doesn't set the default value,
+ * because the CPU initfn will have already set cpu->pmsav7_dregion to
+ * the right value for that particular CPU type, and we don't want
+ * to override that with an incorrect constant value.
+ */
static Property arm_cpu_pmsav7_dregion_property =
- DEFINE_PROP_UINT32("pmsav7-dregion", ARMCPU, pmsav7_dregion, 16);
+ DEFINE_PROP_UNSIGNED_NODEFAULT("pmsav7-dregion", ARMCPU,
+ pmsav7_dregion,
+ qdev_prop_uint32, uint32_t);
static void arm_cpu_post_init(Object *obj)
{
@@ -1054,6 +1061,7 @@ static void cortex_m3_initfn(Object *obj)
set_feature(&cpu->env, ARM_FEATURE_V7);
set_feature(&cpu->env, ARM_FEATURE_M);
cpu->midr = 0x410fc231;
+ cpu->pmsav7_dregion = 8;
}
static void cortex_m4_initfn(Object *obj)
@@ -1064,6 +1072,7 @@ static void cortex_m4_initfn(Object *obj)
set_feature(&cpu->env, ARM_FEATURE_M);
set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP);
cpu->midr = 0x410fc240; /* r0p0 */
+ cpu->pmsav7_dregion = 8;
}
static void arm_v7m_class_init(ObjectClass *oc, void *data)
{
@@ -1112,6 +1121,7 @@ static void cortex_r5_initfn(Object *obj)
cpu->id_isar4 = 0x0010142;
cpu->id_isar5 = 0x0;
cpu->mp_is_up = true;
+ cpu->pmsav7_dregion = 16;
define_arm_cp_regs(cpu, cortexr5_cp_reginfo);
}
--
2.7.4
- [Qemu-devel] [PULL 18/18] MAINTAINERS: Add entries for MPS2 board, (continued)
- [Qemu-devel] [PULL 18/18] MAINTAINERS: Add entries for MPS2 board, Peter Maydell, 2017/07/17
- [Qemu-devel] [PULL 12/18] hw/arm/mps2: Add UARTs, Peter Maydell, 2017/07/17
- [Qemu-devel] [PULL 06/18] target/arm/translate.h: expand comment on DISAS_EXIT, Peter Maydell, 2017/07/17
- [Qemu-devel] [PULL 15/18] hw/misc/mps2_scc: Implement MPS2 Serial Communication Controller, Peter Maydell, 2017/07/17
- [Qemu-devel] [PULL 13/18] hw/char/cmsdk-apb-timer: Implement CMSDK APB timer device, Peter Maydell, 2017/07/17
- [Qemu-devel] [PULL 08/18] target/arm: use gen_goto_tb for ISB handling, Peter Maydell, 2017/07/17
- [Qemu-devel] [PULL 07/18] target/arm/translate: ensure gen_goto_tb sets exit flags, Peter Maydell, 2017/07/17
- [Qemu-devel] [PULL 10/18] hw/arm/mps2: Implement skeleton mps2-an385 and mps2-an511 board models, Peter Maydell, 2017/07/17
- [Qemu-devel] [PULL 04/18] include/exec/exec-all: document common exit conditions, Peter Maydell, 2017/07/17
- [Qemu-devel] [PULL 05/18] target/arm/translate: make DISAS_UPDATE match declared semantics, Peter Maydell, 2017/07/17
- [Qemu-devel] [PULL 03/18] target/arm: Make Cortex-M3 and M4 default to 8 PMSA regions,
Peter Maydell <=
- [Qemu-devel] [PULL 01/18] qdev-properties.h: Explicitly set the default value for arraylen properties, Peter Maydell, 2017/07/17
- [Qemu-devel] [PULL 11/18] hw/char/cmsdk-apb-uart.c: Implement CMSDK APB UART, Peter Maydell, 2017/07/17
- [Qemu-devel] [PULL 02/18] qdev: support properties which don't set a default value, Peter Maydell, 2017/07/17
- [Qemu-devel] [PULL 09/18] target/arm: use DISAS_EXIT for eret handling, Peter Maydell, 2017/07/17
- Re: [Qemu-devel] [PULL 00/18] target-arm queue, no-reply, 2017/07/17
- Re: [Qemu-devel] [PULL 00/18] target-arm queue, Peter Maydell, 2017/07/18