PSA FF-A: map secondary VM memory/device regions in its stage-2 mapping

Add support for mapping secondary VM's memory/device regions in its
stage-2 translation along with unmapping it from primary VM as all the
regions are by default mapped in primary VM's translation regime.

As per PSA FF-A EAC spec, if memory-region does not have base-address
specified, the memory-region of given size is allocated inside the
partition's translation regime. This patch allocates memory-region at
the end of VM's memory. At the max half the VM's memory can be allocated
to memory regions.

When base-address is present this field specify a PA, VA (for S-EL0
partitions) or IPA (for S-EL1 and EL1 partitions). In both cases this
patch identity maps the region.

Change-Id: Id53e66d2109f05e76f8b8dbe85e64c84eabd5a5d
Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
diff --git a/inc/hf/addr.h b/inc/hf/addr.h
index efb1844..59e1b7a 100644
--- a/inc/hf/addr.h
+++ b/inc/hf/addr.h
@@ -55,6 +55,14 @@
 }
 
 /**
+ * Move backward physical address.
+ */
+static inline paddr_t pa_subtract(paddr_t pa, size_t n)
+{
+	return pa_init(pa_addr(pa) - n);
+}
+
+/**
  * Returns the difference between two physical addresses.
  */
 static inline size_t pa_difference(paddr_t start, paddr_t end)
diff --git a/inc/hf/manifest.h b/inc/hf/manifest.h
index 1299c5e..dc4b7c7 100644
--- a/inc/hf/manifest.h
+++ b/inc/hf/manifest.h
@@ -149,8 +149,10 @@
 	uint32_t stream_ep_ids[1];
 
 	/** Memory regions */
+	uint8_t mem_region_count;
 	struct memory_region mem_regions[SP_MAX_MEMORY_REGIONS];
 	/** Device regions */
+	uint8_t dev_region_count;
 	struct device_region dev_regions[SP_MAX_DEVICE_REGIONS];
 };