qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH 3/4] target/arm: Install ASIDs for short-form from EL1
Date: Mon, 29 Oct 2018 15:53:38 +0000	[thread overview]
Message-ID: <20181029155339.15280-4-richard.henderson@linaro.org> (raw)
In-Reply-To: <20181029155339.15280-1-richard.henderson@linaro.org>

This is less complex than the LPAE case, but still we now avoid the
flush in case it is only the PROCID field that is changing.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/helper.c | 34 ++++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 26d6f28793..f767467dcf 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -541,17 +541,31 @@ static void fcse_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
 static void contextidr_write(CPUARMState *env, const ARMCPRegInfo *ri,
                              uint64_t value)
 {
-    ARMCPU *cpu = arm_env_get_cpu(env);
-
-    if (raw_read(env, ri) != value && !arm_feature(env, ARM_FEATURE_PMSA)
-        && !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));
-    }
     raw_write(env, ri, value);
+
+    /*
+     * For VMSA (when not using the LPAE long descriptor page table format)
+     * this register includes the ASID.  For PMSA it is purely a process ID
+     * and no action is needed.
+     */
+    if (!arm_feature(env, ARM_FEATURE_PMSA) &&
+        !extended_addresses_enabled(env)) {
+        CPUState *cs = CPU(arm_env_get_cpu(env));
+        int asid = extract32(value, 0, 8);
+        int idxmask;
+
+        switch (ri->secure) {
+        case ARM_CP_SECSTATE_S:
+            idxmask = ARMMMUIdxBit_S1SE1 | ARMMMUIdxBit_S1SE0;
+            break;
+        case ARM_CP_SECSTATE_NS:
+            idxmask = ARMMMUIdxBit_S12NSE1 | ARMMMUIdxBit_S12NSE0;
+            break;
+        default:
+            g_assert_not_reached();
+        }
+        tlb_set_asid_for_mmuidx(cs, asid, idxmask, 0);
+    }
 }
 
 /* IS variants of TLB operations must affect all cores */
-- 
2.17.2

  parent reply	other threads:[~2018-10-29 15:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29 15:53 [Qemu-devel] [PATCH 0/4] target/arm: Minimize TLB flushing for ASID changes Richard Henderson
2018-10-29 15:53 ` [Qemu-devel] [PATCH 1/4] cputlb: Add tlb_set_asid_for_mmuidx Richard Henderson
2018-11-15 18:36   ` Peter Maydell
2018-11-15 18:51     ` Richard Henderson
2018-11-15 18:56       ` Peter Maydell
2018-10-29 15:53 ` [Qemu-devel] [PATCH 2/4] target/arm: Install ASIDs for long-form from EL1 Richard Henderson
2018-10-29 15:53 ` Richard Henderson [this message]
2018-11-15 18:52   ` [Qemu-devel] [PATCH 3/4] target/arm: Install ASIDs for short-form " Peter Maydell
2018-11-16 13:47   ` Peter Maydell
2018-10-29 15:53 ` [Qemu-devel] [PATCH 4/4] target/arm: Install ASIDs for EL2 Richard Henderson
2018-11-15 18:38   ` Peter Maydell
2018-10-30 15:40 ` [Qemu-devel] [PATCH 0/4] target/arm: Minimize TLB flushing for ASID changes Emilio G. Cota
2018-11-05 16:30 ` Peter Maydell
2018-11-05 17:38   ` Richard Henderson
2018-11-15 18:25 ` 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=20181029155339.15280-4-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=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).