diff mbox

[2/4] x86/pat: Merge pat_init_cache_modes() into its caller

Message ID 1433065686-20922-2-git-send-email-bp@alien8.de (mailing list archive)
State Superseded
Headers show

Commit Message

Borislav Petkov May 31, 2015, 9:48 a.m. UTC
From: Borislav Petkov <bp@suse.de>

This way we can pass pat MSR value directly.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: arnd@arndb.de
Cc: Elliott@hp.com
Cc: hch@lst.de
Cc: hmh@hmh.eng.br
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: jgross@suse.com
Cc: konrad.wilk@oracle.com
Cc: linux-mm <linux-mm@kvack.org>
Cc: linux-nvdimm@lists.01.org
Cc: Luis R. Rodriguez <mcgrof@suse.com>
Cc: stefan.bader@canonical.com
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: x86-ml <x86@kernel.org>
Cc: yigal@plexistor.com
---
 arch/x86/mm/pat.c | 39 ++++++++++++++++-----------------------
 1 file changed, 16 insertions(+), 23 deletions(-)

Comments

Jürgen Groß May 31, 2015, 10:15 a.m. UTC | #1
On 05/31/2015 11:48 AM, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
>
> This way we can pass pat MSR value directly.
>
> No functionality change.

You are breaking the Xen build with that change. pat_init_cache_modes()
is called from arch/x86/xen/enlighten.c as well.


Juergen

>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Lutomirski <luto@amacapital.net>
> Cc: arnd@arndb.de
> Cc: Elliott@hp.com
> Cc: hch@lst.de
> Cc: hmh@hmh.eng.br
> Cc: H. Peter Anvin <hpa@zytor.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: jgross@suse.com
> Cc: konrad.wilk@oracle.com
> Cc: linux-mm <linux-mm@kvack.org>
> Cc: linux-nvdimm@lists.01.org
> Cc: Luis R. Rodriguez <mcgrof@suse.com>
> Cc: stefan.bader@canonical.com
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Toshi Kani <toshi.kani@hp.com>
> Cc: x86-ml <x86@kernel.org>
> Cc: yigal@plexistor.com
> ---
>   arch/x86/mm/pat.c | 39 ++++++++++++++++-----------------------
>   1 file changed, 16 insertions(+), 23 deletions(-)
>
> diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
> index 476d0780560f..4d28759f5a1a 100644
> --- a/arch/x86/mm/pat.c
> +++ b/arch/x86/mm/pat.c
> @@ -172,32 +172,14 @@ static enum page_cache_mode pat_get_cache_mode(unsigned pat_val, char *msg)
>
>   #undef CM
>
> -/*
> - * Update the cache mode to pgprot translation tables according to PAT
> - * configuration.
> - * Using lower indices is preferred, so we start with highest index.
> - */
> -void pat_init_cache_modes(void)
> -{
> -	int i;
> -	enum page_cache_mode cache;
> -	char pat_msg[33];
> -	u64 pat;
> -
> -	rdmsrl(MSR_IA32_CR_PAT, pat);
> -	pat_msg[32] = 0;
> -	for (i = 7; i >= 0; i--) {
> -		cache = pat_get_cache_mode((pat >> (i * 8)) & 7,
> -					   pat_msg + 4 * i);
> -		update_cache_mode_entry(i, cache);
> -	}
> -	pr_info("x86/PAT: Configuration [0-7]: %s\n", pat_msg);
> -}
> -
>   #define PAT(x, y)	((u64)PAT_ ## y << ((x)*8))
>
>   static void pat_bsp_init(u64 pat)
>   {
> +	enum page_cache_mode cache;
> +	char pat_msg[33];
> +	int i;
> +
>   	if (!cpu_has_pat) {
>   		pat_disable("PAT not supported by CPU.");
>   		return;
> @@ -211,7 +193,18 @@ static void pat_bsp_init(u64 pat)
>
>   	wrmsrl(MSR_IA32_CR_PAT, pat);
>
> -	pat_init_cache_modes();
> +	pat_msg[32] = 0;
> +
> +	/*
> +	 * Update the cache mode to pgprot translation tables according to PAT
> +	 * configuration. Using lower indices is preferred, so we start with
> +	 * highest index.
> +	 */
> +	for (i = 7; i >= 0; i--) {
> +		cache = pat_get_cache_mode((pat >> (i * 8)) & 7, pat_msg + 4 * i);
> +		update_cache_mode_entry(i, cache);
> +	}
> +	pr_info("x86/PAT: Configuration [0-7]: %s\n", pat_msg);
>   }
>
>   static void pat_ap_init(u64 pat)
>
Borislav Petkov May 31, 2015, 10:24 a.m. UTC | #2
On Sun, May 31, 2015 at 12:15:21PM +0200, Juergen Gross wrote:
> You are breaking the Xen build with that change. pat_init_cache_modes()
> is called from arch/x86/xen/enlighten.c as well.

Yeah, build-robot just caught that. Can you please check the enlighten.c
change in the other mail I just sent?

Thanks.
diff mbox

Patch

diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 476d0780560f..4d28759f5a1a 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -172,32 +172,14 @@  static enum page_cache_mode pat_get_cache_mode(unsigned pat_val, char *msg)
 
 #undef CM
 
-/*
- * Update the cache mode to pgprot translation tables according to PAT
- * configuration.
- * Using lower indices is preferred, so we start with highest index.
- */
-void pat_init_cache_modes(void)
-{
-	int i;
-	enum page_cache_mode cache;
-	char pat_msg[33];
-	u64 pat;
-
-	rdmsrl(MSR_IA32_CR_PAT, pat);
-	pat_msg[32] = 0;
-	for (i = 7; i >= 0; i--) {
-		cache = pat_get_cache_mode((pat >> (i * 8)) & 7,
-					   pat_msg + 4 * i);
-		update_cache_mode_entry(i, cache);
-	}
-	pr_info("x86/PAT: Configuration [0-7]: %s\n", pat_msg);
-}
-
 #define PAT(x, y)	((u64)PAT_ ## y << ((x)*8))
 
 static void pat_bsp_init(u64 pat)
 {
+	enum page_cache_mode cache;
+	char pat_msg[33];
+	int i;
+
 	if (!cpu_has_pat) {
 		pat_disable("PAT not supported by CPU.");
 		return;
@@ -211,7 +193,18 @@  static void pat_bsp_init(u64 pat)
 
 	wrmsrl(MSR_IA32_CR_PAT, pat);
 
-	pat_init_cache_modes();
+	pat_msg[32] = 0;
+
+	/*
+	 * Update the cache mode to pgprot translation tables according to PAT
+	 * configuration. Using lower indices is preferred, so we start with
+	 * highest index.
+	 */
+	for (i = 7; i >= 0; i--) {
+		cache = pat_get_cache_mode((pat >> (i * 8)) & 7, pat_msg + 4 * i);
+		update_cache_mode_entry(i, cache);
+	}
+	pr_info("x86/PAT: Configuration [0-7]: %s\n", pat_msg);
 }
 
 static void pat_ap_init(u64 pat)