KVM: PPC: Allocate guest TCEs on demand too
Quoted 13 lines · Alexey Kardashevskiy
We already allocate hardware TCE tables in multiple levels and skip intermediate levels when we can, now it is a turn of the KVM TCE tables. Thankfully these are allocated already in 2 levels.
This moves the table's last level allocation from the creating helper to
kvmppc_tce_put()andkvm_spapr_tce_fault(). Since such allocation cannot be done in real mode, this creates a virtual mode version ofkvmppc_tce_put()which handles allocations.This adds
kvmppc_rm_ioba_validate()to do an additional test if the consequentkvmppc_tce_put()needs a page which has not been allocated; if this is the case, we bail out to virtual mode handlers.
Quoted 5 lines
The allocations are protected by a new mutex as
kvm->lockis not suitable for the task because the fault handler is called with themmap_semheld butkvmhv_setup_mmu()lockskvm->lockandmmap_semin the reverse order.Signed-off-by Alexey Kardashevskiy <[email protected]>
Thanks, patch applied to my kvm-ppc-next tree.
Paul.