Enable MMU and caching in VM API tests

VM API tests are failing on real hardware because VMs are not seeing
data written by the hypervisor. The reason for this is that Hafnium has
data caching enabled while the test VMs do not. Solve this discrepancy
by enabling data caching in the VMs too, which requires enabling stage-1
MMU translation.

The entire address space is identity-mapped with read-write-execute
permisssions. Only GIC tests currently require custom device mappings.

Implementation shares ptable management code from src/mm.c and
src/arch/mm.c.

Bug: 138985026
Test: ./kokoro/ubuntu/build.sh
Change-Id: Ib9f599c448d70296a6ca869ddbb51abfcc55148d
diff --git a/inc/hf/mm.h b/inc/hf/mm.h
index f7c4d9d..8b2fb8f 100644
--- a/inc/hf/mm.h
+++ b/inc/hf/mm.h
@@ -32,7 +32,6 @@
 #define PAGE_SIZE (1 << PAGE_BITS)
 #define MM_PTE_PER_PAGE (PAGE_SIZE / sizeof(pte_t))
 
-
 /* The following are arch-independent page mapping modes. */
 #define MM_MODE_R 0x0001 /* read */
 #define MM_MODE_W 0x0002 /* write */
@@ -71,6 +70,10 @@
 #define MM_MODE_UNOWNED 0x0020
 #define MM_MODE_SHARED  0x0040
 
+#define MM_FLAG_COMMIT  0x01
+#define MM_FLAG_UNMAP   0x02
+#define MM_FLAG_STAGE1  0x04
+
 /* clang-format on */
 
 struct mm_page_table {
@@ -86,6 +89,9 @@
 	paddr_t root;
 };
 
+/** The type of addresses stored in the page table. */
+typedef uintvaddr_t ptable_addr_t;
+
 /** Represents the currently locked stage-1 page table of the hypervisor. */
 struct mm_stage1_locked {
 	struct mm_ptable *ptable;
@@ -93,6 +99,9 @@
 
 void mm_vm_enable_invalidation(void);
 
+bool mm_ptable_init(struct mm_ptable *t, int flags, struct mpool *ppool);
+ptable_addr_t mm_ptable_addr_space_end(int flags);
+
 bool mm_vm_init(struct mm_ptable *t, struct mpool *ppool);
 void mm_vm_fini(struct mm_ptable *t, struct mpool *ppool);
 bool mm_vm_identity_map(struct mm_ptable *t, paddr_t begin, paddr_t end,