mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] [1/10] MCE: Make 64bit mce code 32bit clean v2
Date: Tue,  8 Jul 2008 01:10:03 +0200 (CEST)	[thread overview]
Message-ID: <20080707231003.869001B4315@basil.firstfloor.org> (raw)
In-Reply-To: <20080708110.487722491@firstfloor.org>


Mostly replace unsigned long with u64s if they need to contain 64bit
values.

Also replace the simple_strtouls with strict_strtouls to shut
up checkpatch warnings.

v2: Do the strict_strtoull conversions correctly.

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 arch/x86/kernel/cpu/mcheck/mce_64.c |   12 ++++++------
 include/asm-x86/mce.h               |   24 ++++++++++++------------
 2 files changed, 18 insertions(+), 18 deletions(-)

Index: linux/arch/x86/kernel/cpu/mcheck/mce_64.c
===================================================================
--- linux.orig/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ linux/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -46,7 +46,7 @@ static int mce_dont_init;
  */
 static int tolerant = 1;
 static int banks;
-static unsigned long bank[NR_BANKS] = { [0 ... NR_BANKS-1] = ~0UL };
+static u64 bank[NR_BANKS] = { [0 ... NR_BANKS-1] = ~0UL };
 static unsigned long notify_user;
 static int rip_msr;
 static int mce_bootlog = -1;
@@ -129,15 +129,15 @@ static void print_mce(struct mce *m)
 	       "and contact your hardware vendor\n");
 }
 
-static void mce_panic(char *msg, struct mce *backup, unsigned long start)
+static void mce_panic(char *msg, struct mce *backup, u64 start)
 {
 	int i;
 
 	oops_begin();
 	for (i = 0; i < MCE_LOG_LEN; i++) {
-		unsigned long tsc = mcelog.entry[i].tsc;
+		u64 tsc = mcelog.entry[i].tsc;
 
-		if (time_before(tsc, start))
+		if (time_before64(tsc, start))
 			continue;
 		print_mce(&mcelog.entry[i]);
 		if (backup && mcelog.entry[i].tsc == backup->tsc)
@@ -754,15 +754,15 @@ DEFINE_PER_CPU(struct sys_device, device
 /* Why are there no generic functions for this? */
 #define ACCESSOR(name, var, start) \
 	static ssize_t show_ ## name(struct sys_device *s, char *buf) {	\
-		return sprintf(buf, "%lx\n", (unsigned long)var);	\
+		return sprintf(buf, "%Lx\n", (u64)var); 		\
 	}								\
 	static ssize_t set_ ## name(struct sys_device *s,const char *buf,size_t siz) { \
-		char *end;						\
-		unsigned long new = simple_strtoul(buf, &end, 0);	\
-		if (end == buf) return -EINVAL;				\
+		u64 new;						\
+		int err = strict_strtoull(buf, 0, &new);		\
+		if (err) return err;					\
 		var = new;						\
 		start;							\
-		return end-buf;						\
+		return strlen(buf);					\
 	}								\
 	static SYSDEV_ATTR(name, 0644, show_ ## name, set_ ## name);
 
Index: linux/include/asm-x86/mce.h
===================================================================
--- linux.orig/include/asm-x86/mce.h
+++ linux/include/asm-x86/mce.h
@@ -10,19 +10,19 @@
  * Machine Check support for x86
  */
 
-#define MCG_CTL_P	 (1UL<<8)   /* MCG_CAP register available */
+#define MCG_CTL_P	 (1ULL<<8)   /* MCG_CAP register available */
 
-#define MCG_STATUS_RIPV  (1UL<<0)   /* restart ip valid */
-#define MCG_STATUS_EIPV  (1UL<<1)   /* ip points to correct instruction */
-#define MCG_STATUS_MCIP  (1UL<<2)   /* machine check in progress */
-
-#define MCI_STATUS_VAL   (1UL<<63)  /* valid error */
-#define MCI_STATUS_OVER  (1UL<<62)  /* previous errors lost */
-#define MCI_STATUS_UC    (1UL<<61)  /* uncorrected error */
-#define MCI_STATUS_EN    (1UL<<60)  /* error enabled */
-#define MCI_STATUS_MISCV (1UL<<59)  /* misc error reg. valid */
-#define MCI_STATUS_ADDRV (1UL<<58)  /* addr reg. valid */
-#define MCI_STATUS_PCC   (1UL<<57)  /* processor context corrupt */
+#define MCG_STATUS_RIPV  (1ULL<<0)   /* restart ip valid */
+#define MCG_STATUS_EIPV  (1ULL<<1)   /* ip points to correct instruction */
+#define MCG_STATUS_MCIP  (1ULL<<2)   /* machine check in progress */
+
+#define MCI_STATUS_VAL	 (1ULL<<63)  /* valid error */
+#define MCI_STATUS_OVER  (1ULL<<62)  /* previous errors lost */
+#define MCI_STATUS_UC	 (1ULL<<61)  /* uncorrected error */
+#define MCI_STATUS_EN	 (1ULL<<60)  /* error enabled */
+#define MCI_STATUS_MISCV (1ULL<<59)  /* misc error reg. valid */
+#define MCI_STATUS_ADDRV (1ULL<<58)  /* addr reg. valid */
+#define MCI_STATUS_PCC	 (1ULL<<57)  /* processor context corrupt */
 
 /* Fields are zero when not available */
 struct mce {

  reply	other threads:[~2008-07-07 23:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-07 23:10 [PATCH] [0/10] Use 64bit x86 machine check code for 32bit too v2 Andi Kleen
2008-07-07 23:10 ` Andi Kleen [this message]
2008-07-07 23:10 ` [PATCH] [2/10] MCE: Implement the PPro bank 0 quirk in the 64bit machine check code Andi Kleen
2008-07-07 23:10 ` [PATCH] [3/10] MCE: Port K7 bank 0 quirk to 64bit mce code Andi Kleen
2008-07-07 23:10 ` [PATCH] [4/10] MCE: Call 64bit machine check through a call vector Andi Kleen
2008-07-07 23:10 ` [PATCH] [5/10] MCE: Rename mce_dont_init on 64bit to mce_disabled Andi Kleen
2008-07-07 23:10 ` [PATCH] [6/10] MCE: Provide exit_idle dummy functions for 32bit Andi Kleen
2008-07-07 23:10 ` [PATCH] [7/10] MCE: Remove machine check handler idle notify on 64bit Andi Kleen
2008-07-07 23:10 ` [PATCH] [8/10] MCE: Remove oops_begin() use in 64bit machine check Andi Kleen
2008-07-07 23:10 ` [PATCH] [9/10] Add missing includes in mce_intel_64.c Andi Kleen
2008-07-07 23:10 ` [PATCH] [10/10] MCE: Use 64bit machine check code on 32bit v2 Andi Kleen
2008-07-07 23:53 ` [PATCH] [0/10] Use 64bit x86 machine check code for 32bit too v2 H. Peter Anvin
2008-07-08 19:54   ` Max Asbock

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=20080707231003.869001B4315@basil.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

Powered by JetHome