Commit 0cc0213e authored by H. Peter Anvin's avatar H. Peter Anvin

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: default avatarH. 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>
parent 79c5dca3
...@@ -67,7 +67,7 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr, ...@@ -67,7 +67,7 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr,
".previous\n\t" ".previous\n\t"
_ASM_EXTABLE(2b, 3b) _ASM_EXTABLE(2b, 3b)
: [err] "=r" (*err), EAX_EDX_RET(val, low, high) : [err] "=r" (*err), EAX_EDX_RET(val, low, high)
: "c" (msr), [fault] "i" (-EFAULT)); : "c" (msr), [fault] "i" (-EIO));
return EAX_EDX_VAL(val, low, high); return EAX_EDX_VAL(val, low, high);
} }
...@@ -90,7 +90,7 @@ notrace static inline int native_write_msr_safe(unsigned int msr, ...@@ -90,7 +90,7 @@ notrace static inline int native_write_msr_safe(unsigned int msr,
_ASM_EXTABLE(2b, 3b) _ASM_EXTABLE(2b, 3b)
: [err] "=a" (err) : [err] "=a" (err)
: "c" (msr), "0" (low), "d" (high), : "c" (msr), "0" (low), "d" (high),
[fault] "i" (-EFAULT) [fault] "i" (-EIO)
: "memory"); : "memory");
return err; return err;
} }
......
...@@ -80,11 +80,8 @@ static ssize_t msr_read(struct file *file, char __user *buf, ...@@ -80,11 +80,8 @@ static ssize_t msr_read(struct file *file, char __user *buf,
for (; count; count -= 8) { for (; count; count -= 8) {
err = rdmsr_safe_on_cpu(cpu, reg, &data[0], &data[1]); err = rdmsr_safe_on_cpu(cpu, reg, &data[0], &data[1]);
if (err) { if (err)
if (err == -EFAULT) /* Fix idiotic error code */
err = -EIO;
break; break;
}
if (copy_to_user(tmp, &data, 8)) { if (copy_to_user(tmp, &data, 8)) {
err = -EFAULT; err = -EFAULT;
break; break;
...@@ -115,11 +112,8 @@ static ssize_t msr_write(struct file *file, const char __user *buf, ...@@ -115,11 +112,8 @@ static ssize_t msr_write(struct file *file, const char __user *buf,
break; break;
} }
err = wrmsr_safe_on_cpu(cpu, reg, data[0], data[1]); err = wrmsr_safe_on_cpu(cpu, reg, data[0], data[1]);
if (err) { if (err)
if (err == -EFAULT) /* Fix idiotic error code */
err = -EIO;
break; break;
}
tmp += 2; tmp += 2;
bytes += 8; bytes += 8;
} }
......
...@@ -713,7 +713,7 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high) ...@@ -713,7 +713,7 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
set: set:
base = ((u64)high << 32) | low; base = ((u64)high << 32) | low;
if (HYPERVISOR_set_segment_base(which, base) != 0) if (HYPERVISOR_set_segment_base(which, base) != 0)
ret = -EFAULT; ret = -EIO;
break; break;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment