All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Peter Crosthwaite" <peter.crosthwaite@xilinx.com>,
	patches@linaro.org, "Alexander Graf" <agraf@suse.de>,
	"Greg Bellows" <greg.bellows@linaro.org>,
	"Laurent Desnogues" <laurent.desnogues@gmail.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	kvmarm@lists.cs.columbia.edu,
	"Christoffer Dall" <christoffer.dall@linaro.org>,
	"Richard Henderson" <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH v6 24/37] target-arm: Implement AArch64 view of CONTEXTIDR
Date: Thu, 10 Apr 2014 17:15:23 +0100	[thread overview]
Message-ID: <1397146536-30116-25-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1397146536-30116-1-git-send-email-peter.maydell@linaro.org>

Implement AArch64 view of the CONTEXTIDR register.
We tighten up the condition when we flush the TLB on a CONTEXTIDR
write to avoid needlessly flushing the TLB every time on a 64
bit system (and also on a 32 bit system using LPAE, as a bonus).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target-arm/cpu.h    |  2 +-
 target-arm/helper.c | 33 ++++++++++++++++++---------------
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index ec0306b..d0f42fd 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -201,7 +201,7 @@ typedef struct CPUARMState {
         uint64_t mair_el1;
         uint64_t c12_vbar; /* vector base address register */
         uint32_t c13_fcse; /* FCSE PID.  */
-        uint32_t c13_context; /* Context ID.  */
+        uint64_t contextidr_el1; /* Context ID.  */
         uint64_t tpidr_el0; /* User RW Thread register.  */
         uint64_t tpidrro_el0; /* User RO Thread register.  */
         uint64_t tpidr_el1; /* Privileged Thread register.  */
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 655c5ab..10300aa 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -304,6 +304,17 @@ void init_cpreg_list(ARMCPU *cpu)
     g_list_free(keys);
 }
 
+/* Return true if extended addresses are enabled.
+ * This is always the case if our translation regime is 64 bit,
+ * but depends on TTBCR.EAE for 32 bit.
+ */
+static inline bool extended_addresses_enabled(CPUARMState *env)
+{
+    return arm_el_is_aa64(env, 1)
+        || ((arm_feature(env, ARM_FEATURE_LPAE)
+             && (env->cp15.c2_control & (1U << 31))));
+}
+
 static void dacr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
 {
     ARMCPU *cpu = arm_env_get_cpu(env);
@@ -330,14 +341,15 @@ static void contextidr_write(CPUARMState *env, const ARMCPRegInfo *ri,
 {
     ARMCPU *cpu = arm_env_get_cpu(env);
 
-    if (env->cp15.c13_context != value && !arm_feature(env, ARM_FEATURE_MPU)) {
+    if (env->cp15.contextidr_el1 != value && !arm_feature(env, ARM_FEATURE_MPU)
+        && !extended_addresses_enabled(env)) {
         /* For VMSA (when not using the LPAE long descriptor page table
          * format) this register includes the ASID, so do a TLB flush.
          * For PMSA it is purely a process ID and no action is needed.
          */
         tlb_flush(CPU(cpu), 1);
     }
-    env->cp15.c13_context = value;
+    env->cp15.contextidr_el1 = value;
 }
 
 static void tlbiall_write(CPUARMState *env, const ARMCPRegInfo *ri,
@@ -391,8 +403,10 @@ static const ARMCPRegInfo cp_reginfo[] = {
     { .name = "FCSEIDR", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 0,
       .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.c13_fcse),
       .resetvalue = 0, .writefn = fcse_write, .raw_writefn = raw_write, },
-    { .name = "CONTEXTIDR", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 1,
-      .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.c13_context),
+    { .name = "CONTEXTIDR", .state = ARM_CP_STATE_BOTH,
+      .opc0 = 3, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 1,
+      .access = PL1_RW,
+      .fieldoffset = offsetof(CPUARMState, cp15.contextidr_el1),
       .resetvalue = 0, .writefn = contextidr_write, .raw_writefn = raw_write, },
     /* ??? This covers not just the impdef TLB lockdown registers but also
      * some v7VMSA registers relating to TEX remap, so it is overly broad.
@@ -1155,17 +1169,6 @@ static void par_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
 #ifndef CONFIG_USER_ONLY
 /* get_phys_addr() isn't present for user-mode-only targets */
 
-/* Return true if extended addresses are enabled.
- * This is always the case if our translation regime is 64 bit,
- * but depends on TTBCR.EAE for 32 bit.
- */
-static inline bool extended_addresses_enabled(CPUARMState *env)
-{
-    return arm_el_is_aa64(env, 1)
-        || ((arm_feature(env, ARM_FEATURE_LPAE)
-             && (env->cp15.c2_control & (1U << 31))));
-}
-
 static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri)
 {
     if (ri->opc2 & 4) {
-- 
1.9.1

  parent reply	other threads:[~2014-04-10 16:15 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-10 16:14 [Qemu-devel] [PATCH v6 00/37] AArch64 system emulation Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 01/37] target-arm: Split out private-to-target functions into internals.h Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 02/37] target-arm: Implement AArch64 DAIF system register Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 03/37] target-arm: Define exception record for AArch64 exceptions Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 04/37] target-arm: Provide correct syndrome information for cpreg access traps Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 05/37] target-arm: Add support for generating exceptions with syndrome information Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 06/37] target-arm: Provide syndrome information for MMU faults Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 07/37] target-arm: A64: Correctly fault FP/Neon if CPACR.FPEN set Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 08/37] target-arm: A64: Add assertion that FP access was checked Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 09/37] target-arm: Fix VFP enables for AArch32 EL0 under AArch64 EL1 Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 10/37] target-arm: Add v8 mmu translation support Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 11/37] target-arm: Don't mention PMU in debug feature register Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 12/37] target-arm: A64: Implement DC ZVA Peter Maydell
2014-04-10 17:22   ` Richard Henderson
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 13/37] target-arm: Use dedicated CPU state fields for ARM946 access bit registers Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 14/37] target-arm: Implement AArch64 views of fault status and data registers Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 15/37] target-arm: Add AArch64 ELR_EL1 register Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 16/37] target-arm: Implement SP_EL0, SP_EL1 Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 17/37] target-arm: Implement AArch64 SPSR_EL1 Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 18/37] target-arm: Move arm_log_exception() into internals.h Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 19/37] target-arm: Implement AArch64 EL1 exception handling Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 20/37] target-arm: Implement ARMv8 MVFR registers Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 21/37] target-arm: Add Cortex-A57 processor Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 22/37] hw/arm/virt: Add support for Cortex-A57 Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 23/37] target-arm: Implement AArch64 views of AArch32 ID registers Peter Maydell
2014-04-10 16:15 ` Peter Maydell [this message]
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 25/37] target-arm: Implement AArch64 view of ACTLR Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 26/37] target-arm: Implement ISR_EL1 register Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 27/37] target-arm: Remove THUMB2EE feature from AArch64 'any' CPU Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 28/37] target-arm: Don't expose wildcard ID register definitions for ARMv8 Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 29/37] target-arm: Replace wildcarded cpreg definitions with precise ones " Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 30/37] target-arm: Implement auxiliary fault status registers Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 31/37] target-arm: Implement AArch64 address translation operations Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 32/37] target-arm: Implement RVBAR register Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 33/37] target-arm: Implement Cortex-A57 implementation-defined system registers Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 34/37] target-arm: Implement CBAR for Cortex-A57 Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 35/37] target-arm: Make Cortex-A15 CBAR read-only Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 36/37] target-arm: Handle the CPU being in AArch32 mode in the AArch64 set_pc Peter Maydell
2014-04-10 16:15 ` [Qemu-devel] [PATCH v6 37/37] target-arm: Dump 32-bit CPU state if 64 bit CPU is in AArch32 Peter Maydell
2014-04-10 22:43 ` [Qemu-devel] [PATCH v6 00/37] AArch64 system emulation Peter Crosthwaite

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=1397146536-30116-25-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=agraf@suse.de \
    --cc=alex.bennee@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=greg.bellows@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=laurent.desnogues@gmail.com \
    --cc=patches@linaro.org \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.