All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Egger <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] x86 cpu: use rdmsrl/wrmsrl
Date: Fri, 25 Jun 2010 13:43:46 +0200	[thread overview]
Message-ID: <201006251343.46237.Christoph.Egger@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]


Hi!

Attached patch makes x86 cpu code using rdmsrl/wrmsrl and
cleans up surrounding code.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>

-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

[-- Attachment #2: xen_cpu.diff --]
[-- Type: text/x-diff, Size: 2340 bytes --]

diff -r 27ee92d40743 xen/arch/x86/cpu/centaur.c
--- a/xen/arch/x86/cpu/centaur.c	Fri Jun 25 08:39:44 2010 +0100
+++ b/xen/arch/x86/cpu/centaur.c	Fri Jun 25 13:39:45 2010 +0200
@@ -17,7 +17,7 @@
 
 static void __init init_c3(struct cpuinfo_x86 *c)
 {
-	u32  lo, hi;
+	uint64_t msr_content;
 
 	/* Test for Centaur Extended Feature Flags presence */
 	if (cpuid_eax(0xC0000000) >= 0xC0000001) {
@@ -25,17 +25,17 @@ static void __init init_c3(struct cpuinf
 
 		/* enable ACE unit, if present and disabled */
 		if ((tmp & (ACE_PRESENT | ACE_ENABLED)) == ACE_PRESENT) {
-			rdmsr (MSR_VIA_FCR, lo, hi);
-			lo |= ACE_FCR;		/* enable ACE unit */
-			wrmsr (MSR_VIA_FCR, lo, hi);
+			rdmsrl(MSR_VIA_FCR, msr_content);
+			/* enable ACE unit */
+			wrmsrl(MSR_VIA_FCR, msr_content | ACE_FCR);
 			printk(KERN_INFO "CPU: Enabled ACE h/w crypto\n");
 		}
 
 		/* enable RNG unit, if present and disabled */
 		if ((tmp & (RNG_PRESENT | RNG_ENABLED)) == RNG_PRESENT) {
-			rdmsr (MSR_VIA_RNG, lo, hi);
-			lo |= RNG_ENABLE;	/* enable RNG unit */
-			wrmsr (MSR_VIA_RNG, lo, hi);
+			rdmsrl(MSR_VIA_RNG, msr_content);
+			/* enable RNG unit */
+			wrmsrl(MSR_VIA_RNG, msr_content | RNG_ENABLE);
 			printk(KERN_INFO "CPU: Enabled h/w RNG\n");
 		}
 
@@ -47,9 +47,8 @@ static void __init init_c3(struct cpuinf
 
 	/* Cyrix III family needs CX8 & PGE explicity enabled. */
 	if (c->x86_model >=6 && c->x86_model <= 9) {
-		rdmsr (MSR_VIA_FCR, lo, hi);
-		lo |= (1<<1 | 1<<7);
-		wrmsr (MSR_VIA_FCR, lo, hi);
+		rdmsrl(MSR_VIA_FCR, msr_content);
+		wrmsrl(MSR_VIA_FCR, msr_content | (1ULL << 1 | 1ULL << 7));
 		set_bit(X86_FEATURE_CX8, c->x86_capability);
 	}
 
diff -r 27ee92d40743 xen/arch/x86/cpu/common.c
--- a/xen/arch/x86/cpu/common.c	Fri Jun 25 08:39:44 2010 +0100
+++ b/xen/arch/x86/cpu/common.c	Fri Jun 25 13:39:45 2010 +0200
@@ -324,10 +324,9 @@ static void __cpuinit squash_the_stupid_
 {
 	if (cpu_has(c, X86_FEATURE_PN) && disable_x86_serial_nr ) {
 		/* Disable processor serial number */
-		unsigned long lo,hi;
-		rdmsr(MSR_IA32_BBL_CR_CTL,lo,hi);
-		lo |= 0x200000;
-		wrmsr(MSR_IA32_BBL_CR_CTL,lo,hi);
+		uint64_t msr_content;
+		rdmsrl(MSR_IA32_BBL_CR_CTL,msr_content);
+		wrmsrl(MSR_IA32_BBL_CR_CTL, msr_content | 0x200000);
 		printk(KERN_NOTICE "CPU serial number disabled.\n");
 		clear_bit(X86_FEATURE_PN, c->x86_capability);
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2010-06-25 11:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-25 11:43 Christoph Egger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-06-29  8:37 [PATCH] x86 cpu: use rdmsrl/wrmsrl Christoph Egger
2010-06-29 12:28 ` Keir Fraser

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=201006251343.46237.Christoph.Egger@amd.com \
    --to=christoph.egger@amd.com \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.