qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Bellows <greg.bellows@linaro.org>
To: qemu-devel@nongnu.org, serge.fdrv@gmail.com,
	edgar.iglesias@gmail.com, aggelerf@ethz.ch,
	peter.maydell@linaro.org
Cc: greg.bellows@linaro.org
Subject: [Qemu-devel] [PATCH v9 25/26] target-arm: make MAIR0/1 banked
Date: Wed,  5 Nov 2014 17:23:12 -0600	[thread overview]
Message-ID: <1415229793-3278-26-git-send-email-greg.bellows@linaro.org> (raw)
In-Reply-To: <1415229793-3278-1-git-send-email-greg.bellows@linaro.org>

Added CP register info entries for the ARMv7 MAIR0/1 secure banks.

Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

---

v8 -> v9
- Added endianness support to the MAIR field structure definition.

v5 -> v6
- Changed _el field variants to be array based
---
 target-arm/cpu.h    | 21 ++++++++++++++++++++-
 target-arm/helper.c | 12 +++++++++---
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index e948ff0..781016a 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -296,7 +296,26 @@ typedef struct CPUARMState {
         uint32_t c9_pmxevtyper; /* perf monitor event type */
         uint32_t c9_pmuserenr; /* perf monitor user enable */
         uint32_t c9_pminten; /* perf monitor interrupt enables */
-        uint64_t mair_el1;
+        union { /* Memory attribute redirection */
+            struct {
+#ifdef HOST_WORDS_BIGENDIAN
+                uint64_t _unused_mair_0;
+                uint32_t mair1_ns;
+                uint32_t mair0_ns;
+                uint64_t _unused_mair_1;
+                uint32_t mair1_s;
+                uint32_t mair0_s;
+#else
+                uint64_t _unused_mair_0;
+                uint32_t mair0_ns;
+                uint32_t mair1_ns;
+                uint64_t _unused_mair_1;
+                uint32_t mair0_s;
+                uint32_t mair1_s;
+#endif
+            };
+            uint64_t mair_el[4];
+        };
         union { /* vector base address register */
             struct {
                 uint64_t _unused_vbar;
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 01e27f8..d04a3dc 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -965,20 +965,26 @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
      */
     { .name = "MAIR_EL1", .state = ARM_CP_STATE_AA64,
       .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 0,
-      .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.mair_el1),
+      .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.mair_el[1]),
       .resetvalue = 0 },
     /* For non-long-descriptor page tables these are PRRR and NMRR;
      * regardless they still act as reads-as-written for QEMU.
      * The override is necessary because of the overly-broad TLB_LOCKDOWN
      * definition.
      */
+     /* MAIR0/1 are defined seperately from their 64-bit counterpart which
+      * allows them to assign the correct fieldoffset based on the endianness
+      * handled in the field definitions.
+      */
     { .name = "MAIR0", .state = ARM_CP_STATE_AA32, .type = ARM_CP_OVERRIDE,
       .cp = 15, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 0, .access = PL1_RW,
-      .fieldoffset = offsetoflow32(CPUARMState, cp15.mair_el1),
+      .bank_fieldoffsets = { offsetof(CPUARMState, cp15.mair0_s),
+                             offsetof(CPUARMState, cp15.mair0_ns) },
       .resetfn = arm_cp_reset_ignore },
     { .name = "MAIR1", .state = ARM_CP_STATE_AA32, .type = ARM_CP_OVERRIDE,
       .cp = 15, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 1, .access = PL1_RW,
-      .fieldoffset = offsetofhigh32(CPUARMState, cp15.mair_el1),
+      .bank_fieldoffsets = { offsetof(CPUARMState, cp15.mair1_s),
+                             offsetof(CPUARMState, cp15.mair1_ns) },
       .resetfn = arm_cp_reset_ignore },
     { .name = "ISR_EL1", .state = ARM_CP_STATE_BOTH,
       .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 1, .opc2 = 0,
-- 
1.8.3.2

  parent reply	other threads:[~2014-11-05 23:24 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 23:22 [Qemu-devel] [PATCH v9 00/26] target-arm: add Security Extensions for CPUs Greg Bellows
2014-11-05 23:22 ` [Qemu-devel] [PATCH v9 01/26] target-arm: extend async excp masking Greg Bellows
2014-11-05 23:37   ` Peter Maydell
2014-11-06  1:29     ` Greg Bellows
2014-11-05 23:22 ` [Qemu-devel] [PATCH v9 02/26] target-arm: add async excp target_el function Greg Bellows
2014-11-05 23:22 ` [Qemu-devel] [PATCH v9 03/26] target-arm: add banked register accessors Greg Bellows
2014-11-05 23:22 ` [Qemu-devel] [PATCH v9 04/26] target-arm: add non-secure Translation Block flag Greg Bellows
2014-11-05 23:22 ` [Qemu-devel] [PATCH v9 05/26] target-arm: add CPREG secure state support Greg Bellows
2014-11-05 23:22 ` [Qemu-devel] [PATCH v9 06/26] target-arm: add secure state bit to CPREG hash Greg Bellows
2014-11-05 23:22 ` [Qemu-devel] [PATCH v9 07/26] target-arm: insert AArch32 cpregs twice into hashtable Greg Bellows
2014-11-05 23:22 ` [Qemu-devel] [PATCH v9 08/26] target-arm: move AArch32 SCR into security reglist Greg Bellows
2014-11-05 23:22 ` [Qemu-devel] [PATCH v9 09/26] target-arm: implement IRQ/FIQ routing to Monitor mode Greg Bellows
2014-11-05 23:22 ` [Qemu-devel] [PATCH v9 10/26] target-arm: add NSACR register Greg Bellows
2014-11-05 23:22 ` [Qemu-devel] [PATCH v9 11/26] target-arm: add SDER definition Greg Bellows
2014-11-05 23:22 ` [Qemu-devel] [PATCH v9 12/26] target-arm: add MVBAR support Greg Bellows
2014-11-05 23:23 ` [Qemu-devel] [PATCH v9 13/26] target-arm: add SCTLR_EL3 and make SCTLR banked Greg Bellows
2014-11-05 23:23 ` [Qemu-devel] [PATCH v9 14/26] target-arm: respect SCR.FW, SCR.AW and SCTLR.NMFI Greg Bellows
2014-11-05 23:23 ` [Qemu-devel] [PATCH v9 15/26] target-arm: make CSSELR banked Greg Bellows
2014-11-05 23:23 ` [Qemu-devel] [PATCH v9 16/26] target-arm: make TTBR0/1 banked Greg Bellows
2014-11-05 23:23 ` [Qemu-devel] [PATCH v9 17/26] target-arm: make TTBCR banked Greg Bellows
2014-11-05 23:23 ` [Qemu-devel] [PATCH v9 18/26] target-arm: make DACR banked Greg Bellows
2014-11-05 23:23 ` [Qemu-devel] [PATCH v9 19/26] target-arm: make IFSR banked Greg Bellows
2014-11-05 23:23 ` [Qemu-devel] [PATCH v9 20/26] target-arm: make DFSR banked Greg Bellows
2014-11-05 23:23 ` [Qemu-devel] [PATCH v9 21/26] target-arm: make IFAR/DFAR banked Greg Bellows
2014-11-05 23:23 ` [Qemu-devel] [PATCH v9 22/26] target-arm: make PAR banked Greg Bellows
2014-11-05 23:23 ` [Qemu-devel] [PATCH v9 23/26] target-arm: make VBAR banked Greg Bellows
2014-11-05 23:23 ` [Qemu-devel] [PATCH v9 24/26] target-arm: make c13 cp regs banked (FCSEIDR, ...) Greg Bellows
2014-11-05 23:23 ` Greg Bellows [this message]
2014-11-05 23:23 ` [Qemu-devel] [PATCH v9 26/26] target-arm: add cpu feature EL3 to CPUs with Security Extensions Greg Bellows

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415229793-3278-26-git-send-email-greg.bellows@linaro.org \
    --to=greg.bellows@linaro.org \
    --cc=aggelerf@ethz.ch \
    --cc=edgar.iglesias@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=serge.fdrv@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).