Skip to content

Commit e97fbb4

Browse files
committed
KVM: e500: use shadow TLB entry as witness for writability
kvmppc_e500_ref_setup is returning whether the guest TLB entry is writable, which is than passed to kvm_release_faultin_page. This makes little sense for two reasons: first, because the function sets up the private data for the page and the return value feels like it has been bolted on the side; second, because what really matters is whether the _shadow_ TLB entry is writable. If it is not writable, the page can be released as non-dirty. Shift from using tlbe_is_writable(gtlbe) to doing the same check on the shadow TLB entry. Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 87ecfdb commit e97fbb4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

arch/powerpc/kvm/e500_mmu_host.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static inline int tlbe_is_writable(struct kvm_book3e_206_tlb_entry *tlbe)
242242
return tlbe->mas7_3 & (MAS3_SW|MAS3_UW);
243243
}
244244

245-
static inline bool kvmppc_e500_ref_setup(struct tlbe_ref *ref,
245+
static inline void kvmppc_e500_ref_setup(struct tlbe_ref *ref,
246246
struct kvm_book3e_206_tlb_entry *gtlbe,
247247
kvm_pfn_t pfn, unsigned int wimg)
248248
{
@@ -251,8 +251,6 @@ static inline bool kvmppc_e500_ref_setup(struct tlbe_ref *ref,
251251

252252
/* Use guest supplied MAS2_G and MAS2_E */
253253
ref->flags |= (gtlbe->mas2 & MAS2_ATTRIB_MASK) | wimg;
254-
255-
return tlbe_is_writable(gtlbe);
256254
}
257255

258256
static inline void kvmppc_e500_ref_release(struct tlbe_ref *ref)
@@ -489,9 +487,10 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
489487
}
490488
local_irq_restore(flags);
491489

492-
writable = kvmppc_e500_ref_setup(ref, gtlbe, pfn, wimg);
490+
kvmppc_e500_ref_setup(ref, gtlbe, pfn, wimg);
493491
kvmppc_e500_setup_stlbe(&vcpu_e500->vcpu, gtlbe, tsize,
494492
ref, gvaddr, stlbe);
493+
writable = tlbe_is_writable(stlbe);
495494

496495
/* Clear i-cache for new pages */
497496
kvmppc_mmu_flush_icache(pfn);

0 commit comments

Comments
 (0)