Blob Blame History Raw
From 6d69b03ae9e2dfbfaf98ff93e9fd1a08f7c1a15c Mon Sep 17 00:00:00 2001
From: Will Deacon <will.deacon@arm.com>
Date: Tue, 27 Mar 2018 11:51:12 +0100
Subject: [PATCH] arm64: cpufeature: Avoid warnings due to unused symbols

Git-commit: 12eb369125abe92bfc55e9ce198200f5807b63ff
Patch-mainline: v4.17-rc1
References: fate#325862

An allnoconfig build complains about unused symbols due to functions
that are called via conditional cpufeature and cpu_errata table entries.

Annotate these as __maybe_unused if they are likely to be generic, or
predicate their compilation on the same option as the table entry if
they are specific to a given alternative.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
---
 arch/arm64/kernel/cpu_errata.c |  6 +++---
 arch/arm64/kernel/cpufeature.c | 14 +++++++++-----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
index 6c32dc01..1b762e06 100644
--- a/arch/arm64/kernel/cpu_errata.c
+++ b/arch/arm64/kernel/cpu_errata.c
@@ -443,8 +443,8 @@ static bool has_ssbd_mitigation(const struct arm64_cpu_capabilities *entry,
  * of call backs, sharing the same capability bit.
  * Iterate over each entry to see if at least one matches.
  */
-static bool multi_entry_cap_matches(const struct arm64_cpu_capabilities *entry,
-				    int scope)
+static bool __maybe_unused
+multi_entry_cap_matches(const struct arm64_cpu_capabilities *entry, int scope)
 {
 	const struct arm64_cpu_capabilities *caps;
 
@@ -459,7 +459,7 @@ static bool multi_entry_cap_matches(const struct arm64_cpu_capabilities *entry,
  * Take appropriate action for all matching entries in the shared capability
  * entry.
  */
-static void
+static void __maybe_unused
 multi_entry_cap_cpu_enable(const struct arm64_cpu_capabilities *entry)
 {
 	const struct arm64_cpu_capabilities *caps;
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index a8a1e422..379a4a9f 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -837,11 +837,6 @@ static bool has_no_hw_prefetch(const struct arm64_cpu_capabilities *entry, int _
 		MIDR_CPU_VAR_REV(1, MIDR_REVISION_MASK));
 }
 
-static bool runs_at_el2(const struct arm64_cpu_capabilities *entry, int __unused)
-{
-	return is_kernel_in_hyp_mode();
-}
-
 static bool hyp_offset_low(const struct arm64_cpu_capabilities *entry,
 			   int __unused)
 {
@@ -1009,6 +1004,15 @@ static bool has_hw_dbm(const struct arm64_cpu_capabilities *cap,
 
 #endif
 
+#ifdef CONFIG_ARM64_VHE
+static bool runs_at_el2(const struct arm64_cpu_capabilities *entry, int __unused)
+{
+	return is_kernel_in_hyp_mode();
+}
+
+/* static void cpu_copy_el2regs(const struct arm64_cpu_capabilities *__unused) */
+#endif
+
 static const struct arm64_cpu_capabilities arm64_features[] = {
 	{
 		.desc = "GIC system register CPU interface",
-- 
2.11.0