VHE: Fix mm defrag to account for el0 partition's.
This patch adds helper APIs to defrag a partition's page tables that
works on both EL0 partitions and for VMs. Also updated all code using
the mm_vm_defrag API directly to use the newly added vm_ptable_defrag so
that defrag works for EL0 partitions as well.
Change-Id: I93d0d9a2b93e791836561aa813f20a9a65017243
Signed-off-by: Raghu Krishnamurthy <raghu.ncstate@gmail.com>
diff --git a/src/vm.c b/src/vm.c
index a1568c0..f7fb390 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -330,6 +330,18 @@
}
/**
+ * Defrag page tables for an EL0 partition or for a VM.
+ */
+void vm_ptable_defrag(struct vm_locked vm_locked, struct mpool *ppool)
+{
+ if (vm_locked.vm->el0_partition) {
+ mm_stage1_defrag(&vm_locked.vm->ptable, ppool);
+ } else {
+ mm_vm_defrag(&vm_locked.vm->ptable, ppool);
+ }
+}
+
+/**
* Unmaps the hypervisor pages from the given page table.
*/
bool vm_unmap_hypervisor(struct vm_locked vm_locked, struct mpool *ppool)