Distinguish device and normal memory.
The large address space mapped to the primary is marked as device
memory. The normal memory is then specifically marked based on the
`memory` nodes in the manifest.
Sharing is restricted to normal memory as sharing device memory is
dangerous without full device reassignment.
Change-Id: I117d621342bae89a35cde33e3a6e59e56add9a5c
diff --git a/src/spci_architected_message.c b/src/spci_architected_message.c
index 5628a76..28d5fc7 100644
--- a/src/spci_architected_message.c
+++ b/src/spci_architected_message.c
@@ -314,15 +314,17 @@
return false;
}
- /*
- * Ensure that the memory range is mapped with the same
- * mode.
- */
+ /* Ensure that the memory range is mapped with the same mode. */
if (!mm_vm_get_mode(&from->ptable, begin, end, orig_from_mode) ||
!mm_vm_get_mode(&to->ptable, begin, end, &orig_to_mode)) {
return false;
}
+ /* Ensure the address range is normal memory and not a device. */
+ if (*orig_from_mode & MM_MODE_D) {
+ return false;
+ }
+
switch (share) {
case SPCI_MEMORY_DONATE:
mem_transition_table = donate_transitions;