mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-10 19:35:21 +02:00
ANDROID: KVM: Fix fast-forward size in pkvm_mem_abort_range()
When a block mapping could be installed, pkvm_mem_abort_range() was not
skipping the entire block range from the iteration leading to up to 511
useless calls to pkvm_mem_abort().
Also, it was possible to cover less than the requested range if the
original fault IPA wasn't PMD-aligned but a PMD mapping has been
installed.
The system can recover from both problems... however fix the iteration
to avoid useless hyp/host back and forths.
Bug: 278749606
Bug: 243642516
Fixes: 5d9808b907
("ANDROID: KVM: arm64: THP support for pKVM guests")
Change-Id: I99e5225a6aea3869aa78ff52ada6949748b78c6f
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
This commit is contained in:
parent
92db83f6bf
commit
aeaa3ba902
|
@ -1804,7 +1804,7 @@ int pkvm_mem_abort_range(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, size_t si
|
|||
read_lock(&vcpu->kvm->mmu_lock);
|
||||
ppage = find_ppage_or_above(vcpu->kvm, fault_ipa);
|
||||
|
||||
while (size) {
|
||||
while (fault_ipa < ipa_end) {
|
||||
if (ppage && ppage->ipa == fault_ipa) {
|
||||
page_size = PAGE_SIZE << ppage->order;
|
||||
ppage = mt_next(&vcpu->kvm->arch.pkvm.pinned_pages,
|
||||
|
@ -1832,11 +1832,10 @@ int pkvm_mem_abort_range(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, size_t si
|
|||
* We had to release the mmu_lock so let's update the
|
||||
* reference.
|
||||
*/
|
||||
ppage = find_ppage_or_above(vcpu->kvm, fault_ipa + PAGE_SIZE);
|
||||
ppage = find_ppage_or_above(vcpu->kvm, fault_ipa + page_size);
|
||||
}
|
||||
|
||||
size = size_sub(size, PAGE_SIZE);
|
||||
fault_ipa += PAGE_SIZE;
|
||||
fault_ipa += page_size;
|
||||
}
|
||||
end:
|
||||
read_unlock(&vcpu->kvm->mmu_lock);
|
||||
|
|
Loading…
Reference in New Issue
Block a user