Skip to contentSkip to conversation

arm64/cpufeature: Drop redundant define(ID_AA64MMFR0..._SUPPORTED_LPA2)

PATCH Applied Anshuman Khandual 2 participants 2 messages Sep 17 – Oct 1 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64/cpufeature: Drop redundant define(ID_AA64MMFR0..._SUPPORTED_LPA2)

ID_AA64MMFR0_EL1_TGRAN_2_SUPPORTED_LPA2 is always defined as 0x3. Hence any defined() test on the macro always going to be evaluated as true. Hence the very test itself is redundant and can be dropped off safely.

Although similar defined(ID_AA64MMFR0_EL1_TGRAN_LPA2) test is retained back as the macro does depend on the configured granule size.

---
This patch applies on v7.2-rc3

 arch/arm64/kernel/cpufeature.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/cpufeature.c +1 -1
index 9a22df0c5120..e3be220ae45b 100644
@@ -1904,7 +1904,7 @@ static bool has_nv1(const struct arm64_cpu_capabilities *entry, int scope)
 		  is_midr_in_range_list(nv1_ni_list)));
 }
 
-#if defined(ID_AA64MMFR0_EL1_TGRAN_LPA2) && defined(ID_AA64MMFR0_EL1_TGRAN_2_SUPPORTED_LPA2)
+#if defined(ID_AA64MMFR0_EL1_TGRAN_LPA2)
 static bool has_lpa2_at_stage1(u64 mmfr0)
 {
 	unsigned int tgran;
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Anshuman Khandual

ID_AA64MMFR0_EL1_TGRAN_2_SUPPORTED_LPA2 is always defined as 0x3. Hence any defined() test on the macro always going to be evaluated as true. Hence the very test itself is redundant and can be dropped off safely.

Although similar defined(ID_AA64MMFR0_EL1_TGRAN_LPA2) test is retained back as the macro does depend on the configured granule size.

[...]

Applied to arm64 (for-next/misc), thanks!

[1/1] arm64/cpufeature: Drop redundant define(ID_AA64MMFR0..._SUPPORTED_LPA2)

      https://git.kernel.org/arm64/c/f73411ae5be6