Implement SPCI_RX_RELEASE to replace hf_mailbox_clear.
Bug: 132421502
Change-Id: I63ffcce9b998ef98ff7ec3cdef41415a56a91b9f
diff --git a/inc/vmapi/hf/abi.h b/inc/vmapi/hf/abi.h
index bdb6705..434c7c9 100644
--- a/inc/vmapi/hf/abi.h
+++ b/inc/vmapi/hf/abi.h
@@ -26,17 +26,16 @@
#define HF_VM_GET_COUNT 0xff01
#define HF_VCPU_GET_COUNT 0xff02
#define HF_VM_CONFIGURE 0xff03
-#define HF_MAILBOX_CLEAR 0xff04
-#define HF_MAILBOX_WRITABLE_GET 0xff05
-#define HF_MAILBOX_WAITER_GET 0xff06
-#define HF_INTERRUPT_ENABLE 0xff07
-#define HF_INTERRUPT_GET 0xff08
-#define HF_INTERRUPT_INJECT 0xff09
-#define HF_SHARE_MEMORY 0xff0a
+#define HF_MAILBOX_WRITABLE_GET 0xff04
+#define HF_MAILBOX_WAITER_GET 0xff05
+#define HF_INTERRUPT_ENABLE 0xff06
+#define HF_INTERRUPT_GET 0xff07
+#define HF_INTERRUPT_INJECT 0xff08
+#define HF_SHARE_MEMORY 0xff09
/* Custom SPCI-like calls returned from SPCI_RUN. */
-#define HF_SPCI_RUN_WAIT_FOR_INTERRUPT 0xff0b
-#define HF_SPCI_RUN_WAKE_UP 0xff0c
+#define HF_SPCI_RUN_WAIT_FOR_INTERRUPT 0xff0a
+#define HF_SPCI_RUN_WAKE_UP 0xff0b
/* This matches what Trusty and its ATF module currently use. */
#define HF_DEBUG_LOG 0xbd000000
diff --git a/inc/vmapi/hf/call.h b/inc/vmapi/hf/call.h
index d446754..ad12122 100644
--- a/inc/vmapi/hf/call.h
+++ b/inc/vmapi/hf/call.h
@@ -161,18 +161,20 @@
}
/**
- * Clears the caller's mailbox so a new message can be received.
+ * Releases the caller's mailbox so that a new message can be received. The
+ * caller must have copied out all data they wish to preserve as new messages
+ * will overwrite the old and will arrive asynchronously.
*
* Returns:
- * - -1 on failure, if the mailbox hasn't been read.
- * - 0 on success if no further action is needed.
- * - 1 if it was called by the primary VM and the primary VM now needs to wake
- * up or kick waiters. Waiters should be retrieved by calling
+ * - SPCI_ERROR SPCI_DENIED on failure, if the mailbox hasn't been read.
+ * - SPCI_SUCCESS on success if no further action is needed.
+ * - SPCI_RX_RELEASE if it was called by the primary VM and the primary VM now
+ * needs to wake up or kick waiters. Waiters should be retrieved by calling
* hf_mailbox_waiter_get.
*/
-static inline int64_t hf_mailbox_clear(void)
+static inline struct spci_value spci_rx_release(void)
{
- return hf_call(HF_MAILBOX_CLEAR, 0, 0, 0);
+ return spci_call((struct spci_value){.func = SPCI_RX_RELEASE_32});
}
/**