All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Joey Gouly <joey.gouly@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	Mark Brown <broonie@kernel.org>
Subject: [PATCH v5 01/27] arm64/cpuinfo: Remove refrences to reserved cache type
Date: Wed, 22 Jun 2022 18:43:50 +0100	[thread overview]
Message-ID: <20220622174416.1406282-2-broonie@kernel.org> (raw)
In-Reply-To: <20220622174416.1406282-1-broonie@kernel.org>

In 155433cb365ee466 ("arm64: cache: Remove support for ASID-tagged VIVT
I-caches") we removed all the support fir AIVIVT cache types and renamed
all references to the field to say "unknown" since support for AIVIVT
caches was removed from the architecture. Some confusion has resulted since
the corresponding change to the architecture left the value named as
AIVIVT but documented it as reserved in v8, refactor the code so we don't
define the constant instead. This will help with automatic generation of
this register field since it means we care less about the correspondence
with the ARM.

No functional change, the value displayed to userspace is unchanged.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 arch/arm64/include/asm/cache.h |  1 -
 arch/arm64/kernel/cpuinfo.c    | 27 +++++++++++++++++----------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
index 7c2181c72116..0cbe75b9e4e5 100644
--- a/arch/arm64/include/asm/cache.h
+++ b/arch/arm64/include/asm/cache.h
@@ -25,7 +25,6 @@
 #define CTR_L1IP(ctr)		(((ctr) >> CTR_L1IP_SHIFT) & CTR_L1IP_MASK)
 
 #define ICACHE_POLICY_VPIPT	0
-#define ICACHE_POLICY_RESERVED	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 8eff0a34ffd4..7ecf9ffb590b 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -33,12 +33,19 @@
 DEFINE_PER_CPU(struct cpuinfo_arm64, cpu_data);
 static struct cpuinfo_arm64 boot_cpu_data;
 
-static const char *icache_policy_str[] = {
-	[ICACHE_POLICY_VPIPT]		= "VPIPT",
-	[ICACHE_POLICY_RESERVED]	= "RESERVED/UNKNOWN",
-	[ICACHE_POLICY_VIPT]		= "VIPT",
-	[ICACHE_POLICY_PIPT]		= "PIPT",
-};
+static inline const char *icache_policy_str(int l1ip)
+{
+	switch (l1ip) {
+        case ICACHE_POLICY_VPIPT:
+                return "VPIPT";
+	case ICACHE_POLICY_VIPT:
+                return "VIPT";
+	case ICACHE_POLICY_PIPT:
+                return "PIPT";
+        default:
+                return "RESERVED/UNKNOWN";
+        }
+}
 
 unsigned long __icache_flags;
 
@@ -342,19 +349,19 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info)
 	u32 l1ip = CTR_L1IP(info->reg_ctr);
 
 	switch (l1ip) {
-	case ICACHE_POLICY_PIPT:
-		break;
 	case ICACHE_POLICY_VPIPT:
 		set_bit(ICACHEF_VPIPT, &__icache_flags);
 		break;
-	case ICACHE_POLICY_RESERVED:
 	case ICACHE_POLICY_VIPT:
 		/* Assume aliasing */
 		set_bit(ICACHEF_ALIASING, &__icache_flags);
 		break;
+	case ICACHE_POLICY_PIPT:
+	default:
+		break;
 	}
 
-	pr_info("Detected %s I-cache on CPU%d\n", icache_policy_str[l1ip], cpu);
+	pr_info("Detected %s I-cache on CPU%d\n", icache_policy_str(l1ip), cpu);
 }
 
 static void __cpuinfo_store_cpu_32bit(struct cpuinfo_32bit *info)
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-06-22 17:54 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22 17:43 [PATCH v5 00/27] arm64/sysreg: More system register generation Mark Brown
2022-06-22 17:43 ` Mark Brown [this message]
2022-06-28 14:26   ` [PATCH v5 01/27] arm64/cpuinfo: Remove refrences to reserved cache type Will Deacon
2022-06-22 17:43 ` [PATCH v5 02/27] arm64/sysreg: Allow leading blanks on comments in sysreg file Mark Brown
2022-06-22 17:43 ` [PATCH v5 03/27] arm64/sysreg: Add LINKER_SCRIPT guards for sysreg.h Mark Brown
2022-06-22 17:43 ` [PATCH v5 04/27] arm64/sysreg: Add SYS_FIELD_GET() helper Mark Brown
2022-06-22 17:43 ` [PATCH v5 05/27] arm64/sysreg: Standardise naming for CTR_EL0 fields Mark Brown
2022-06-22 17:43 ` [PATCH v5 06/27] arm64/sysreg: Standardise naming for DCZID_EL0 field names Mark Brown
2022-06-22 17:43 ` [PATCH v5 07/27] arm64/mte: Standardise GMID field name definitions Mark Brown
2022-06-22 17:43 ` [PATCH v5 08/27] arm64/sysreg: Align pointer auth enumeration defines with architecture Mark Brown
2022-06-22 17:43 ` [PATCH v5 09/27] arm64/sysreg: Make BHB clear feature defines match the architecture Mark Brown
2022-06-22 17:43 ` [PATCH v5 10/27] arm64/sysreg: Standardise naming for WFxT defines Mark Brown
2022-06-22 17:44 ` [PATCH v5 11/27] arm64/sysreg: Standardise naming for ID_AA64SMFR0_EL1 enums Mark Brown
2022-06-22 17:44 ` [PATCH v5 12/27] arm64/sysreg: Standardise naming for ID_AA64ZFR0_EL1 fields Mark Brown
2022-06-22 17:44 ` [PATCH v5 13/27] arm64/sysreg: Remove defines for RPRES enumeration Mark Brown
2022-06-22 17:44 ` [PATCH v5 14/27] arm64/sysreg: Add _EL1 into ID_AA64ISAR1_EL1 definition names Mark Brown
2022-06-22 17:44 ` [PATCH v5 15/27] arm64/sysreg: Add _EL1 into ID_AA64ISAR2_EL1 " Mark Brown
2022-06-22 17:44 ` [PATCH v5 16/27] arm64/sysreg: Convert CTR_EL0 to automatic generation Mark Brown
2022-06-22 17:44 ` [PATCH v5 17/27] arm64/sysreg: Convert DCZID_EL0 " Mark Brown
2022-06-22 17:44 ` [PATCH v5 18/27] arm64/sysreg: Convert GMID " Mark Brown
2022-06-22 17:44 ` [PATCH v5 19/27] arm64/sysreg: Convert ID_AA64ISAR1_EL1 " Mark Brown
2022-06-22 17:44 ` [PATCH v5 20/27] arm64/sysreg: Convert ID_AA64ISAR2_EL1 " Mark Brown
2022-06-22 17:44 ` [PATCH v5 21/27] arm64/sysreg: Convert LORSA_EL1 " Mark Brown
2022-06-22 17:44 ` [PATCH v5 22/27] arm64/sysreg: Convert LOREA_EL1 " Mark Brown
2022-06-22 17:44 ` [PATCH v5 23/27] arm64/sysreg: Convert LORN_EL1 " Mark Brown
2022-06-22 17:44 ` [PATCH v5 24/27] arm64/sysreg: Convert LORC_EL1 " Mark Brown
2022-06-22 17:44 ` [PATCH v5 25/27] arm64/sysreg: Convert LORID_EL1 " Mark Brown
2022-06-22 17:44 ` [PATCH v5 26/27] arm64/sysreg: Convert ID_AA64SMFR0_EL1 " Mark Brown
2022-06-22 17:44 ` [PATCH v5 27/27] arm64/sysreg: Convert ID_AA64ZFR0_EL1 " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220622174416.1406282-2-broonie@kernel.org \
    --to=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.