feat(interrupts): prioritize servicing queued virtual interrupts

Upon invocation of HF_INTERRUPT_GET by partition, SPMC shall return a
virtual interrupt from the vcpu's queue. If the queue is empty, it
shall return the numerically lowest pending interrupt from the
interrupt bitmap.

Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: Icee8a23349c7755e8620c5c97d0e8e81a5b9192a
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index 62d8200..e79330e 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -1114,10 +1114,14 @@
 						       args.arg3, vcpu);
 		break;
 
-	case HF_INTERRUPT_GET:
-		vcpu->regs.r[0] = api_interrupt_get(vcpu);
-		break;
+	case HF_INTERRUPT_GET: {
+		struct vcpu_locked current_locked;
 
+		current_locked = vcpu_lock(vcpu);
+		vcpu->regs.r[0] = plat_ffa_interrupt_get(current_locked);
+		vcpu_unlock(&current_locked);
+		break;
+	}
 	default:
 		vcpu->regs.r[0] = SMCCC_ERROR_UNKNOWN;
 		dlog_verbose("Unsupported function %#lx\n", args.func);