Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4047141pxb; Tue, 26 Jan 2021 10:58:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyK79VKij9G26ZTd6+uvlkXhiKgw+ff9eX2Cuyivzu/pjPsHz+xprlp8HGQIGpWZeSjUgr7 X-Received: by 2002:a17:906:ff43:: with SMTP id zo3mr4300811ejb.542.1611687499700; Tue, 26 Jan 2021 10:58:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611687499; cv=none; d=google.com; s=arc-20160816; b=tHXVLwmcU4N6UPLIRQyb5VvutHrlzjrPhI9b9LNhH+AP0MXZnp2C2C3h53B3A76zoz rLiPt+UTu9u0wfFPM1Ede0yC0uuE3JmIo2csb84LpdqXlGv/9GsogvpPc+P1cVBkZ6av 7VIYvmDGuRJjJT0+uDaEusEYafWu67giCY/dyx5JzobFA0wO7AJo1zgTrEf+tvbPeyVS XxSlX+GujmhmQbA5BcPtDTYyb+la/0uRavOb84dMicYkcG+RUmIQt7KokLSsp9OJ3M0R Vbw/RCYtFfpyNEnAwl5Rd6kL2dNhULAYguEXVToPe2T7YgupqN+vNyFhxO5Y4Ew5yuq7 FKUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=w2pqHMOd6gsRAK9PGsmuNDrMrP7CBaaZaab64yJRx0A=; b=g8/5a48Vyxwk9IOOPfQ+yWCX61RyP9JHGxQzrrPpkv9lDaxQsyQVxNzpsBIYQ8t05e 6C++Z2cb6aabaJEm+1hNzid90KZxVAW7BlNbvh74uS7cLI1gEaL4otqbH6qoeGSJtTgj NIS/jw1Tqa5qDXO5/EFD5Df+hISSluq7clFw3Kzpyh+TB4zIDAKsAUVlqrDjIoEuJkFK U1Vq/mCFraz7tVMa6ZWXzdIPZhjcv0jc4Jdkt2mo+09adG4x/c5Q7XduXAkSPvQryGjI HQznNM4shh2jCrHWl4mrSNkR0AzAWoJa0syz6Je+3cZWTwEu4LvOsBSsBToN/T0RocKM kg9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g12si8669043eds.254.2021.01.26.10.57.55; Tue, 26 Jan 2021 10:58:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404977AbhAZNnv (ORCPT + 99 others); Tue, 26 Jan 2021 08:43:51 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:11888 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404864AbhAZNnB (ORCPT ); Tue, 26 Jan 2021 08:43:01 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4DQ7DK2Mz7z7bNr; Tue, 26 Jan 2021 21:41:05 +0800 (CST) Received: from DESKTOP-TMVL5KK.china.huawei.com (10.174.187.128) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Tue, 26 Jan 2021 21:42:06 +0800 From: Yanan Wang To: , , , , Marc Zyngier , Will Deacon , Catalin Marinas CC: Mark Rutland , James Morse , Julien Thierry , Suzuki K Poulose , , , , , Yanan Wang Subject: [RFC PATCH v1 2/5] arm64: cpufeature: Add an API to get level of TTRem supported by hardware Date: Tue, 26 Jan 2021 21:41:59 +0800 Message-ID: <20210126134202.381996-3-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20210126134202.381996-1-wangyanan55@huawei.com> References: <20210126134202.381996-1-wangyanan55@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.187.128] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ARMv8.4 architecture offers 3 levels of support when changing block size without changing any other parameters that are listed as requiring use of break-before-make. So get the current level of TTRem supported by hardware and software can use corresponding process when changing block size. Signed-off-by: Yanan Wang --- arch/arm64/include/asm/cpufeature.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index 9a555809b89c..f8ee7d30829b 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -50,6 +50,11 @@ enum ftr_type { #define FTR_VISIBLE true /* Feature visible to the user space */ #define FTR_HIDDEN false /* Feature is hidden from the user */ +/* Supported levels of ARMv8.4 TTRem feature */ +#define TTREM_LEVEL0 0 +#define TTREM_LEVEL1 1 +#define TTREM_LEVEL2 2 + #define FTR_VISIBLE_IF_IS_ENABLED(config) \ (IS_ENABLED(config) ? FTR_VISIBLE : FTR_HIDDEN) @@ -739,6 +744,14 @@ static inline bool system_supports_tlb_range(void) cpus_have_const_cap(ARM64_HAS_TLB_RANGE); } +static inline u32 system_support_level_of_ttrem(void) +{ + u64 mmfr2 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR2_EL1); + + return cpuid_feature_extract_unsigned_field(mmfr2, + ID_AA64MMFR2_BBM_SHIFT); +} + extern int do_emulate_mrs(struct pt_regs *regs, u32 sys_reg, u32 rt); static inline u32 id_aa64mmfr0_parange_to_phys_shift(int parange) -- 2.19.1