Ensure that SPCI memory region constituents are aligned.
Misalignment was causing test failures on FVP.
Bug: 143755046
Change-Id: I0d55e43f9f07fb18d4b372f5625273f09def92e7
diff --git a/src/api.c b/src/api.c
index bdade61..caf024c 100644
--- a/src/api.c
+++ b/src/api.c
@@ -1493,6 +1493,15 @@
size_t size;
+ /*
+ * Make sure constituents are properly aligned to a 64-bit boundary. If
+ * not we would get alignment faults trying to read (64-bit) page
+ * addresses.
+ */
+ if (!is_aligned(constituents, 8)) {
+ return spci_error(SPCI_INVALID_PARAMETERS);
+ }
+
/* Disallow reflexive shares as this suggests an error in the VM. */
if (to == from) {
return spci_error(SPCI_INVALID_PARAMETERS);