[1/6] x86/mtrr: make mtrr_enabled() non-static

Message ID 20230207072902.5528-2-jgross@suse.com
State New
Headers
Series x86/mtrr: fix handling with PAT but without MTRR |

Commit Message

Juergen Gross Feb. 7, 2023, 7:28 a.m. UTC
  In order to be able to use mtrr_enabled() outside of MTRR code, make
it non-static and add a sub for the !CONFIG_MTRR case.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/include/asm/mtrr.h     | 6 ++++++
 arch/x86/kernel/cpu/mtrr/mtrr.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
  

Patch

diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h
index f0eeaf6e5f5f..29ec2d6f0537 100644
--- a/arch/x86/include/asm/mtrr.h
+++ b/arch/x86/include/asm/mtrr.h
@@ -31,6 +31,7 @@ 
  */
 # ifdef CONFIG_MTRR
 void mtrr_bp_init(void);
+bool mtrr_enabled(void);
 extern u8 mtrr_type_lookup(u64 addr, u64 end, u8 *uniform);
 extern void mtrr_save_fixed_ranges(void *);
 extern void mtrr_save_state(void);
@@ -48,6 +49,11 @@  void mtrr_disable(void);
 void mtrr_enable(void);
 void mtrr_generic_set_state(void);
 #  else
+static inline bool mtrr_enabled(void)
+{
+	return false;
+}
+
 static inline u8 mtrr_type_lookup(u64 addr, u64 end, u8 *uniform)
 {
 	/*
diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.c b/arch/x86/kernel/cpu/mtrr/mtrr.c
index 783f3210d582..814cc13fd6eb 100644
--- a/arch/x86/kernel/cpu/mtrr/mtrr.c
+++ b/arch/x86/kernel/cpu/mtrr/mtrr.c
@@ -59,7 +59,7 @@ 
 #define MTRR_TO_PHYS_WC_OFFSET 1000
 
 u32 num_var_ranges;
-static bool mtrr_enabled(void)
+bool mtrr_enabled(void)
 {
 	return !!mtrr_if;
 }