feat: parse `vm-availability-messages`

Parse the `vm-availability-messages` field in manifests.

* Parse the `vm-availability-messages` field in partition manifests (see
  section 18.3.3 of FF-A 1.2 spec and [1]).
* This is necessary because the SPMC must only forward VM created/VM
  destroyed messages to SPs that have subscribed to them.
* Add tests for parsing the `vm-availability-messages` field, both
  succesfully and unsuccessfully (if bits [31:2] are not zero).

[1] https://trustedfirmware-a.readthedocs.io/en/latest/components/ffa-manifest-binding.html

Change-Id: I88b9545bfdef26e888a599726ead83d051ec2311
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/src/manifest.c b/src/manifest.c
index 9de1935..5fb4632 100644
--- a/src/manifest.c
+++ b/src/manifest.c
@@ -1391,6 +1391,16 @@
 	}
 
 	TRY(read_optional_uint32(
+		&root, "vm-availability-messages", 0,
+		(uint32_t *)&vm->partition.vm_availability_messages));
+	dlog_verbose("vm-availability-messages=%#x\n",
+		     *(uint32_t *)&vm->partition.vm_availability_messages);
+
+	if (vm->partition.vm_availability_messages.mbz != 0) {
+		return MANIFEST_ERROR_VM_AVAILABILITY_MESSAGE_INVALID;
+	}
+
+	TRY(read_optional_uint32(
 		&root, "power-management-messages",
 		MANIFEST_POWER_MANAGEMENT_CPU_OFF_SUPPORTED |
 			MANIFEST_POWER_MANAGEMENT_CPU_ON_SUPPORTED,
@@ -1754,6 +1764,9 @@
 	case MANIFEST_ERROR_DMA_DEVICE_OVERFLOW:
 		return "Number of device regions with DMA peripheral exceeds "
 		       "limit.";
+	case MANIFEST_ERROR_VM_AVAILABILITY_MESSAGE_INVALID:
+		return "VM availability messages invalid (bits [31:2] must be "
+		       "zero)";
 	}
 
 	panic("Unexpected manifest return code.");