From patchwork Wed Feb 8 12:43:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shanker Donthineni X-Patchwork-Id: 9562445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1B2FE60434 for ; Wed, 8 Feb 2017 12:44:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C5D5284F0 for ; Wed, 8 Feb 2017 12:44:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 017E9284F2; Wed, 8 Feb 2017 12:44:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AB56B284F0 for ; Wed, 8 Feb 2017 12:44:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cbRcA-0004c4-MR; Wed, 08 Feb 2017 12:44:50 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cbRc7-0004Gg-41 for linux-arm-kernel@lists.infradead.org; Wed, 08 Feb 2017 12:44:48 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C6E0B60729; Wed, 8 Feb 2017 12:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1486557866; bh=q1Wu1JJ07PSNrthe13CnnxN2RIEcky5MPiznnXVxBSs=; h=From:To:Cc:Subject:Date:From; b=bd6ddAOOUr4xd1eL9GBY6rkywf9kwbpszT2n4FOYN8ZPPbTiVwx0u033dliI+E8K4 UG6A7v5ilofdkbFyUidFOFNHeU9GUFPumBmIob+Xk70m5M41uvuwlcxufg88MVxXN0 YTM6e/j3MEbQSc0/LeGNoFIZomH0V7+9gPQ60Dyk= Received: from shankerd-ubuntu.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: shankerd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 68DA560794; Wed, 8 Feb 2017 12:44:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1486557866; bh=q1Wu1JJ07PSNrthe13CnnxN2RIEcky5MPiznnXVxBSs=; h=From:To:Cc:Subject:Date:From; b=bd6ddAOOUr4xd1eL9GBY6rkywf9kwbpszT2n4FOYN8ZPPbTiVwx0u033dliI+E8K4 UG6A7v5ilofdkbFyUidFOFNHeU9GUFPumBmIob+Xk70m5M41uvuwlcxufg88MVxXN0 YTM6e/j3MEbQSc0/LeGNoFIZomH0V7+9gPQ60Dyk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 68DA560794 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=shankerd@codeaurora.org From: Shanker Donthineni To: Catalin Marinas , linux-arm-kernel Subject: [PATCH] arm64: Add support for VMID aware PIPT instruction cache cache Date: Wed, 8 Feb 2017 06:43:27 -0600 Message-Id: <1486557807-26641-1-git-send-email-shankerd@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170208_044447_252668_9C2D4752 X-CRM114-Status: GOOD ( 14.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Vikram Sethi , Suzuki K Poulose , Marc Zyngier , Will Deacon , linux-kernel , James Morse , Anna-Maria Gleixner , Shanker Donthineni MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In ARMv8.2 extension, a new instruction cache type 'VMID aware PIPT' was introduced in addition to AIVIVT/VIPT/PIPT. Instruction cache maintenance operations when issued from Non-secure EL1/EL0 have an effect only on cache line entries those were fetched in Non-secure EL1/EL0 using the current VMID. For software point of view, this cache type is same as PIPT and no aliasing problem. The updated CTR_EL0.L1IP definition. 00: VMID aware PIPT 01: ASID-tagged Virtual Index, Virtual Tag (AIVIVT) 10: Virtual Index, Physical Tag (VIPT) 11: Physical Index, Physical Tag (PIPT) Signed-off-by: Shanker Donthineni --- arch/arm64/include/asm/cachetype.h | 2 +- arch/arm64/kernel/cpuinfo.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm64/include/asm/cachetype.h b/arch/arm64/include/asm/cachetype.h index f05974c..cb84b4d 100644 --- a/arch/arm64/include/asm/cachetype.h +++ b/arch/arm64/include/asm/cachetype.h @@ -23,7 +23,7 @@ #define CTR_CWG_SHIFT 24 #define CTR_CWG_MASK 15 -#define ICACHE_POLICY_RESERVED 0 +#define ICACHE_POLICY_VPIPT 0 #define ICACHE_POLICY_AIVIVT 1 #define ICACHE_POLICY_VIPT 2 #define ICACHE_POLICY_PIPT 3 diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index 2d52f8d..e2063de 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -43,7 +43,7 @@ static struct cpuinfo_arm64 boot_cpu_data; static char *icache_policy_str[] = { - [ICACHE_POLICY_RESERVED] = "RESERVED/UNKNOWN", + [ICACHE_POLICY_VPIPT] = "VPIPT", [ICACHE_POLICY_AIVIVT] = "AIVIVT", [ICACHE_POLICY_VIPT] = "VIPT", [ICACHE_POLICY_PIPT] = "PIPT", @@ -288,7 +288,7 @@ 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) { + if (l1ip == ICACHE_POLICY_AIVIVT || l1ip == ICACHE_POLICY_VIPT) { /* * VIPT caches are non-aliasing if the VA always equals the PA * in all bit positions that are covered by the index. This is @@ -299,9 +299,10 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info) if (l1ip != ICACHE_POLICY_VIPT || waysize > PAGE_SIZE) set_bit(ICACHEF_ALIASING, &__icache_flags); + + if (l1ip == ICACHE_POLICY_AIVIVT) + set_bit(ICACHEF_AIVIVT, &__icache_flags); } - if (l1ip == ICACHE_POLICY_AIVIVT) - set_bit(ICACHEF_AIVIVT, &__icache_flags); pr_info("Detected %s I-cache on CPU%d\n", icache_policy_str[l1ip], cpu); }