mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-01 02:21:16 +00:00
Merge git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull kvm bugfixes from Gleb Natapov. * git://git.kernel.org/pub/scm/virt/kvm/kvm: KVM/MIPS32: Wrap calls to gfn_to_pfn() with srcu_read_lock/unlock() KVM/MIPS32: Move include/asm/kvm.h => include/uapi/asm/kvm.h since it is a user visible API. KVM: take over co-maintainership from Marcelo, fix MAINTAINERS entry
This commit is contained in:
commit
72dd4e7980
3 changed files with 30 additions and 12 deletions
|
@ -4641,12 +4641,13 @@ F: include/linux/sunrpc/
|
||||||
F: include/uapi/linux/sunrpc/
|
F: include/uapi/linux/sunrpc/
|
||||||
|
|
||||||
KERNEL VIRTUAL MACHINE (KVM)
|
KERNEL VIRTUAL MACHINE (KVM)
|
||||||
M: Marcelo Tosatti <mtosatti@redhat.com>
|
|
||||||
M: Gleb Natapov <gleb@redhat.com>
|
M: Gleb Natapov <gleb@redhat.com>
|
||||||
|
M: Paolo Bonzini <pbonzini@redhat.com>
|
||||||
L: kvm@vger.kernel.org
|
L: kvm@vger.kernel.org
|
||||||
W: http://kvm.qumranet.com
|
W: http://linux-kvm.org
|
||||||
S: Supported
|
S: Supported
|
||||||
F: Documentation/*/kvm.txt
|
F: Documentation/*/kvm*.txt
|
||||||
|
F: Documentation/virtual/kvm/
|
||||||
F: arch/*/kvm/
|
F: arch/*/kvm/
|
||||||
F: arch/*/include/asm/kvm*
|
F: arch/*/include/asm/kvm*
|
||||||
F: include/linux/kvm*
|
F: include/linux/kvm*
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/kvm_host.h>
|
#include <linux/kvm_host.h>
|
||||||
|
#include <linux/srcu.h>
|
||||||
|
|
||||||
|
|
||||||
#include <asm/cpu.h>
|
#include <asm/cpu.h>
|
||||||
#include <asm/bootinfo.h>
|
#include <asm/bootinfo.h>
|
||||||
|
@ -169,21 +171,27 @@ void kvm_mips_dump_shadow_tlbs(struct kvm_vcpu *vcpu)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kvm_mips_map_page(struct kvm *kvm, gfn_t gfn)
|
static int kvm_mips_map_page(struct kvm *kvm, gfn_t gfn)
|
||||||
{
|
{
|
||||||
|
int srcu_idx, err = 0;
|
||||||
pfn_t pfn;
|
pfn_t pfn;
|
||||||
|
|
||||||
if (kvm->arch.guest_pmap[gfn] != KVM_INVALID_PAGE)
|
if (kvm->arch.guest_pmap[gfn] != KVM_INVALID_PAGE)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
|
srcu_idx = srcu_read_lock(&kvm->srcu);
|
||||||
pfn = kvm_mips_gfn_to_pfn(kvm, gfn);
|
pfn = kvm_mips_gfn_to_pfn(kvm, gfn);
|
||||||
|
|
||||||
if (kvm_mips_is_error_pfn(pfn)) {
|
if (kvm_mips_is_error_pfn(pfn)) {
|
||||||
panic("Couldn't get pfn for gfn %#" PRIx64 "!\n", gfn);
|
kvm_err("Couldn't get pfn for gfn %#" PRIx64 "!\n", gfn);
|
||||||
|
err = -EFAULT;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
kvm->arch.guest_pmap[gfn] = pfn;
|
kvm->arch.guest_pmap[gfn] = pfn;
|
||||||
return;
|
out:
|
||||||
|
srcu_read_unlock(&kvm->srcu, srcu_idx);
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Translate guest KSEG0 addresses to Host PA */
|
/* Translate guest KSEG0 addresses to Host PA */
|
||||||
|
@ -207,7 +215,10 @@ unsigned long kvm_mips_translate_guest_kseg0_to_hpa(struct kvm_vcpu *vcpu,
|
||||||
gva);
|
gva);
|
||||||
return KVM_INVALID_PAGE;
|
return KVM_INVALID_PAGE;
|
||||||
}
|
}
|
||||||
kvm_mips_map_page(vcpu->kvm, gfn);
|
|
||||||
|
if (kvm_mips_map_page(vcpu->kvm, gfn) < 0)
|
||||||
|
return KVM_INVALID_ADDR;
|
||||||
|
|
||||||
return (kvm->arch.guest_pmap[gfn] << PAGE_SHIFT) + offset;
|
return (kvm->arch.guest_pmap[gfn] << PAGE_SHIFT) + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,8 +321,11 @@ int kvm_mips_handle_kseg0_tlb_fault(unsigned long badvaddr,
|
||||||
even = !(gfn & 0x1);
|
even = !(gfn & 0x1);
|
||||||
vaddr = badvaddr & (PAGE_MASK << 1);
|
vaddr = badvaddr & (PAGE_MASK << 1);
|
||||||
|
|
||||||
kvm_mips_map_page(vcpu->kvm, gfn);
|
if (kvm_mips_map_page(vcpu->kvm, gfn) < 0)
|
||||||
kvm_mips_map_page(vcpu->kvm, gfn ^ 0x1);
|
return -1;
|
||||||
|
|
||||||
|
if (kvm_mips_map_page(vcpu->kvm, gfn ^ 0x1) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (even) {
|
if (even) {
|
||||||
pfn0 = kvm->arch.guest_pmap[gfn];
|
pfn0 = kvm->arch.guest_pmap[gfn];
|
||||||
|
@ -389,8 +403,11 @@ kvm_mips_handle_mapped_seg_tlb_fault(struct kvm_vcpu *vcpu,
|
||||||
pfn0 = 0;
|
pfn0 = 0;
|
||||||
pfn1 = 0;
|
pfn1 = 0;
|
||||||
} else {
|
} else {
|
||||||
kvm_mips_map_page(kvm, mips3_tlbpfn_to_paddr(tlb->tlb_lo0) >> PAGE_SHIFT);
|
if (kvm_mips_map_page(kvm, mips3_tlbpfn_to_paddr(tlb->tlb_lo0) >> PAGE_SHIFT) < 0)
|
||||||
kvm_mips_map_page(kvm, mips3_tlbpfn_to_paddr(tlb->tlb_lo1) >> PAGE_SHIFT);
|
return -1;
|
||||||
|
|
||||||
|
if (kvm_mips_map_page(kvm, mips3_tlbpfn_to_paddr(tlb->tlb_lo1) >> PAGE_SHIFT) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
pfn0 = kvm->arch.guest_pmap[mips3_tlbpfn_to_paddr(tlb->tlb_lo0) >> PAGE_SHIFT];
|
pfn0 = kvm->arch.guest_pmap[mips3_tlbpfn_to_paddr(tlb->tlb_lo0) >> PAGE_SHIFT];
|
||||||
pfn1 = kvm->arch.guest_pmap[mips3_tlbpfn_to_paddr(tlb->tlb_lo1) >> PAGE_SHIFT];
|
pfn1 = kvm->arch.guest_pmap[mips3_tlbpfn_to_paddr(tlb->tlb_lo1) >> PAGE_SHIFT];
|
||||||
|
|
Loading…
Reference in a new issue