Cactus: implement hvc call to enable an interrupt

INTERRUPT_ENABLE hvc call can be used by SP to let SPMC(S-EL2) know
about its capability to handle a particular interrupt.

All interrupt specific hvc calls have "interrupt_type" as an argument
to distinguish between IRQ/FIQ. This patch also introduces enum for
interrupt types and modifies spm_interrupt_get() accordingly.

Change-Id: I65e42645330be0787449be850579e1a9fa35127b
Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/spm/common/spm_helpers.c b/spm/common/spm_helpers.c
index 823f9f6..2ccf3f7 100644
--- a/spm/common/spm_helpers.c
+++ b/spm/common/spm_helpers.c
@@ -30,3 +30,22 @@
 
 	(void)tftf_hvc(&args);
 }
+
+/**
+ * Hypervisor call to enable/disable SP delivery of a virtual interrupt of
+ * int_id value through the IRQ or FIQ vector (pin).
+ * Returns 0 on success, or -1 if passing an invalid interrupt id.
+ */
+int64_t spm_interrupt_enable(uint32_t int_id, bool enable, enum interrupt_pin pin)
+{
+	hvc_args args = {
+		.fid = SPM_INTERRUPT_ENABLE,
+		.arg1 = int_id,
+		.arg2 = enable,
+		.arg3 = pin
+	};
+
+	hvc_ret_values ret = tftf_hvc(&args);
+
+	return (int64_t)ret.ret0;
+}
diff --git a/spm/common/spm_helpers.h b/spm/common/spm_helpers.h
index f241e42..10f7316 100644
--- a/spm/common/spm_helpers.h
+++ b/spm/common/spm_helpers.h
@@ -8,8 +8,10 @@
 #define SPMC_H
 
 #include <ffa_helpers.h>
+#include <spm_common.h>
 
 /* Should match with IDs defined in SPM/Hafnium */
+#define SPM_INTERRUPT_ENABLE            (0xFF03)
 #define SPM_INTERRUPT_GET               (0xFF04)
 #define SPM_DEBUG_LOG                   (0xBD000000)
 
@@ -18,6 +20,7 @@
  */
 
 uint32_t spm_interrupt_get(void);
+int64_t spm_interrupt_enable(uint32_t int_id, bool enable, enum interrupt_pin pin);
 void spm_debug_log(char c);
 
 #endif /* SPMC_H */