From patchwork Mon Aug 4 08:16:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 34766 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D7E7A20F2E for ; Mon, 4 Aug 2014 08:18:56 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id kx10sf48791639pab.4 for ; Mon, 04 Aug 2014 01:18:56 -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=CeQsLnolEtNjTCPIv4A7en/d4DLrucd++Yg1BeIA/HQ=; b=UAt6QUDQOiDTUFMNRUA2xrQWKdx2B0kNUzPvp/zDHTUL1MDODp/qPAGCgk2bMGvpma VaPs6DxeZ+Q6wR+SKWCrk+D3OTGYvfcc8ah1rTpZV2E1icGAAUMEoxJwJ1Bsjv6tnBgn nUkDYBuOtLZpdy18or/LJU/0/l/L60p4Pl4mPZ1tC03OdZHqaH6Th9J6bf3v3O+NXf+s KDH9tdGypk0h3PFaj2Jx8eODDyQ4ea4w9KUfqHp39CdtdTMppvhA/42ZUxPw9RAu0tQI HPOeKToikJDdkm7OuzYlUmcy52H52Fzo524BpIcDH7OdSfPevRD6Th353oJswgOExzp5 xGQQ== X-Gm-Message-State: ALoCoQm7Bs6LNNY9kOoOmMcj5uXS9RWcX/6wz6if9RH3MptKg77XhJg41dtm9QCJGTILxQL2OCoh X-Received: by 10.67.23.197 with SMTP id ic5mr8507282pad.24.1407140336117; Mon, 04 Aug 2014 01:18:56 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.26.200 with SMTP id 66ls2193653qgv.85.gmail; Mon, 04 Aug 2014 01:18:56 -0700 (PDT) X-Received: by 10.53.6.132 with SMTP id cu4mr1348898vdd.62.1407140335987; Mon, 04 Aug 2014 01:18:55 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id ol3si11526245vcb.30.2014.08.04.01.18.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Aug 2014 01:18:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id la4so10635439vcb.9 for ; Mon, 04 Aug 2014 01:18:55 -0700 (PDT) X-Received: by 10.52.69.172 with SMTP id f12mr18706029vdu.9.1407140335872; Mon, 04 Aug 2014 01:18:55 -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 tc5csp286633vcb; Mon, 4 Aug 2014 01:18:55 -0700 (PDT) X-Received: by 10.70.93.42 with SMTP id cr10mr22517071pdb.42.1407140335021; Mon, 04 Aug 2014 01:18:55 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ko9si16817909pab.125.2014.08.04.01.18.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Aug 2014 01:18:55 -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 1XEDSi-0006KK-Oh; Mon, 04 Aug 2014 08:17:44 +0000 Received: from mail-wg0-f48.google.com ([74.125.82.48]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XEDST-00069W-V5 for linux-arm-kernel@lists.infradead.org; Mon, 04 Aug 2014 08:17:30 +0000 Received: by mail-wg0-f48.google.com with SMTP id x13so7216858wgg.19 for ; Mon, 04 Aug 2014 01:17:04 -0700 (PDT) X-Received: by 10.180.95.68 with SMTP id di4mr7509632wib.60.1407140224280; Mon, 04 Aug 2014 01:17:04 -0700 (PDT) Received: from ards-macbook-pro.local ([188.252.229.85]) by mx.google.com with ESMTPSA id ub11sm38363410wib.1.2014.08.04.01.17.03 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Aug 2014 01:17:03 -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 3/3] arm64: don't flag non-aliasing VIPT I-caches as aliasing Date: Mon, 4 Aug 2014 10:16:56 +0200 Message-Id: <1407140216-22747-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1407140216-22747-1-git-send-email-ard.biesheuvel@linaro.org> References: <1407140216-22747-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140804_011730_149709_0EFC559C X-CRM114-Status: GOOD ( 12.04 ) 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 [74.125.82.48 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.48 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.178 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 744fad2ff418..b780acc201ad 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);