feat: reclaim all resources from an aborted SP
Once any execution context of an SP is aborted, all the resources of
the SP are reclaimed by SPMC. This patch creates a placeholder
function to this effect which can be populated with necessary actions
such as disabling all interrupts belonging to the SP.
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: Ia4c2913ad0aeda21770052ca748d41734cafd8b4
diff --git a/src/api.c b/src/api.c
index 210c604..843b8dc 100644
--- a/src/api.c
+++ b/src/api.c
@@ -385,6 +385,7 @@
struct ffa_value ret = ffa_error(FFA_ABORTED);
struct vcpu_locked current_locked;
struct vcpu *next;
+ struct vm_locked vm_locked;
dlog_notice("Aborting VM %#x vCPU %u\n", current->vm->id,
vcpu_index(current));
@@ -399,7 +400,9 @@
atomic_store_explicit(¤t->vm->aborting, true,
memory_order_relaxed);
- /* TODO: free resources once all vCPUs abort. */
+ vm_locked = vm_lock(current->vm);
+ plat_ffa_free_vm_resources(vm_locked);
+ vm_unlock(&vm_locked);
current_locked = vcpu_lock(current);
next = api_switch_to_primary(current_locked, ret, VCPU_STATE_ABORTED);