test: exercise secure espi interrupt handling
Hafnium/SPMC added support for enabling interrupts in the extended SPI
range. With the help of an SiP SMC call that can pend an interrupt,
this patch adds a test to trigger an espi interrupt when cactus is
running and ensure it is handled.
Additionally, a dummy device region node representing a fake
peripheral has been added to the Cactus SP manifest. It is used to
specify properties of the interrupt in the extended SPI range used
for the above test scenario.
Signed-off-by: Raghu Krishnamurthy <raghu.ncstate@gmail.com>
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: Ief932c40e3abd33d619f2b144e61cae449147b27
diff --git a/include/runtime_services/cactus_test_cmds.h b/include/runtime_services/cactus_test_cmds.h
index 9dc0d90..6398138 100644
--- a/include/runtime_services/cactus_test_cmds.h
+++ b/include/runtime_services/cactus_test_cmds.h
@@ -614,4 +614,23 @@
return cactus_send_cmd(source, dest, CACTUS_RESUME_AFTER_MANAGED_EXIT,
0, 0, 0, 0);
}
+
+/**
+ * Request SP to pend an interrupt in the extended SPI range.
+ *
+ * The command is the hex representation of the string "espi".
+ */
+#define CACTUS_TRIGGER_ESPI_CMD U(0x65737069)
+static inline struct ffa_value cactus_trigger_espi_cmd(
+ ffa_id_t source, ffa_id_t dest, uint32_t espi_id)
+{
+ return cactus_send_cmd(source, dest, CACTUS_TRIGGER_ESPI_CMD,
+ espi_id, 0, 0, 0);
+}
+
+static inline uint32_t cactus_get_espi_id(struct ffa_value ret)
+{
+ return (uint32_t)ret.arg4;
+}
+
#endif
diff --git a/include/runtime_services/spm_common.h b/include/runtime_services/spm_common.h
index 9e7f1e6..48471bc 100644
--- a/include/runtime_services/spm_common.h
+++ b/include/runtime_services/spm_common.h
@@ -30,6 +30,9 @@
/* INTID for the notification pending interrupt. */
#define NOTIFICATION_PENDING_INTERRUPT_INTID 5
+/* Interrupt used for testing extended SPI handling. */
+#define IRQ_ESPI_TEST_INTID 5000
+
/** IRQ/FIQ pin used for signaling a virtual interrupt. */
enum interrupt_pin {
INTERRUPT_TYPE_IRQ,