public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jaswinder Singh Rajput <jaswinder@kernel.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@kernel.org>,
	Robert Richter <robert.richter@amd.com>,
	Dave Jones <davej@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	x86 maintainers <x86@kernel.org>
Subject: [PATCH 8/10 -tip] x86: Add cpufeature for Microcode update
Date: Tue, 12 May 2009 21:13:16 +0530	[thread overview]
Message-ID: <1242142996.2547.22.camel@ht.satnam> (raw)
In-Reply-To: <1242142941.2547.21.camel@ht.satnam>


Setting microcode update feature to friendly access of UCODE MSRs like:
1. IA32_PLATFORM_ID (Intel)
2. IA32_UCODE_WRITE (Intel)
3. IA32_UCODE_REV (Intel)
4. MSR_AMD64_PATCH_LEVEL (AMD)
5. MSR_AMD64_PATCH_LOADER (AMD)

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
---
 arch/x86/include/asm/cpufeature.h |    1 +
 arch/x86/kernel/cpu/amd.c         |   12 ++++++++++++
 arch/x86/kernel/cpu/intel.c       |   11 +++++++++++
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index d37ab0f..1fd6770 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -155,6 +155,7 @@
 #define X86_FEATURE_IDA		(7*32+ 0) /* Intel Dynamic Acceleration	*/
 #define X86_FEATURE_ARAT	(7*32+ 1) /* Always Running APIC Timer	*/
 #define X86_FEATURE_PNAME	(7*32+ 2) /* Processor Name		*/
+#define X86_FEATURE_MICROCODE	(7*32+ 3) /* Microcode update		*/
 
 /* Virtualization flags: Linux defined */
 #define X86_FEATURE_TPR_SHADOW  (8*32+ 0) /* Intel TPR Shadow */
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 1d36ac4..ca133a0 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -352,6 +352,15 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
 #endif
 }
 
+/* Set cpufeatures to friendly access miscellaneous MSRs		*/
+static void __cpuinit set_soft_cpufeatures(struct cpuinfo_x86 *c)
+{
+	if (c->x86 >= 0x10) {				/* fam10h+	*/
+		/* setting microcode update feature			*/
+		set_cpu_cap(c, X86_FEATURE_MICROCODE);
+	}
+}
+
 static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 {
 #ifdef CONFIG_SMP
@@ -371,6 +380,9 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 	}
 #endif
 
+	/* setting early so that other functions can take advantage */
+	set_soft_cpufeatures(c);
+
 	early_init_amd(c);
 
 	/*
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 62130a0..ddb26f2 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -303,10 +303,21 @@ static void __cpuinit detect_vmx_virtcap(struct cpuinfo_x86 *c)
 	}
 }
 
+/* Set cpufeatures to friendly access miscellaneous MSRs		*/
+static void __cpuinit set_soft_cpufeatures(struct cpuinfo_x86 *c)
+{
+	/* setting microcode update feature				*/
+	if (c->x86 >= 6 && !cpu_has(c, X86_FEATURE_IA64))
+		set_cpu_cap(c, X86_FEATURE_MICROCODE);
+}
+
 static void __cpuinit init_intel(struct cpuinfo_x86 *c)
 {
 	unsigned int l2 = 0;
 
+	/* setting early so that other functions can take advantage */
+	set_soft_cpufeatures(c);
+
 	early_init_intel(c);
 
 	intel_workarounds(c);
-- 
1.6.0.6




  reply	other threads:[~2009-05-12 15:49 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-12 15:35 [git-pull -tip][PATCH 0/10] few cpufeature additions and users Jaswinder Singh Rajput
2009-05-12 15:37 ` [PATCH 1/10 -tip] x86: Add cpufeature for Processor Name Jaswinder Singh Rajput
2009-05-12 15:38   ` [PATCH 2/10 -tip] x86: get_model_name() user of X86_FEATURE_PNAME Jaswinder Singh Rajput
2009-05-12 15:39     ` [PATCH 3/10 -tip] x86: Add cpufeatures for Advanced Power Management Jaswinder Singh Rajput
2009-05-12 15:40       ` [PATCH 4/10 -tip] x86: check_powernow() for K7 user of Advanced Power Management features Jaswinder Singh Rajput
2009-05-12 15:40         ` [PATCH 5/10 -tip] x86: check_powernow() for K8 and later " Jaswinder Singh Rajput
2009-05-12 15:41           ` [PATCH 6/10 -tip] x86: early_init_intel() " Jaswinder Singh Rajput
2009-05-12 15:42             ` [PATCH 7/10 -tip] x86: early_init_amd() " Jaswinder Singh Rajput
2009-05-12 15:43               ` Jaswinder Singh Rajput [this message]
2009-05-12 15:44                 ` [PATCH 9/10 -tip] x86: collect_cpu_info() of Intel user of Microcode feature Jaswinder Singh Rajput
2009-05-12 15:44                   ` [PATCH 10/10 -tip] x86: collect_cpu_info() of AMD " Jaswinder Singh Rajput
2009-05-13  5:47                     ` Andreas Herrmann
2009-05-13  7:20                       ` Jaswinder Singh Rajput
2009-05-13  5:46                 ` [PATCH 8/10 -tip] x86: Add cpufeature for Microcode update Andreas Herrmann
2009-05-13  7:18                   ` Jaswinder Singh Rajput
2009-05-13  6:18             ` [PATCH 6/10 -tip] x86: early_init_intel() user of Advanced Power Management features Andreas Herrmann
2009-05-13  7:20               ` Jaswinder Singh Rajput
2009-05-12 17:48           ` [PATCH 5/10 -tip] x86: check_powernow() for K8 and later " Ingo Molnar
2009-05-12 18:45             ` Jaswinder Singh Rajput
2009-05-13  6:36               ` Andreas Herrmann
2009-05-12 19:07         ` [PATCH 4/10 -tip] x86: check_powernow() for K7 " Jaswinder Singh Rajput
2009-05-12 19:06       ` [PATCH 3/10 -tip] x86: Add cpufeatures for Advanced Power Management Jaswinder Singh Rajput
2009-05-12 21:04         ` Thomas Gleixner
2009-05-13  8:57           ` Jaswinder Singh Rajput
2009-05-15 13:47           ` Jaswinder Singh Rajput
2009-05-17 12:17             ` Thomas Gleixner
2009-05-17 14:18               ` Jaswinder Singh Rajput
2009-05-19 15:01               ` Jaswinder Singh Rajput
2009-05-19 16:41                 ` H. Peter Anvin
2009-05-20  7:15                   ` Jaswinder Singh Rajput
2009-05-20  7:23                     ` Jaswinder Singh Rajput
2009-05-20 18:30                     ` H. Peter Anvin
2009-05-21  5:09                       ` Jaswinder Singh Rajput
2009-05-13  6:27         ` Andreas Herrmann
2009-05-21  6:14           ` H. Peter Anvin
2009-05-21  6:11   ` [PATCH 1/10 -tip] x86: Add cpufeature for Processor Name H. Peter Anvin
2009-05-21  7:38     ` Jaswinder Singh Rajput
2009-05-21 20:09       ` H. Peter Anvin
2009-05-12 20:15 ` [git-pull -tip][PATCH 0/10] few cpufeature additions and users Jaswinder Singh Rajput

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=1242142996.2547.22.camel@ht.satnam \
    --to=jaswinder@kernel.org \
    --cc=davej@redhat.com \
    --cc=hpa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=robert.richter@amd.com \
    --cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox