FF-A: adjust partition info get VM/SP properties
Partition info get currently returns properties stating partitions
only support indirect messaging. This is not necessarily true for
Secure Partitions as of FF-A v1.0. Tune the partition info get
properties response such that indirect messaging is reported
as supported for NWd VMs and direct messaging for SWd SPs.
Change-Id: I1b839367d4d921b971f227dfca76f9b0e1ad7e5d
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/src/api.c b/src/api.c
index 1457d58..d131656 100644
--- a/src/api.c
+++ b/src/api.c
@@ -12,6 +12,7 @@
#include "hf/arch/mm.h"
#include "hf/arch/other_world.h"
#include "hf/arch/timer.h"
+#include "hf/arch/vm.h"
#include "hf/check.h"
#include "hf/dlog.h"
@@ -330,10 +331,8 @@
if (uuid_is_null || ffa_uuid_equal(uuid, &vm->uuid)) {
partitions[vm_count].vm_id = vm->id;
partitions[vm_count].vcpu_count = vm->vcpu_count;
-
- /* Hafnium only supports indirect messaging. */
partitions[vm_count].properties =
- FFA_PARTITION_INDIRECT_MSG;
+ arch_vm_partition_properties(vm->id);
++vm_count;
}
diff --git a/src/arch/aarch64/hypervisor/vm.c b/src/arch/aarch64/hypervisor/vm.c
index 5f7f4db..bd9c222 100644
--- a/src/arch/aarch64/hypervisor/vm.c
+++ b/src/arch/aarch64/hypervisor/vm.c
@@ -50,3 +50,24 @@
vm->arch.trapped_features |= HF_FEATURE_PAUTH;
}
}
+
+ffa_partition_properties_t arch_vm_partition_properties(ffa_vm_id_t id)
+{
+#if SECURE_WORLD == 0
+ /*
+ * VMs supports indirect messaging.
+ * PVM supports sending direct messages.
+ * Secondary VMs support receiving direct messages.
+ */
+ return FFA_PARTITION_INDIRECT_MSG | (id == HF_PRIMARY_VM_ID)
+ ? FFA_PARTITION_DIRECT_SEND
+ : FFA_PARTITION_DIRECT_RECV;
+#else
+ (void)id;
+
+ /*
+ * SPs only support receiving direct messages.
+ */
+ return FFA_PARTITION_DIRECT_RECV;
+#endif
+}
diff --git a/src/arch/fake/hypervisor/BUILD.gn b/src/arch/fake/hypervisor/BUILD.gn
index 159e303..97a82f6 100644
--- a/src/arch/fake/hypervisor/BUILD.gn
+++ b/src/arch/fake/hypervisor/BUILD.gn
@@ -7,6 +7,7 @@
source_set("hypervisor") {
sources = [
"cpu.c",
+ "vm.c",
]
deps = [
"//src/arch/fake:arch",
diff --git a/src/arch/fake/hypervisor/vm.c b/src/arch/fake/hypervisor/vm.c
new file mode 100644
index 0000000..48398ac
--- /dev/null
+++ b/src/arch/fake/hypervisor/vm.c
@@ -0,0 +1,16 @@
+/*
+ * Copyright 2020 The Hafnium Authors.
+ *
+ * Use of this source code is governed by a BSD-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/BSD-3-Clause.
+ */
+
+#include "hf/arch/vm.h"
+
+ffa_partition_properties_t arch_vm_partition_properties(ffa_vm_id_t id)
+{
+ (void)id;
+
+ return 0;
+}