From patchwork Thu Oct 18 18:27:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 149187 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2326986lji; Thu, 18 Oct 2018 11:30:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV60VB3vfbm9hCjJxMZPX4Tql4JaQCgHWqo4QFVhfehPtsfy7Aks5RuxJoncx1Z6DaQ6YDNoG X-Received: by 2002:ac8:392e:: with SMTP id s43-v6mr30672199qtb.294.1539887441543; Thu, 18 Oct 2018 11:30:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539887441; cv=none; d=google.com; s=arc-20160816; b=sRj1Ct3BI4znHenMFch4Q6+he52ob+8xD8oMdIzhZ8Dl62VxMqDFcP5/ilL29BUZpD 4xjL5Bsn83TKDCY4UCcv9mdXQJ0SBJX3xLHYOb6afsOicJOmDPTja0EvbBuNLYl7/EGX UjdbSBYLeC8dDZh4v/haTx1gYWNq3Yqs7lkusBJWp6DU4CL4elYfVig6WOU4GyG9T91D QbtXPY/5o6ZNbKQO5Sh1ERLmztsKmhYIVNEgp/IaD4qc2PEPS0KS9gcm8oCHpEWS/394 8jhRr1fn7cKfQuAhOilkyLcaRWEAETF6he3uQOxMLy5PptwVRwW6asdNdooWO+YwlLvB dxQQ== 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=D3wqGudfW+0khCsxkoB/kpathOtA+AYb9IQL2BiwWuM=; b=kS/vvbpgsHDAkYXGvCPNZxMEKQaS4DLV5GYeL2HisF43+vuNwnV2VSf0iVw7Y9ya1n /6oHb3g2rjIwtamK7Mglz1ozoYyKifsTi3oNLg1zYsEvn37zpZEhaHfnwBLyyn7f2O8/ mtAHj+aM1HEFk4OseMcRrBs8kI+T68+2rq+jyG25x2x9UUFbGI/5h6w6/G6bjUMUBdaH LLORkFJgG8OuDSTNxzfSlqdPnZI+U3+02xgt7vuwbGaY4SzDVGrkQScIthLMHni443Ov GlqbOLL1S1Ax28j+ot1VKf/4BN2LFgsvK8+DA2D2kcOTS3OjEW90vJ2t6og0/xduyijv HFbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OCOSZhui; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 75-v6si6543081qkv.68.2018.10.18.11.30.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 18 Oct 2018 11:30:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OCOSZhui; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:43780 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDD4C-00046o-PD for patch@linaro.org; Thu, 18 Oct 2018 14:30:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDD1i-000232-EL for qemu-devel@nongnu.org; Thu, 18 Oct 2018 14:28:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDD1h-00009o-H5 for qemu-devel@nongnu.org; Thu, 18 Oct 2018 14:28:06 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:34664) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gDD1h-00007D-8O for qemu-devel@nongnu.org; Thu, 18 Oct 2018 14:28:05 -0400 Received: by mail-pf1-x444.google.com with SMTP id f78-v6so9506366pfe.1 for ; Thu, 18 Oct 2018 11:28:05 -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=D3wqGudfW+0khCsxkoB/kpathOtA+AYb9IQL2BiwWuM=; b=OCOSZhuiJguo8ReanZXRLIdlQmkqF0IqpJE9u/OOkznwn39Wmv7sLvUJRtkPwqNd2E MMwmOKsjG9SSk8yusWeMJJH5GyVD1rZGfMJvl5YuJijV19nIN2pksuj4HJjzTN8cGM6N uRXkDPn1UahtXGGPU8nSts4gAR+IjlDdxhROY= 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=D3wqGudfW+0khCsxkoB/kpathOtA+AYb9IQL2BiwWuM=; b=ATws+F4KEJhWC85XY2JwqPIvzrUxaO8TQeLgChiFYpTRmqY1ayNhUIXSGnsktL+yZs Bw2at+9Msa1RL9C3hy937tQN9nXWH6VQQEIlqeVJz6Scc/iNz5U4Y7gZ7gIUA6pztnHU UjeOsYiRJypq/CDGz/aqP7b/0o3i5KzIa16y2VTWrhJeOWCSqfAHYNPFPkuP0tE4M9ck n589KtwwSdwLRgEZwKA/Zz9tIE8AV3FFyl48lsXoaBzSh/vECdiat2BTmfiI1fuXpgKR F0PGBYQGl6L5IGm0KvrKC+dJKIwwcc4LH0rh7/k42jgBTS4Gp+MkkEO5VqKOAw0K4XFM QR4A== X-Gm-Message-State: ABuFfogL3DdThMCF9IN5PQTLNWagTZ9+3els9eqqdFr5ZdWS4rJk1sP5 9u+/mY75q7jIxKD5DSBQ50qe5DnviYs= X-Received: by 2002:a63:f448:: with SMTP id p8-v6mr29349523pgk.124.1539887283899; Thu, 18 Oct 2018 11:28:03 -0700 (PDT) Received: from cloudburst.twiddle.net (174-21-9-133.tukw.qwest.net. [174.21.9.133]) by smtp.gmail.com with ESMTPSA id d187-v6sm4795738pfc.13.2018.10.18.11.28.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Oct 2018 11:28:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 11:27:57 -0700 Message-Id: <20181018182758.18646-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181018182758.18646-1-richard.henderson@linaro.org> References: <20181018182758.18646-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::444 Subject: [Qemu-devel] [PATCH 2/3] target/arm: Only flush tlb if ASID changes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Since QEMU does not implement ASIDs, changes to the ASID must flush the tlb. However, if the ASID does not change there is no reason to flush. In testing a boot of the Ubuntu installer to the first menu, this reduces the number of flushes by 30%, or nearly 600k instances. Signed-off-by: Richard Henderson --- target/arm/helper.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.17.2 Reviewed-by: Aaron Lindsay diff --git a/target/arm/helper.c b/target/arm/helper.c index 24bbde4f76..ed70ac645e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -2709,12 +2709,10 @@ static void vmsa_tcr_el1_write(CPUARMState *env, const ARMCPRegInfo *ri, static void vmsa_ttbr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { - /* 64 bit accesses to the TTBRs can change the ASID and so we - * must flush the TLB. - */ - if (cpreg_field_is_64bit(ri)) { + /* If the ASID changes (with a 64-bit write), we must flush the TLB. */ + if (cpreg_field_is_64bit(ri) && + extract64(raw_read(env, ri) ^ value, 48, 16) != 0) { ARMCPU *cpu = arm_env_get_cpu(env); - tlb_flush(CPU(cpu)); } raw_write(env, ri, value);