Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3820259pxb; Tue, 26 Jan 2021 05:46:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGbOuZLY3H9xqf+umvCJEypcb0FGzOExobalGqlIuEsM4f/w26/XwNGwsJYsOkonEazUKI X-Received: by 2002:a17:907:7346:: with SMTP id dq6mr3707914ejc.237.1611668789447; Tue, 26 Jan 2021 05:46:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611668789; cv=none; d=google.com; s=arc-20160816; b=lU1nhKxUbQf2cgVL5YQ1ZVLG8xMaouKoevH/ijmO7uwLdfC3VesN7797zuv9WQdIW9 ifZvHU8vKpZ2KjPnT2tIkbU0wycB8+SyWkfusvWklIzEtpw2nyZB1Hg6AK8IM8EDxnjx HVmVcWW5+GlCxitWZ2UKtvGRaSjIOgyN0GUoU36k8k1ABUnC9/fL0UQ+Lhz31IaowfUf Lb+fCw0RK5TDgK7yrUZfLthZAlH6pszD0NA2KzyJaoSEqv+wMoibvCgcY4PBjG2cXcBr VR9I5TRGtQDmN4mFUeKTcAwo/9+vbhnEYDUlNt2zdymkgH7T5kIilSJfeDw0xITBKdzi 1bsg== 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=H+4fTstYI8zeDh/Ou3ObCAqM38Z/ddNfx8XYefakwUk=; b=BIL2xVsSbqz2Z5+fqZ9FnnDIQ3W0tv8KCDaAE9GSPwccGFXCIvk6smeISr4AZff9Fv dkRmZWdWP7h936augWwSUGgoEIJ8OTuC5KYhbYodVuYyfyrA9fELMg70xzt7BVkRq0q8 sn4FyAJDPmgOFRcjWUYKOFtTPyLOFFJwhcsszZ4QqySzliVa8ISTLPKOEYktxJAAFDee ukPRXRUJV0h2OUPKlIGpyAXyZKRH4jsuv/oQbYmCd4uRGnntmmaK/dzFRREMC/UdF0US OcT3NUz2Z6OJp/5PRo32Y/teF8lfd6AhdAASndOqAZ8jXJAHjHKdTEyv7RzTObNYwCyp PYyQ== 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 p31si970043edb.328.2021.01.26.05.46.04; Tue, 26 Jan 2021 05:46:29 -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 S2404943AbhAZNnq (ORCPT + 99 others); Tue, 26 Jan 2021 08:43:46 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:11446 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404851AbhAZNmz (ORCPT ); Tue, 26 Jan 2021 08:42:55 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4DQ7DT5z5yzjCXS; Tue, 26 Jan 2021 21:41:13 +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:05 +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 1/5] arm64: cpufeature: Detect the ARMv8.4 TTRem feature Date: Tue, 26 Jan 2021 21:41:58 +0800 Message-ID: <20210126134202.381996-2-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 TTRem feature offers 3 levels of support when changing block size without changing any other parameters that are listed as requiring use of break-before-make. With level 0 supported, software must use break-before-make to avoid the possible hardware problems. With level 1 supported, besides use of BBM, software can also make use of the nT block translation entry. With level 2 supported, besides approaches of BBM and nT, software can also directly change block size, but TLB conflicts possibly occur as a result. We have found a place where TTRem can be used to improve the performance in guest stage-2 translation. So detact the TTRem feature here. Signed-off-by: Yanan Wang --- arch/arm64/include/asm/cpucaps.h | 3 ++- arch/arm64/kernel/cpufeature.c | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h index b77d997b173b..e24570ea7444 100644 --- a/arch/arm64/include/asm/cpucaps.h +++ b/arch/arm64/include/asm/cpucaps.h @@ -66,7 +66,8 @@ #define ARM64_WORKAROUND_1508412 58 #define ARM64_HAS_LDAPR 59 #define ARM64_KVM_PROTECTED_MODE 60 +#define ARM64_HAS_ARMv8_4_TTREM 61 -#define ARM64_NCAPS 61 +#define ARM64_NCAPS 62 #endif /* __ASM_CPUCAPS_H */ diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index e99eddec0a46..8295dd1d450b 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1960,6 +1960,16 @@ static const struct arm64_cpu_capabilities arm64_features[] = { .sign = FTR_UNSIGNED, .min_field_value = ID_AA64ISAR0_TLB_RANGE, }, + { + .desc = "ARMv8.4 TTRem", + .type = ARM64_CPUCAP_SYSTEM_FEATURE, + .capability = ARM64_HAS_ARMv8_4_TTREM, + .sys_reg = SYS_ID_AA64MMFR2_EL1, + .sign = FTR_UNSIGNED, + .field_pos = ID_AA64MMFR2_BBM_SHIFT, + .min_field_value = 1, + .matches = has_cpuid_feature, + }, #ifdef CONFIG_ARM64_HW_AFDBM { /* -- 2.19.1