mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
KVM: MIPS/MMU: Use lockless GVA helpers for get_inst()
Use the lockless GVA helpers to implement the reading of guest instructions for emulation. This will allow it to handle asynchronous TLB flushes when they are implemented. Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: "Radim Krčmář" <rkrcmar@redhat.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org Cc: kvm@vger.kernel.org
This commit is contained in:
parent
4b21e8abf9
commit
5207ce144a
1 changed files with 19 additions and 4 deletions
|
@ -787,11 +787,26 @@ int kvm_get_inst(u32 *opc, struct kvm_vcpu *vcpu, u32 *out)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
retry:
|
||||||
|
kvm_trap_emul_gva_lockless_begin(vcpu);
|
||||||
err = get_user(*out, opc);
|
err = get_user(*out, opc);
|
||||||
if (unlikely(err)) {
|
kvm_trap_emul_gva_lockless_end(vcpu);
|
||||||
kvm_err("%s: illegal address: %p\n", __func__, opc);
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (unlikely(err)) {
|
||||||
|
/*
|
||||||
|
* Try to handle the fault, maybe we just raced with a GVA
|
||||||
|
* invalidation.
|
||||||
|
*/
|
||||||
|
err = kvm_trap_emul_gva_fault(vcpu, (unsigned long)opc,
|
||||||
|
false);
|
||||||
|
if (unlikely(err)) {
|
||||||
|
kvm_err("%s: illegal address: %p\n",
|
||||||
|
__func__, opc);
|
||||||
|
return -EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hopefully it'll work now */
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue