qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 02/32] target/arm: Add "_S" suffix to the secure version of a sysreg
Date: Fri, 18 May 2018 18:19:39 +0100	[thread overview]
Message-ID: <20180518172009.14416-3-peter.maydell@linaro.org> (raw)
In-Reply-To: <20180518172009.14416-1-peter.maydell@linaro.org>

From: Abdallah Bouassida <abdallah.bouassida@lauterbach.com>

This is a preparation for the coming feature of creating dynamically an XML
description for the ARM sysregs.
Add "_S" suffix to the secure version of sysregs that have both S and NS views
Replace (S) and (NS) by _S and _NS for the register that are manually defined,
so all the registers follow the same convention.

Signed-off-by: Abdallah Bouassida <abdallah.bouassida@lauterbach.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 1524153386-3550-3-git-send-email-abdallah.bouassida@lauterbach.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 118422b92c..369292c8b0 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -690,12 +690,12 @@ static const ARMCPRegInfo cp_reginfo[] = {
      * the secure register to be properly reset and migrated. There is also no
      * v8 EL1 version of the register so the non-secure instance stands alone.
      */
-    { .name = "FCSEIDR(NS)",
+    { .name = "FCSEIDR",
       .cp = 15, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 0,
       .access = PL1_RW, .secure = ARM_CP_SECSTATE_NS,
       .fieldoffset = offsetof(CPUARMState, cp15.fcseidr_ns),
       .resetvalue = 0, .writefn = fcse_write, .raw_writefn = raw_write, },
-    { .name = "FCSEIDR(S)",
+    { .name = "FCSEIDR_S",
       .cp = 15, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 0,
       .access = PL1_RW, .secure = ARM_CP_SECSTATE_S,
       .fieldoffset = offsetof(CPUARMState, cp15.fcseidr_s),
@@ -711,7 +711,7 @@ static const ARMCPRegInfo cp_reginfo[] = {
       .access = PL1_RW, .secure = ARM_CP_SECSTATE_NS,
       .fieldoffset = offsetof(CPUARMState, cp15.contextidr_el[1]),
       .resetvalue = 0, .writefn = contextidr_write, .raw_writefn = raw_write, },
-    { .name = "CONTEXTIDR(S)", .state = ARM_CP_STATE_AA32,
+    { .name = "CONTEXTIDR_S", .state = ARM_CP_STATE_AA32,
       .cp = 15, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 1,
       .access = PL1_RW, .secure = ARM_CP_SECSTATE_S,
       .fieldoffset = offsetof(CPUARMState, cp15.contextidr_s),
@@ -1981,7 +1981,7 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
                                    cp15.c14_timer[GTIMER_PHYS].ctl),
       .writefn = gt_phys_ctl_write, .raw_writefn = raw_write,
     },
-    { .name = "CNTP_CTL(S)",
+    { .name = "CNTP_CTL_S",
       .cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 1,
       .secure = ARM_CP_SECSTATE_S,
       .type = ARM_CP_IO | ARM_CP_ALIAS, .access = PL1_RW | PL0_R,
@@ -2020,7 +2020,7 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
       .accessfn = gt_ptimer_access,
       .readfn = gt_phys_tval_read, .writefn = gt_phys_tval_write,
     },
-    { .name = "CNTP_TVAL(S)",
+    { .name = "CNTP_TVAL_S",
       .cp = 15, .crn = 14, .crm = 2, .opc1 = 0, .opc2 = 0,
       .secure = ARM_CP_SECSTATE_S,
       .type = ARM_CP_NO_RAW | ARM_CP_IO, .access = PL1_RW | PL0_R,
@@ -2074,7 +2074,7 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
       .accessfn = gt_ptimer_access,
       .writefn = gt_phys_cval_write, .raw_writefn = raw_write,
     },
-    { .name = "CNTP_CVAL(S)", .cp = 15, .crm = 14, .opc1 = 2,
+    { .name = "CNTP_CVAL_S", .cp = 15, .crm = 14, .opc1 = 2,
       .secure = ARM_CP_SECSTATE_S,
       .access = PL1_RW | PL0_R,
       .type = ARM_CP_64BIT | ARM_CP_IO | ARM_CP_ALIAS,
@@ -5577,7 +5577,8 @@ CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
 
 static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r,
                                    void *opaque, int state, int secstate,
-                                   int crm, int opc1, int opc2)
+                                   int crm, int opc1, int opc2,
+                                   const char *name)
 {
     /* Private utility function for define_one_arm_cp_reg_with_opaque():
      * add a single reginfo struct to the hash table.
@@ -5587,6 +5588,7 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r,
     int is64 = (r->type & ARM_CP_64BIT) ? 1 : 0;
     int ns = (secstate & ARM_CP_SECSTATE_NS) ? 1 : 0;
 
+    r2->name = g_strdup(name);
     /* Reset the secure state to the specific incoming state.  This is
      * necessary as the register may have been defined with both states.
      */
@@ -5818,19 +5820,24 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu,
                         /* Under AArch32 CP registers can be common
                          * (same for secure and non-secure world) or banked.
                          */
+                        char *name;
+
                         switch (r->secure) {
                         case ARM_CP_SECSTATE_S:
                         case ARM_CP_SECSTATE_NS:
                             add_cpreg_to_hashtable(cpu, r, opaque, state,
-                                                   r->secure, crm, opc1, opc2);
+                                                   r->secure, crm, opc1, opc2,
+                                                   r->name);
                             break;
                         default:
+                            name = g_strdup_printf("%s_S", r->name);
                             add_cpreg_to_hashtable(cpu, r, opaque, state,
                                                    ARM_CP_SECSTATE_S,
-                                                   crm, opc1, opc2);
+                                                   crm, opc1, opc2, name);
+                            g_free(name);
                             add_cpreg_to_hashtable(cpu, r, opaque, state,
                                                    ARM_CP_SECSTATE_NS,
-                                                   crm, opc1, opc2);
+                                                   crm, opc1, opc2, r->name);
                             break;
                         }
                     } else {
@@ -5838,7 +5845,7 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu,
                          * of AArch32 */
                         add_cpreg_to_hashtable(cpu, r, opaque, state,
                                                ARM_CP_SECSTATE_NS,
-                                               crm, opc1, opc2);
+                                               crm, opc1, opc2, r->name);
                     }
                 }
             }
-- 
2.17.0

  parent reply	other threads:[~2018-05-18 17:20 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18 17:19 [Qemu-devel] [PULL 00/32] target-arm queue Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 01/32] target/arm: Add "ARM_CP_NO_GDB" as a new bit field for ARMCPRegInfo type Peter Maydell
2018-05-18 17:19 ` Peter Maydell [this message]
2018-05-18 17:19 ` [Qemu-devel] [PULL 03/32] target/arm: Add the XML dynamic generation Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 04/32] xlnx-zdma: Add a model of the Xilinx ZynqMP generic DMA Peter Maydell
2018-05-25 13:51   ` Peter Maydell
2018-05-25 16:24     ` francisco iglesias
2018-05-25 13:57   ` Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 05/32] xlnx-zynqmp: Connect the ZynqMP GDMA and ADMA Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 06/32] hw/arm/smmuv3: Fix Coverity issue in smmuv3_record_event Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 07/32] hw/arm/smmu-common: Fix coverity issue in get_block_pte_address Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 08/32] target/arm: Introduce translate-a64.h Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 09/32] target/arm: Add SVE decode skeleton Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 10/32] target/arm: Implement SVE Bitwise Logical - Unpredicated Group Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 11/32] target/arm: Implement SVE load vector/predicate Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 12/32] target/arm: Implement SVE predicate test Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 13/32] target/arm: Implement SVE Predicate Logical Operations Group Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 14/32] target/arm: Implement SVE Predicate Misc Group Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 15/32] target/arm: Implement SVE Integer Binary Arithmetic - Predicated Group Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 16/32] target/arm: Implement SVE Integer Reduction Group Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 17/32] target/arm: Implement SVE bitwise shift by immediate (predicated) Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 18/32] target/arm: Implement SVE bitwise shift by vector (predicated) Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 19/32] target/arm: Implement SVE bitwise shift by wide elements (predicated) Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 20/32] target/arm: Implement SVE Integer Arithmetic - Unary Predicated Group Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 21/32] target/arm: Implement SVE Integer Multiply-Add Group Peter Maydell
2018-05-18 17:19 ` [Qemu-devel] [PULL 22/32] target/arm: Implement SVE Integer Arithmetic - Unpredicated Group Peter Maydell
2018-05-18 17:20 ` [Qemu-devel] [PULL 23/32] target/arm: Implement SVE Index Generation Group Peter Maydell
2018-05-18 17:20 ` [Qemu-devel] [PULL 24/32] target/arm: Implement SVE Stack Allocation Group Peter Maydell
2018-05-18 17:20 ` [Qemu-devel] [PULL 25/32] target/arm: Implement SVE Bitwise Shift - Unpredicated Group Peter Maydell
2018-05-18 17:20 ` [Qemu-devel] [PULL 26/32] target/arm: Implement SVE Compute Vector Address Group Peter Maydell
2018-05-18 17:20 ` [Qemu-devel] [PULL 27/32] target/arm: Implement SVE floating-point exponential accelerator Peter Maydell
2018-05-18 17:20 ` [Qemu-devel] [PULL 28/32] target/arm: Implement SVE floating-point trig select coefficient Peter Maydell
2018-05-18 17:20 ` [Qemu-devel] [PULL 29/32] target/arm: Implement SVE Element Count Group Peter Maydell
2018-05-18 17:20 ` [Qemu-devel] [PULL 30/32] target/arm: Implement SVE Bitwise Immediate Group Peter Maydell
2018-05-18 17:20 ` [Qemu-devel] [PULL 31/32] target/arm: Implement SVE Integer Wide Immediate - Predicated Group Peter Maydell
2018-05-18 17:20 ` [Qemu-devel] [PULL 32/32] target/arm: Implement SVE Permute - Extract Group Peter Maydell
2018-05-18 18:48 ` [Qemu-devel] [PULL 00/32] target-arm queue Peter Maydell

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=20180518172009.14416-3-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).