feat: initialize page tables for enforcing dma isolation

SPMC maintains two sets of dedicated page tables for each partition
to enforce dma isolation.

Depending on the number of DMA devices assigned to a specific
partition, the corresponding set of page tables are initialized.

Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: I1f97876cc80de29cb938e62fbe695c29a8af104b
diff --git a/inc/hf/arch/vm.h b/inc/hf/arch/vm.h
index 7bc13a2..64e0783 100644
--- a/inc/hf/arch/vm.h
+++ b/inc/hf/arch/vm.h
@@ -15,6 +15,7 @@
  */
 void arch_vm_features_set(struct vm *vm);
 bool arch_vm_init_mm(struct vm *vm, struct mpool *ppool);
+bool arch_vm_iommu_init_mm(struct vm *vm, struct mpool *ppool);
 bool arch_vm_identity_prepare(struct vm_locked vm_locked, paddr_t begin,
 			      paddr_t end, uint32_t mode, struct mpool *ppool);
 void arch_vm_identity_commit(struct vm_locked vm_locked, paddr_t begin,
diff --git a/inc/hf/vm.h b/inc/hf/vm.h
index 47ca9d5..be8c011 100644
--- a/inc/hf/vm.h
+++ b/inc/hf/vm.h
@@ -13,6 +13,7 @@
 #include "hf/arch/vm/vm.h"
 
 #include "hf/cpu.h"
+#include "hf/ffa_partition_manifest.h"
 #include "hf/interrupt_desc.h"
 #include "hf/list.h"
 #include "hf/mm.h"
@@ -209,6 +210,14 @@
 	ffa_vcpu_count_t vcpu_count;
 	struct vcpu *vcpus;
 	struct mm_ptable ptable;
+
+	/**
+	 * Set of page tables used for defining the peripheral's secure
+	 * IPA space, in the context of SPMC.
+	 */
+	struct mm_ptable iommu_ptables[PARTITION_MAX_DMA_DEVICES];
+	/** Count of DMA devices assigned to this VM. */
+	uint8_t dma_device_count;
 	struct mailbox mailbox;
 
 	struct {
@@ -294,9 +303,11 @@
 };
 
 struct vm *vm_init(ffa_id_t id, ffa_vcpu_count_t vcpu_count,
-		   struct mpool *ppool, bool el0_partition);
+		   struct mpool *ppool, bool el0_partition,
+		   uint8_t dma_device_count);
 bool vm_init_next(ffa_vcpu_count_t vcpu_count, struct mpool *ppool,
-		  struct vm **new_vm, bool el0_partition);
+		  struct vm **new_vm, bool el0_partition,
+		  uint8_t dma_device_count);
 ffa_vm_count_t vm_get_count(void);
 struct vm *vm_find(ffa_id_t id);
 struct vm_locked vm_find_locked(ffa_id_t id);