qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alvise Rigo <a.rigo@virtualopensystems.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	tech@virtualopensystems.com,
	Alvise Rigo <a.rigo@virtualopensystems.com>
Subject: [Qemu-devel] [PATCH v2 1/7] target-arm: Decouple AArch64 cp registers
Date: Tue, 18 Mar 2014 10:19:43 +0100	[thread overview]
Message-ID: <1395134389-25778-2-git-send-email-a.rigo@virtualopensystems.com> (raw)
In-Reply-To: <1395134389-25778-1-git-send-email-a.rigo@virtualopensystems.com>

Relying on the AArch64 views for the migration of cp registers values
makes impossible to have a successful migration between TCG and KVM
because the latter uses the AArch32 indexes format: force the AArch32
processor to not generate the cp registers belonging to the 64bit architecture.

Signed-off-by: Alvise Rigo <a.rigo@virtualopensystems.com>
---
 target-arm/helper.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/target-arm/helper.c b/target-arm/helper.c
index f65cbac..2791dac 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -2313,6 +2313,14 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r,
     /* Private utility function for define_one_arm_cp_reg_with_opaque():
      * add a single reginfo struct to the hash table.
      */
+    CPUARMState *env = &cpu->env;
+    int is_a64 = arm_feature(env, ARM_FEATURE_AARCH64);
+    if (((r->state == ARM_CP_STATE_BOTH && state == ARM_CP_STATE_AA64
+        && !is_a64) || (r->state == ARM_CP_STATE_AA64 && !is_a64))) {
+        /* no need of the AArch64 cp definition */
+        return;
+    }
+
     uint32_t *key = g_new(uint32_t, 1);
     ARMCPRegInfo *r2 = g_memdup(r, sizeof(ARMCPRegInfo));
     int is64 = (r->type & ARM_CP_64BIT) ? 1 : 0;
@@ -2322,9 +2330,12 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r,
          * view handles that. AArch64 also handles reset.
          * We assume it is a cp15 register.
          */
+        if (is_a64) {
+            /* this is an AArch64 view */
+            r2->type |= ARM_CP_NO_MIGRATE;
+            r2->resetfn = arm_cp_reset_ignore;
+        }
         r2->cp = 15;
-        r2->type |= ARM_CP_NO_MIGRATE;
-        r2->resetfn = arm_cp_reset_ignore;
 #ifdef HOST_WORDS_BIGENDIAN
         if (r2->fieldoffset) {
             r2->fieldoffset += sizeof(uint32_t);
-- 
1.8.3.2

  reply	other threads:[~2014-03-18  9:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18  9:19 [Qemu-devel] [PATCH v2 0/7] target-arm: KVM to TCG migration Alvise Rigo
2014-03-18  9:19 ` Alvise Rigo [this message]
2014-03-18  9:19 ` [Qemu-devel] [PATCH v2 2/7] target-arm: Migrate CCSIDR registers Alvise Rigo
2014-03-18  9:19 ` [Qemu-devel] [PATCH v2 3/7] target-arm: Add a way to mask some Alvise Rigo
2014-03-18  9:19 ` [Qemu-devel] [PATCH v2 4/7] target-arm: Exclude IC bit from L2CTLR Alvise Rigo
2014-03-18  9:19 ` [Qemu-devel] [PATCH v2 5/7] target-arm: Make TTBR0/1 and TTBRC cp Alvise Rigo
2014-03-18  9:19 ` [Qemu-devel] [PATCH v2 6/7] target-arm: Added ADFSR/AIFSR and REVIDR Alvise Rigo
2014-03-18  9:19 ` [Qemu-devel] [PATCH v2 7/7] target-arm: Minor cp registers changes Alvise Rigo

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=1395134389-25778-2-git-send-email-a.rigo@virtualopensystems.com \
    --to=a.rigo@virtualopensystems.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=tech@virtualopensystems.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).