FROMLIST: virt: gunyah: Add hypercalls for sending doorbell

Gunyah doorbells allow a virtual machine to signal another using
interrupts. Add the hypercalls needed to assert the interrupt.

Bug: 338347082
Link: https://lore.kernel.org/all/20240222-gunyah-v17-31-1e9da6763d38@quicinc.com/
Change-Id: I6e233b448daf2458fc38a659c56b31159dc9c0aa
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
Signed-off-by: Elliot Berman <elliot.berman@oss.qualcomm.com>
This commit is contained in:
Elliot Berman
2024-02-22 15:16:54 -08:00
committed by Treehugger Robot
parent f561ba5b22
commit 35eb2b9248
2 changed files with 43 additions and 0 deletions
+38
View File
@@ -37,6 +37,8 @@ EXPORT_SYMBOL_GPL(arch_is_gunyah_guest);
/* clang-format off */
#define GUNYAH_HYPERCALL_HYP_IDENTIFY GUNYAH_HYPERCALL(0x8000)
#define GUNYAH_HYPERCALL_BELL_SEND GUNYAH_HYPERCALL(0x8012)
#define GUNYAH_HYPERCALL_BELL_SET_MASK GUNYAH_HYPERCALL(0x8015)
#define GUNYAH_HYPERCALL_MSGQ_SEND GUNYAH_HYPERCALL(0x801B)
#define GUNYAH_HYPERCALL_MSGQ_RECV GUNYAH_HYPERCALL(0x801C)
#define GUNYAH_HYPERCALL_ADDRSPACE_MAP GUNYAH_HYPERCALL(0x802B)
@@ -64,6 +66,42 @@ void gunyah_hypercall_hyp_identify(
}
EXPORT_SYMBOL_GPL(gunyah_hypercall_hyp_identify);
/**
* gunyah_hypercall_bell_send() - Assert a gunyah doorbell
* @capid: capability ID of the doorbell
* @new_flags: bits to set on the doorbell
* @old_flags: Filled with the bits set before the send call if return value is GUNYAH_ERROR_OK
*/
enum gunyah_error gunyah_hypercall_bell_send(u64 capid, u64 new_flags, u64 *old_flags)
{
struct arm_smccc_res res;
arm_smccc_1_1_hvc(GUNYAH_HYPERCALL_BELL_SEND, capid, new_flags, 0, &res);
if (res.a0 == GUNYAH_ERROR_OK && old_flags)
*old_flags = res.a1;
return res.a0;
}
EXPORT_SYMBOL_GPL(gunyah_hypercall_bell_send);
/**
* gunyah_hypercall_bell_set_mask() - Set masks on a Gunyah doorbell
* @capid: capability ID of the doorbell
* @enable_mask: which bits trigger the receiver interrupt
* @ack_mask: which bits are automatically acknowledged when the receiver
* interrupt is ack'd
*/
enum gunyah_error gunyah_hypercall_bell_set_mask(u64 capid, u64 enable_mask, u64 ack_mask)
{
struct arm_smccc_res res;
arm_smccc_1_1_hvc(GUNYAH_HYPERCALL_BELL_SET_MASK, capid, enable_mask, ack_mask, 0, &res);
return res.a0;
}
EXPORT_SYMBOL_GPL(gunyah_hypercall_bell_set_mask);
/**
* gunyah_hypercall_msgq_send() - Send a buffer on a message queue
* @capid: capability ID of the message queue to add message
+5
View File
@@ -359,6 +359,11 @@ gunyah_api_version(const struct gunyah_hypercall_hyp_identify_resp *gunyah_api)
void gunyah_hypercall_hyp_identify(
struct gunyah_hypercall_hyp_identify_resp *hyp_identity);
enum gunyah_error gunyah_hypercall_bell_send(u64 capid, u64 new_flags,
u64 *old_flags);
enum gunyah_error gunyah_hypercall_bell_set_mask(u64 capid, u64 enable_mask,
u64 ack_mask);
/* Immediately raise RX vIRQ on receiver VM */
#define GUNYAH_HYPERCALL_MSGQ_TX_FLAGS_PUSH BIT(0)