[PATCH 04/16] hw/arm/armv7m: forward pmsav7-rbar-align-down to the CPU

Kyle Fox <[email protected]>
Newsgroups org.nongnu.qemu-arm,org.nongnu.qemu-devel
Message-ID <[email protected]>
Forward the opt-in "pmsav7-rbar-align-down" property to the CPU object,
following the existing init-svtor / vfp / dsp forwarding pattern, so an
SoC integrating a PMSAv7 core whose firmware relies on the align-down
behaviour can enable it.

Signed-off-by: Kyle Fox <[email protected]>
---
 hw/arm/armv7m.c         | 8 ++++++++
 include/hw/arm/armv7m.h | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
index 68a1cbd6316..bb0f95d423d 100644
--- a/hw/arm/armv7m.c
+++ b/hw/arm/armv7m.c
@@ -332,6 +332,12 @@ static void armv7m_realize(DeviceState *dev, Error **errp)
             return;
         }
     }
+    if (object_property_find(OBJECT(s->cpu), "pmsav7-rbar-align-down")) {
+        if (!object_property_set_bool(OBJECT(s->cpu), "pmsav7-rbar-align-down",
+                                      s->pmsav7_rbar_align_down, errp)) {
+            return;
+        }
+    }
     object_property_set_bool(OBJECT(s->cpu), "start-powered-off",
                              s->start_powered_off, &error_abort);
 
@@ -562,6 +568,8 @@ static const Property armv7m_properties[] = {
                      false),
     DEFINE_PROP_BOOL("vfp", ARMv7MState, vfp, true),
     DEFINE_PROP_BOOL("dsp", ARMv7MState, dsp, true),
+    DEFINE_PROP_BOOL("pmsav7-rbar-align-down", ARMv7MState,
+                     pmsav7_rbar_align_down, false),
     DEFINE_PROP_UINT32("mpu-ns-regions", ARMv7MState, mpu_ns_regions, UINT_MAX),
     DEFINE_PROP_UINT32("mpu-s-regions", ARMv7MState, mpu_s_regions, UINT_MAX),
 };
diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h
index 70555962bb9..23cfed222c1 100644
--- a/include/hw/arm/armv7m.h
+++ b/include/hw/arm/armv7m.h
@@ -52,6 +52,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(ARMv7MState, ARMV7M)
  * + Property "init-nsvtor": non-secure VTOR reset value (forwarded to CPU object)
  * + Property "vfp": enable VFP (forwarded to CPU object)
  * + Property "dsp": enable DSP (forwarded to CPU object)
+ * + Property "pmsav7-rbar-align-down": align down a misaligned PMSAv7 MPU
+ *   region base rather than treating it as UNPREDICTABLE (forwarded to the
+ *   CPU object, which only offers it on PMSAv7 cores)
  * + Property "enable-bitband": expose bitbanded IO
  * + Property "mpu-ns-regions": number of Non-Secure MPU regions (forwarded
  *   to CPU object pmsav7-dregion property; default is whatever the default
@@ -108,6 +111,7 @@ struct ARMv7MState {
     bool start_powered_off;
     bool vfp;
     bool dsp;
+    bool pmsav7_rbar_align_down;
 };
 
 #endif
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.