From patchwork Fri Jul 19 21:03:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 169266 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4323291ilk; Fri, 19 Jul 2019 14:03:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgKRpj1RvWF7NgfjbNt0xyF4WVTD/pxNAaLzjj7hvQ7lbADFnUtL25CO5WqVa+F0DOAbti X-Received: by 2002:a05:6402:14d4:: with SMTP id f20mr47460354edx.125.1563570238715; Fri, 19 Jul 2019 14:03:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563570238; cv=none; d=google.com; s=arc-20160816; b=bTCtBMlwokcy2weQ10eAjB7mikwXmTBv/z5u7DaAw19hZmjoIXzRDUBgFqlP98z4Cl 7BEBT+TPHGCWJuAdTEjqNdNoUP+Pt6RgKwWEknZ7B6mRXYje5KutplqeCC6DoWw9USMv DwGWlqZWMc3F/Wc1aPOG43XDPW+8MTH+ntJw5CQw888STsmIOD6M5qW5Tg2RAhV5eUqJ VGi35fiZgNPXgnBkMoi6uv9sUWxyXflVbG4NtMKDNanY2dJV5MbPNUVybeOrz/hyxYku WI+lSxVEiQQhacPLoKXtDcJ3OlfT7HQja8ZKNxHGjavyVUF599Mixu72C1eXiBgox+nc n92w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=nZO9a9G7poP5q7QtQAMHuH2LEKdKZAUGfJYJRNmcsyc=; b=tTUUZV7giw+kZPa56a2+XMcLsyBUVyu4/oECIzkv8RD4osgtsLYp6eriMgwcHghkEe AuHR8gbI7WQa5LoaSqQDAbzYuyIXztet2N7iUImRKMyo6ajA3+H5JNdBrU/8LVI7/qCi P9WafEepuCmkRbji3gv/Gz1/piXU1ZMOs52rOH4vR/vqkZYG7KMIix2r6vZAglK3iJYn WiChNiwwD9Iy0Guf5IznMb60NTappLmlIaQvZy3n2//Fyduzr6CT/wVic4I7LJGOt+Sa 8Q6iaFPdH/9b4c/BCdT8JbrUPxvSi77AyCbGh/QUIODuIIEggwmvKHZWQkpq8dgJv+AA exeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hHYpspJp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a5si683081ejb.103.2019.07.19.14.03.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Jul 2019 14:03:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hHYpspJp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoa2n-0004Pu-A0 for patch@linaro.org; Fri, 19 Jul 2019 17:03:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54936) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoa2f-0004D5-Sx for qemu-devel@nongnu.org; Fri, 19 Jul 2019 17:03:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hoa2a-00059n-Mq for qemu-devel@nongnu.org; Fri, 19 Jul 2019 17:03:46 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:43522) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hoa2T-00056i-0R for qemu-devel@nongnu.org; Fri, 19 Jul 2019 17:03:39 -0400 Received: by mail-pf1-x443.google.com with SMTP id i189so14681887pfg.10 for ; Fri, 19 Jul 2019 14:03:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nZO9a9G7poP5q7QtQAMHuH2LEKdKZAUGfJYJRNmcsyc=; b=hHYpspJplVd0JkXAIgRW60Gau36EXQSETX/w2u6+SeJJIZ5OakTIj3WK/cXtnDVi4m x/sHKibKk1ydWnvm06RDouvOvjOrBEMfX3Em93+nBQAk//YEhiMGLN5RNFDzt76dptgJ 6Ekgtwnba0L0MxrnGuf0MTpNM9sC7olS+F333ETK7KPPTGAbv9WHESkYAZF0MvgCMu7S JJFw/wk3AAbbsYfs61SLOSDXfB2zzacsu6mfzDc7993MOc2CZgRCQ9vAsefMofFIVbu7 Zxptg0mQhjO/fo/iWxO0Yspzv9/pvX0scEXJIfabiVPdNIpTYqXsTOx+Z944E5/alR37 AxcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nZO9a9G7poP5q7QtQAMHuH2LEKdKZAUGfJYJRNmcsyc=; b=rVIWAX9hS3DGcer+D4GNLbUVAN4NPf3oH3ospqKempLcNkpH7glgYjpYqC0QZn5lei YBv5HszwWhdeAqIpdMt5wO5+FUtBIuuBLKjPGQ1w5+oVtj1bMTMjiXIaNkKILHerpIAy 9a6QUxCImePVXTmkcoOnl9i/zhURb1mBuYMFY20GkF9H14wIRJ7vqyDG87JeWaacFr/H ILUbauc8ZKXI2Ipei4Ob3zc3Oc66eltgd02X1xKsgnyy5YJVR5+le1AW+1MAQcADK09L nlbW/HrG8ZOxT5Dx212JGjot9FLfGd/45kNVxP+74g48oyIJ1HKtIOGvZcljBDRV043o z/cg== X-Gm-Message-State: APjAAAWtkA5Ni8LPm7bB0UWyBbVQsaHBudmL1BGHNiCzoiqMk/+MTlqy 90D5JCrjyqhb+KBn7q50j/0jgJVe0lU= X-Received: by 2002:a63:fa4e:: with SMTP id g14mr55915460pgk.237.1563570213368; Fri, 19 Jul 2019 14:03:33 -0700 (PDT) Received: from localhost.localdomain (97-126-117-207.tukw.qwest.net. [97.126.117.207]) by smtp.gmail.com with ESMTPSA id i6sm32724751pgi.40.2019.07.19.14.03.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 19 Jul 2019 14:03:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 19 Jul 2019 14:03:06 -0700 Message-Id: <20190719210326.15466-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190719210326.15466-1-richard.henderson@linaro.org> References: <20190719210326.15466-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PATCH for-4.2 04/24] target/arm: Install ASIDs for short-form from EL1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, beata.michalska@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- target/arm/helper.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) -- 2.17.1 Reviewed-by: Alex Bennée diff --git a/target/arm/helper.c b/target/arm/helper.c index 0f21a077de..1ed7c06313 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -551,17 +551,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 = env_archcpu(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 = env_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 */