Skip to contentSkip to conversation

ARM: make possible to use high vectors for reset exception

RFC In review Antony Pavlov 2 participants 5 messages Dec 10, 2013 – Dec 11, 2013

lore
Share & tools
lore
#0 lore raw

v2 cover ARM: make possible to use high vectors for reset exception

[RFC v2 1/2] ARM: cpu: add "reset_hivecs" property (high vectors on [RFC v2 2/2] ARM: arm_cpu_reset: make possible to use high vectors

Changes since v1:
* rebase over Peter Crosthwaite's "Fix Support for ARM A9 CBAR" v3 series;
* rewrite according to Peter Crosthwaite's and Peter Maydell's comments.

#1 lore raw

RFC v2 1/2 ARM: cpu: add "reset_hivecs" property (high vectors on reset)

---
 target-arm/cpu-qom.h |  1 +
 target-arm/cpu.c     | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+)
target-arm/cpu-qom.h +1 -0
index b55306a..116320c 100644
@@ -128,6 +128,7 @@ typedef struct ARMCPU {
     uint32_t ccsidr[16];
     uint32_t reset_cbar;
     uint32_t reset_auxcr;
+    bool reset_hivecs;
 } ARMCPU;
 
 #define TYPE_AARCH64_CPU "aarch64-cpu"
target-arm/cpu.c +24 -0
index cbe108b..b60e3fc 100644
@@ -224,6 +224,20 @@ static void arm_cpu_initfn(Object *obj)
     }
 }
 
+static bool reset_hivecs_get(Object *obj, Error **err)
+{
+    ARMCPU *cpu = ARM_CPU(obj);
+
+    return cpu->reset_hivecs;
+}
+
+static void reset_hivecs_set(Object *obj, bool value, Error **err)
+{
+    ARMCPU *cpu = ARM_CPU(obj);
+
+    cpu->reset_hivecs = value;
+}
+
 static void arm_cpu_post_init(Object *obj)
 {
     ARMCPU *cpu = ARM_CPU(obj);
@@ -234,6 +248,12 @@ static void arm_cpu_post_init(Object *obj)
                                        &err);
         assert_no_error(err);
     }
+
+    if (!arm_feature(&cpu->env, ARM_FEATURE_M)) {
+        object_property_add_bool(obj, "reset-hivecs",
+            reset_hivecs_get, reset_hivecs_set, &err);
+        assert_no_error(err);
+    }
 }
 
 static void arm_cpu_finalizefn(Object *obj)
@@ -295,6 +315,10 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
         set_feature(env, ARM_FEATURE_PXN);
     }
 
+    if (cpu->reset_hivecs) {
+            cpu->reset_sctlr |= (1 << 13);
+    }
+
     register_cp_regs_for_features(cpu);
     arm_cpu_register_gdb_regs_for_features(cpu);
 
Signature · 1 line
1.8.5
#2 lore raw

Re: [Qemu-devel] [RFC v2 1/2] ARM: cpu: add "reset_hivecs" property (high vectors on reset)

Quoted 30 lines · Antony Pavlov
---
 target-arm/cpu-qom.h |  1 +
 target-arm/cpu.c     | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+)
target-arm/cpu-qom.h +1 -0
index b55306a..116320c 100644
@@ -128,6 +128,7 @@ typedef struct ARMCPU {
     uint32_t ccsidr[16];
     uint32_t reset_cbar;
     uint32_t reset_auxcr;
+    bool reset_hivecs;
 } ARMCPU;
 
 #define TYPE_AARCH64_CPU "aarch64-cpu"
target-arm/cpu.c +4 -0
index cbe108b..b60e3fc 100644
@@ -224,6 +224,20 @@ static void arm_cpu_initfn(Object *obj)
     }
 }
 
+static bool reset_hivecs_get(Object *obj, Error **err)
+{
+    ARMCPU *cpu = ARM_CPU(obj);
+

target-arm/cpu.c static void arm_cpu_initfn(Object *obj) · line 240

Quoted 10 lines
target-arm/cpu.c +10 -0
+    return cpu->reset_hivecs;
+}
+
+static void reset_hivecs_set(Object *obj, bool value, Error **err)
+{
+    ARMCPU *cpu = ARM_CPU(obj);
+
+    cpu->reset_hivecs = value;
+}
+

This is a boiler-plate setter/getter that really should be in QOM core. We don't want to have to do this for every boolean property. I've spun a predecessor patch to do this and cleaned this up.

Regards,
Peter

Quoted 31 lines
target-arm/cpu.c +10 -1
 static void arm_cpu_post_init(Object *obj)
 {
     ARMCPU *cpu = ARM_CPU(obj);
@@ -234,6 +248,12 @@ static void arm_cpu_post_init(Object *obj)
                                        &err);
         assert_no_error(err);
     }
+
+    if (!arm_feature(&cpu->env, ARM_FEATURE_M)) {
+        object_property_add_bool(obj, "reset-hivecs",
+            reset_hivecs_get, reset_hivecs_set, &err);
+        assert_no_error(err);
+    }
 }
 
 static void arm_cpu_finalizefn(Object *obj)
@@ -295,6 +315,10 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
         set_feature(env, ARM_FEATURE_PXN);
     }
 
+    if (cpu->reset_hivecs) {
+            cpu->reset_sctlr |= (1 << 13);
+    }
+
     register_cp_regs_for_features(cpu);
     arm_cpu_register_gdb_regs_for_features(cpu);
 
--

1.8.5

#3 lore raw

RFC v2 2/2 ARM: arm_cpu_reset: make possible to use high vectors for reset_exc

In reply to Antony Pavlov
---
 target-arm/cpu.c | 5 +++++
 1 file changed, 5 insertions(+)
target-arm/cpu.c +5 -0
index b60e3fc..b6199c5 100644
@@ -120,6 +120,11 @@ static void arm_cpu_reset(CPUState *s)
             env->regs[15] = pc & ~1;
         }
     }
+
+    if (env->cp15.c1_sys & (1 << 13)) {
+            env->regs[15] = 0xFFFF0000;
+    }
+
     env->vfp.xregs[ARM_VFP_FPEXC] = 0;
 #endif
     set_flush_to_zero(1, &env->vfp.standard_fp_status);
Signature · 1 line
1.8.5
#4 lore raw
In reply to Antony Pavlov
Quoted 7 lines · Antony Pavlov

[RFC v2 1/2] ARM: cpu: add "reset_hivecs" property (high vectors on [RFC v2 2/2] ARM: arm_cpu_reset: make possible to use high vectors

Changes since v1:
* rebase over Peter Crosthwaite's "Fix Support for ARM A9 CBAR" v3 series;
* rewrite according to Peter Crosthwaite's and Peter Maydell's comments.

I have added this to the end of my series with some changes.

Regards,
Peter