From patchwork Tue Aug 5 09:25:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 34900 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f69.google.com (mail-oi0-f69.google.com [209.85.218.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D32052397D for ; Tue, 5 Aug 2014 09:27:46 +0000 (UTC) Received: by mail-oi0-f69.google.com with SMTP id h136sf2570470oig.4 for ; Tue, 05 Aug 2014 02:27:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=2v56NvzRaPKE9evGgOiRGxhNx3PBmkX8ghyV6th0Tp4=; b=JgBkd+36sMDE7kXcefMMVdAfMRRzrfsPB8bct2LXyOQ4J6rMikjFZnDxSI3Qf6Ckw4 CZm26mxU9RyFzXRvzlXGC+/QAJxpOqqPenEucp5/oowjN42B9FaF+3rBw9O+Wi90klE5 3dzxRyQM9lOFDUjy4PaqQRVpux1P4GauZsdS7d6Uq5UWWrlDL8DH8ermnMkSa6aELnci qdt6jM4wo7GH45hWnJAVY8PzlNQ5LSYkPsCRSqHJWRuwufotSdeIx9RLtRZSilgVMUIV 5k5gkzo4oj1CGThuV17wSD7CflvqRa1L5Jj2Aqyhqc0XBWz/svyyyLElNzz4gBq0NA0U Nb8g== X-Gm-Message-State: ALoCoQkx0hAkMWN3aaQjzm6HFzLSw42wSr6pK7H/mx5y6PWzgVIUNiAu8FIzmf0/NewZtmERDlb4 X-Received: by 10.182.28.102 with SMTP id a6mr1385689obh.44.1407230864302; Tue, 05 Aug 2014 02:27:44 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.37 with SMTP id n34ls169161qga.86.gmail; Tue, 05 Aug 2014 02:27:44 -0700 (PDT) X-Received: by 10.52.185.193 with SMTP id fe1mr1721772vdc.31.1407230864167; Tue, 05 Aug 2014 02:27:44 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id e5si687390vcz.37.2014.08.05.02.27.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Aug 2014 02:27:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id le20so1001237vcb.14 for ; Tue, 05 Aug 2014 02:27:44 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr2161118vcb.0.1407230864070; Tue, 05 Aug 2014 02:27:44 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp369542vcb; Tue, 5 Aug 2014 02:27:43 -0700 (PDT) X-Received: by 10.66.246.229 with SMTP id xz5mr2664875pac.119.1407230862324; Tue, 05 Aug 2014 02:27:42 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id wq6si1271424pac.94.2014.08.05.02.27.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Aug 2014 02:27:42 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XEb15-0003S1-Nw; Tue, 05 Aug 2014 09:26:47 +0000 Received: from mail-wi0-f172.google.com ([209.85.212.172]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XEb0m-0002jK-RX for linux-arm-kernel@lists.infradead.org; Tue, 05 Aug 2014 09:26:35 +0000 Received: by mail-wi0-f172.google.com with SMTP id n3so6578955wiv.17 for ; Tue, 05 Aug 2014 02:26:05 -0700 (PDT) X-Received: by 10.180.11.135 with SMTP id q7mr4691989wib.67.1407230764942; Tue, 05 Aug 2014 02:26:04 -0700 (PDT) Received: from ards-macbook-pro.local ([188.252.229.85]) by mx.google.com with ESMTPSA id ex4sm5941037wic.2.2014.08.05.02.26.03 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Aug 2014 02:26:04 -0700 (PDT) From: Ard Biesheuvel To: will.deacon@arm.com, mark.rutland@arm.com, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/3] arm64: don't flag non-aliasing VIPT I-caches as aliasing Date: Tue, 5 Aug 2014 11:25:57 +0200 Message-Id: <1407230757-15305-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1407230757-15305-1-git-send-email-ard.biesheuvel@linaro.org> References: <1407230757-15305-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140805_022629_039679_00101B87 X-CRM114-Status: GOOD ( 12.12 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.172 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.172 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Ard Biesheuvel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 VIPT caches are non-aliasing if the index is derived from address bits that are always equal between VA and PA. Classifying these as aliasing results in unnecessary flushing which may hurt performance. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/cpuinfo.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index 177169623026..eb993cbdacf7 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -47,7 +47,13 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info) unsigned int cpu = smp_processor_id(); u32 l1ip = CTR_L1IP(info->reg_ctr); - if (l1ip != ICACHE_POLICY_PIPT) + /* + * VIPT caches are non-aliasing if the VA always equals the PA in all + * bit positions that are covered by the index, i.e., if num_sets_shift + * is less than or equal to PAGE_SHIFT minus line_size_shift. + */ + if (l1ip != ICACHE_POLICY_PIPT && !(l1ip == ICACHE_POLICY_VIPT && + icache_get_linesize() * icache_get_numsets() <= PAGE_SIZE)) set_bit(ICACHEF_ALIASING, &__icache_flags); if (l1ip == ICACHE_POLICY_AIVIVT) set_bit(ICACHEF_AIVIVT, &__icache_flags);