aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/enlighten.c
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@kernel.org>2016-04-02 10:01:38 -0400
committerIngo Molnar <mingo@kernel.org>2016-04-13 05:37:46 -0400
commitdd2f4a004b016bbfb64f1de49cb45e66232e40a6 (patch)
tree8c95610aa558cd7c257c08608c063dec10c9f215 /arch/x86/xen/enlighten.c
parentfbd704374d111bed16a19261176fa30e2379c87c (diff)
x86/paravirt: Add paravirt_{read,write}_msr()
This adds paravirt callbacks for unsafe MSR access. On native, they call native_{read,write}_msr(). On Xen, they use xen_{read,write}_msr_safe(). Nothing uses them yet for ease of bisection. The next patch will use them in rdmsrl(), wrmsrl(), etc. I intentionally didn't make them warn on #GP on Xen. I think that should be done separately by the Xen maintainers. Tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Andy Lutomirski <luto@kernel.org> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Borislav Petkov <bp@alien8.de> Cc: KVM list <kvm@vger.kernel.org> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: xen-devel <Xen-devel@lists.xen.org> Link: http://lkml.kernel.org/r/880eebc5dcd2ad9f310d41345f82061ea500e9fa.1459605520.git.luto@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/xen/enlighten.c')
-rw-r--r--arch/x86/xen/enlighten.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 13f756fdcb33..6ab672233ac9 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1092,6 +1092,26 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
1092 return ret; 1092 return ret;
1093} 1093}
1094 1094
1095static u64 xen_read_msr(unsigned int msr)
1096{
1097 /*
1098 * This will silently swallow a #GP from RDMSR. It may be worth
1099 * changing that.
1100 */
1101 int err;
1102
1103 return xen_read_msr_safe(msr, &err);
1104}
1105
1106static void xen_write_msr(unsigned int msr, unsigned low, unsigned high)
1107{
1108 /*
1109 * This will silently swallow a #GP from WRMSR. It may be worth
1110 * changing that.
1111 */
1112 xen_write_msr_safe(msr, low, high);
1113}
1114
1095void xen_setup_shared_info(void) 1115void xen_setup_shared_info(void)
1096{ 1116{
1097 if (!xen_feature(XENFEAT_auto_translated_physmap)) { 1117 if (!xen_feature(XENFEAT_auto_translated_physmap)) {
@@ -1222,6 +1242,9 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
1222 1242
1223 .wbinvd = native_wbinvd, 1243 .wbinvd = native_wbinvd,
1224 1244
1245 .read_msr = xen_read_msr,
1246 .write_msr = xen_write_msr,
1247
1225 .read_msr_safe = xen_read_msr_safe, 1248 .read_msr_safe = xen_read_msr_safe,
1226 .write_msr_safe = xen_write_msr_safe, 1249 .write_msr_safe = xen_write_msr_safe,
1227 1250