fix(manifest): check mem regions are page aligned

Memory regions are required to be page aligned however this wasn't
being checked during manifest parsing. This patch adds that check
as well as an additional test to make sure unaligned memory regions
are caught.

Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
Change-Id: Ifa64bd4dbe8cc28064d30ffc4ec43fb9e38a8bb7
diff --git a/src/manifest_test.cc b/src/manifest_test.cc
index e5d03d6..a44da46 100644
--- a/src/manifest_test.cc
+++ b/src/manifest_test.cc
@@ -1225,32 +1225,6 @@
 			.Label("rx")
 			.StartChild("rx")
 				.Description("rx-buffer")
-				.Property("base-address", "<0x7300000>")
-				.Property("pages-count", "<2>")
-				.Property("attributes", "<1>")
-			.EndChild()
-			.Label("tx")
-			.StartChild("tx")
-				.Description("tx-buffer")
-				.Property("base-address", "<0x7301FFF>")
-				.Property("pages-count", "<2>")
-				.Property("attributes", "<3>")
-			.EndChild()
-		.EndChild()
-		.Build();
-	/* clang-format on */
-	ASSERT_EQ(ffa_manifest_from_vec(&m, dtb),
-		  MANIFEST_ERROR_MEM_REGION_OVERLAP);
-	manifest_dealloc();
-
-	/* clang-format off */
-	dtb = ManifestDtBuilder()
-		.FfaValidManifest()
-		.StartChild("memory-regions")
-			.Compatible({ "arm,ffa-manifest-memory-regions" })
-			.Label("rx")
-			.StartChild("rx")
-				.Description("rx-buffer")
 				.Property("base-address", "<0x7301000>")
 				.Property("pages-count", "<1>")
 				.Property("attributes", "<1>")
@@ -1267,6 +1241,34 @@
 	/* clang-format on */
 	ASSERT_EQ(ffa_manifest_from_vec(&m, dtb),
 		  MANIFEST_ERROR_MEM_REGION_OVERLAP);
+	manifest_dealloc();
+
+	/* Unaligned memory region */
+	/* clang-format off */
+	dtb = ManifestDtBuilder()
+		.FfaValidManifest()
+		.StartChild("memory-regions")
+			.Compatible({ "arm,ffa-manifest-memory-regions" })
+			.Label("rx")
+			.StartChild("rx")
+				.Description("rx-buffer")
+				.Property("base-address", "<0x7300FFF>")
+				.Property("pages-count", "<2>")
+				.Property("attributes", "<1>")
+			.EndChild()
+			.Label("tx")
+			.StartChild("tx")
+				.Description("tx-buffer")
+				.Property("base-address", "<0x7303000>")
+				.Property("pages-count", "<2>")
+				.Property("attributes", "<3>")
+			.EndChild()
+		.EndChild()
+		.Build();
+	/* clang-format on */
+	ASSERT_EQ(ffa_manifest_from_vec(&m, dtb),
+		  MANIFEST_ERROR_MEM_REGION_UNALIGNED);
+	manifest_dealloc();
 
 	/* Different RXTX buffer sizes */
 	/* clang-format off */