mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-16 05:26:07 +00:00
KVM: e500: map readonly host pages for read
The new __kvm_faultin_pfn() function is upset by the fact that e500 KVM ignores host page permissions - __kvm_faultin requires a "writable" outgoing argument, but e500 KVM is nonchalantly passing NULL. If the host page permissions do not include writability, the shadow TLB entry is forcibly mapped read-only. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
f2104bf22f
commit
03b755b2aa
@ -374,6 +374,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
|
|||||||
unsigned long slot_start, slot_end;
|
unsigned long slot_start, slot_end;
|
||||||
|
|
||||||
pfnmap = 1;
|
pfnmap = 1;
|
||||||
|
writable = vma->vm_flags & VM_WRITE;
|
||||||
|
|
||||||
start = vma->vm_pgoff;
|
start = vma->vm_pgoff;
|
||||||
end = start +
|
end = start +
|
||||||
@ -449,7 +450,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
|
|||||||
|
|
||||||
if (likely(!pfnmap)) {
|
if (likely(!pfnmap)) {
|
||||||
tsize_pages = 1UL << (tsize + 10 - PAGE_SHIFT);
|
tsize_pages = 1UL << (tsize + 10 - PAGE_SHIFT);
|
||||||
pfn = __kvm_faultin_pfn(slot, gfn, FOLL_WRITE, NULL, &page);
|
pfn = __kvm_faultin_pfn(slot, gfn, FOLL_WRITE, &writable, &page);
|
||||||
if (is_error_noslot_pfn(pfn)) {
|
if (is_error_noslot_pfn(pfn)) {
|
||||||
if (printk_ratelimit())
|
if (printk_ratelimit())
|
||||||
pr_err("%s: real page not found for gfn %lx\n",
|
pr_err("%s: real page not found for gfn %lx\n",
|
||||||
@ -494,7 +495,7 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
|
|||||||
}
|
}
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
|
|
||||||
kvmppc_e500_ref_setup(ref, gtlbe, pfn, wimg, true);
|
kvmppc_e500_ref_setup(ref, gtlbe, pfn, wimg, writable);
|
||||||
kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize,
|
kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize,
|
||||||
ref, gvaddr, stlbe);
|
ref, gvaddr, stlbe);
|
||||||
writable = tlbe_is_writable(stlbe);
|
writable = tlbe_is_writable(stlbe);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user