refactor(interrupts): remove ffa_interrupts_get function

As part of the Secure Interrupts refactoring we want to introduce
consistency across the SPMC and Hypervisor implementation therefore
use api_interrupt_get.

Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: I6d7e67efada0eff141551e78eed8e3c33e655d88
diff --git a/src/api.c b/src/api.c
index e09bfac..c9fac89 100644
--- a/src/api.c
+++ b/src/api.c
@@ -2329,35 +2329,7 @@
  */
 uint32_t api_interrupt_get(struct vcpu_locked current_locked)
 {
-	uint32_t i;
-	uint32_t first_interrupt = HF_INVALID_INTID;
-	struct interrupts *interrupts = &current_locked.vcpu->interrupts;
-
-	/*
-	 * Find the first enabled and pending interrupt ID, return it, and
-	 * deactivate it.
-	 */
-	for (i = 0; i < HF_NUM_INTIDS / INTERRUPT_REGISTER_BITS; ++i) {
-		uint32_t enabled_and_pending =
-			interrupts->interrupt_enabled.bitmap[i] &
-			interrupts->interrupt_pending.bitmap[i];
-
-		if (enabled_and_pending != 0) {
-			uint8_t bit_index = ctz(enabled_and_pending);
-
-			first_interrupt =
-				i * INTERRUPT_REGISTER_BITS + bit_index;
-
-			/*
-			 * Mark it as no longer pending and decrement the count.
-			 */
-			vcpu_interrupt_clear_decrement(current_locked,
-						       first_interrupt);
-			break;
-		}
-	}
-
-	return first_interrupt;
+	return vcpu_virt_interrupt_get_pending_and_enabled(current_locked);
 }
 
 /**
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index 85bd6a0..852d397 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -1069,7 +1069,7 @@
 		struct vcpu_locked current_locked;
 
 		current_locked = vcpu_lock(vcpu);
-		vcpu->regs.r[0] = ffa_interrupts_get(current_locked);
+		vcpu->regs.r[0] = api_interrupt_get(current_locked);
 		vcpu_unlock(&current_locked);
 		break;
 	}
diff --git a/src/arch/fake/hypervisor/ffa.c b/src/arch/fake/hypervisor/ffa.c
index 66cee73..567d73a 100644
--- a/src/arch/fake/hypervisor/ffa.c
+++ b/src/arch/fake/hypervisor/ffa.c
@@ -639,13 +639,6 @@
 	return true;
 }
 
-uint32_t ffa_interrupts_get(struct vcpu_locked current_locked)
-{
-	(void)current_locked;
-
-	return 0;
-}
-
 bool ffa_direct_msg_handle_framework_msg(struct ffa_value args,
 					 struct ffa_value *ret)
 {
diff --git a/src/ffa/absent.c b/src/ffa/absent.c
index 260b3b6..b80985d 100644
--- a/src/ffa/absent.c
+++ b/src/ffa/absent.c
@@ -576,11 +576,6 @@
 	(void)vm_locked;
 }
 
-uint32_t ffa_interrupts_get(struct vcpu_locked current_locked)
-{
-	return api_interrupt_get(current_locked);
-}
-
 bool ffa_direct_msg_handle_framework_msg(struct ffa_value args,
 					 struct ffa_value *ret)
 {
diff --git a/src/ffa/hypervisor/interrupts.c b/src/ffa/hypervisor/interrupts.c
index 8fde3e5..d056382 100644
--- a/src/ffa/hypervisor/interrupts.c
+++ b/src/ffa/hypervisor/interrupts.c
@@ -50,11 +50,6 @@
 	}
 }
 
-uint32_t ffa_interrupts_get(struct vcpu_locked current_locked)
-{
-	return api_interrupt_get(current_locked);
-}
-
 bool ffa_interrupts_intercept_call(struct vcpu_locked current_locked,
 				   struct vcpu_locked next_locked,
 				   struct ffa_value *signal_interrupt)
@@ -62,6 +57,5 @@
 	(void)current_locked;
 	(void)next_locked;
 	(void)signal_interrupt;
-
 	return false;
 }
diff --git a/src/ffa/spmc/interrupts.c b/src/ffa/spmc/interrupts.c
index 74bc5b8..ab9ad39 100644
--- a/src/ffa/spmc/interrupts.c
+++ b/src/ffa/spmc/interrupts.c
@@ -781,12 +781,6 @@
 	return ret;
 }
 
-/* Returns the virtual interrupt id to be handled by SP. */
-uint32_t ffa_interrupts_get(struct vcpu_locked current_locked)
-{
-	return vcpu_virt_interrupt_get_pending_and_enabled(current_locked);
-}
-
 /**
  * Run the vCPU in SPMC schedule mode under the runtime model for secure
  * interrupt handling.