diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-08-31 17:23:29 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-08-31 18:15:23 -0400 |
commit | 0cc0213e73af5963eca259c84876937c20689dbd (patch) | |
tree | 2e3db62cc241269fbb3ee3313e568239cf4c9bd0 | |
parent | 79c5dca3619d6ae15815eec14cd7a43db5f38b47 (diff) |
x86, msr: Have the _safe MSR functions return -EIO, not -EFAULT
For some reason, the _safe MSR functions returned -EFAULT, not -EIO.
However, the only user which cares about the return code as anything
other than a boolean is the MSR driver, which wants -EIO. Change it
to -EIO across the board.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: Alok Kataria <akataria@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | arch/x86/include/asm/msr.h | 4 | ||||
-rw-r--r-- | arch/x86/kernel/msr.c | 10 | ||||
-rw-r--r-- | arch/x86/xen/enlighten.c | 2 |
3 files changed, 5 insertions, 11 deletions
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index 09c5ca70d49d..943fdd572e16 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h | |||
@@ -67,7 +67,7 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr, | |||
67 | ".previous\n\t" | 67 | ".previous\n\t" |
68 | _ASM_EXTABLE(2b, 3b) | 68 | _ASM_EXTABLE(2b, 3b) |
69 | : [err] "=r" (*err), EAX_EDX_RET(val, low, high) | 69 | : [err] "=r" (*err), EAX_EDX_RET(val, low, high) |
70 | : "c" (msr), [fault] "i" (-EFAULT)); | 70 | : "c" (msr), [fault] "i" (-EIO)); |
71 | return EAX_EDX_VAL(val, low, high); | 71 | return EAX_EDX_VAL(val, low, high); |
72 | } | 72 | } |
73 | 73 | ||
@@ -90,7 +90,7 @@ notrace static inline int native_write_msr_safe(unsigned int msr, | |||
90 | _ASM_EXTABLE(2b, 3b) | 90 | _ASM_EXTABLE(2b, 3b) |
91 | : [err] "=a" (err) | 91 | : [err] "=a" (err) |
92 | : "c" (msr), "0" (low), "d" (high), | 92 | : "c" (msr), "0" (low), "d" (high), |
93 | [fault] "i" (-EFAULT) | 93 | [fault] "i" (-EIO) |
94 | : "memory"); | 94 | : "memory"); |
95 | return err; | 95 | return err; |
96 | } | 96 | } |
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index 98fd6cd4e3a4..2cfbb4b2c422 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c | |||
@@ -80,11 +80,8 @@ static ssize_t msr_read(struct file *file, char __user *buf, | |||
80 | 80 | ||
81 | for (; count; count -= 8) { | 81 | for (; count; count -= 8) { |
82 | err = rdmsr_safe_on_cpu(cpu, reg, &data[0], &data[1]); | 82 | err = rdmsr_safe_on_cpu(cpu, reg, &data[0], &data[1]); |
83 | if (err) { | 83 | if (err) |
84 | if (err == -EFAULT) /* Fix idiotic error code */ | ||
85 | err = -EIO; | ||
86 | break; | 84 | break; |
87 | } | ||
88 | if (copy_to_user(tmp, &data, 8)) { | 85 | if (copy_to_user(tmp, &data, 8)) { |
89 | err = -EFAULT; | 86 | err = -EFAULT; |
90 | break; | 87 | break; |
@@ -115,11 +112,8 @@ static ssize_t msr_write(struct file *file, const char __user *buf, | |||
115 | break; | 112 | break; |
116 | } | 113 | } |
117 | err = wrmsr_safe_on_cpu(cpu, reg, data[0], data[1]); | 114 | err = wrmsr_safe_on_cpu(cpu, reg, data[0], data[1]); |
118 | if (err) { | 115 | if (err) |
119 | if (err == -EFAULT) /* Fix idiotic error code */ | ||
120 | err = -EIO; | ||
121 | break; | 116 | break; |
122 | } | ||
123 | tmp += 2; | 117 | tmp += 2; |
124 | bytes += 8; | 118 | bytes += 8; |
125 | } | 119 | } |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 0a1700a2be9c..a8432d816903 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -713,7 +713,7 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high) | |||
713 | set: | 713 | set: |
714 | base = ((u64)high << 32) | low; | 714 | base = ((u64)high << 32) | low; |
715 | if (HYPERVISOR_set_segment_base(which, base) != 0) | 715 | if (HYPERVISOR_set_segment_base(which, base) != 0) |
716 | ret = -EFAULT; | 716 | ret = -EIO; |
717 | break; | 717 | break; |
718 | #endif | 718 | #endif |
719 | 719 | ||