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>
This commit is contained in:

committed by
Ingo Molnar

parent
fbd704374d
commit
dd2f4a004b
@@ -1092,6 +1092,26 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static u64 xen_read_msr(unsigned int msr)
|
||||
{
|
||||
/*
|
||||
* This will silently swallow a #GP from RDMSR. It may be worth
|
||||
* changing that.
|
||||
*/
|
||||
int err;
|
||||
|
||||
return xen_read_msr_safe(msr, &err);
|
||||
}
|
||||
|
||||
static void xen_write_msr(unsigned int msr, unsigned low, unsigned high)
|
||||
{
|
||||
/*
|
||||
* This will silently swallow a #GP from WRMSR. It may be worth
|
||||
* changing that.
|
||||
*/
|
||||
xen_write_msr_safe(msr, low, high);
|
||||
}
|
||||
|
||||
void xen_setup_shared_info(void)
|
||||
{
|
||||
if (!xen_feature(XENFEAT_auto_translated_physmap)) {
|
||||
@@ -1222,6 +1242,9 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
|
||||
|
||||
.wbinvd = native_wbinvd,
|
||||
|
||||
.read_msr = xen_read_msr,
|
||||
.write_msr = xen_write_msr,
|
||||
|
||||
.read_msr_safe = xen_read_msr_safe,
|
||||
.write_msr_safe = xen_write_msr_safe,
|
||||
|
||||
|
Reference in New Issue
Block a user