[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231215-gunyah-v15-6-192a5d872a30@quicinc.com>
Date: Fri, 15 Dec 2023 16:20:47 -0800
From: Elliot Berman <quic_eberman@...cinc.com>
To: Alex Elder <elder@...aro.org>,
Srinivas Kandagatla
<srinivas.kandagatla@...aro.org>,
Murali Nalajal <quic_mnalajal@...cinc.com>,
Trilok Soni <quic_tsoni@...cinc.com>,
Srivatsa Vaddagiri
<quic_svaddagi@...cinc.com>,
Carl van Schaik <quic_cvanscha@...cinc.com>,
Philip Derrin <quic_pderrin@...cinc.com>,
Prakruthi Deepak Heragu
<quic_pheragu@...cinc.com>,
Jonathan Corbet <corbet@....net>, Rob Herring
<robh+dt@...nel.org>,
Krzysztof Kozlowski
<krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Bjorn Andersson
<andersson@...nel.org>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
"Fuad
Tabba" <tabba@...gle.com>,
Sean Christopherson <seanjc@...gle.com>
CC: <linux-arm-msm@...r.kernel.org>, <linux-doc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
Elliot Berman
<quic_eberman@...cinc.com>
Subject: [PATCH RFC v15 06/30] virt: gunyah: msgq: Add hypercalls to send
and receive messages
Add hypercalls to send and receive messages on a Gunyah message queue.
Reviewed-by: Alex Elder <elder@...aro.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Signed-off-by: Elliot Berman <quic_eberman@...cinc.com>
---
arch/arm64/gunyah/gunyah_hypercall.c | 34 ++++++++++++++++++++++++++++++++++
include/linux/gunyah.h | 7 +++++++
2 files changed, 41 insertions(+)
diff --git a/arch/arm64/gunyah/gunyah_hypercall.c b/arch/arm64/gunyah/gunyah_hypercall.c
index 739d7f9cef9f..cadc512934c4 100644
--- a/arch/arm64/gunyah/gunyah_hypercall.c
+++ b/arch/arm64/gunyah/gunyah_hypercall.c
@@ -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_MSGQ_SEND GUNYAH_HYPERCALL(0x801B)
+#define GUNYAH_HYPERCALL_MSGQ_RECV GUNYAH_HYPERCALL(0x801C)
/* clang-format on */
/**
@@ -58,5 +60,37 @@ void gunyah_hypercall_hyp_identify(
}
EXPORT_SYMBOL_GPL(gunyah_hypercall_hyp_identify);
+enum gunyah_error gunyah_hypercall_msgq_send(u64 capid, size_t size, void *buff,
+ u64 tx_flags, bool *ready)
+{
+ struct arm_smccc_res res;
+
+ arm_smccc_1_1_hvc(GUNYAH_HYPERCALL_MSGQ_SEND, capid, size,
+ (uintptr_t)buff, tx_flags, 0, &res);
+
+ if (res.a0 == GUNYAH_ERROR_OK)
+ *ready = !!res.a1;
+
+ return res.a0;
+}
+EXPORT_SYMBOL_GPL(gunyah_hypercall_msgq_send);
+
+enum gunyah_error gunyah_hypercall_msgq_recv(u64 capid, void *buff, size_t size,
+ size_t *recv_size, bool *ready)
+{
+ struct arm_smccc_res res;
+
+ arm_smccc_1_1_hvc(GUNYAH_HYPERCALL_MSGQ_RECV, capid, (uintptr_t)buff,
+ size, 0, &res);
+
+ if (res.a0 == GUNYAH_ERROR_OK) {
+ *recv_size = res.a1;
+ *ready = !!res.a2;
+ }
+
+ return res.a0;
+}
+EXPORT_SYMBOL_GPL(gunyah_hypercall_msgq_recv);
+
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Gunyah Hypervisor Hypercalls");
diff --git a/include/linux/gunyah.h b/include/linux/gunyah.h
index 8cdeaba34aa9..ea2c9eecce0e 100644
--- a/include/linux/gunyah.h
+++ b/include/linux/gunyah.h
@@ -141,4 +141,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);
+#define GUNYAH_HYPERCALL_MSGQ_TX_FLAGS_PUSH BIT(0)
+
+enum gunyah_error gunyah_hypercall_msgq_send(u64 capid, size_t size, void *buff,
+ u64 tx_flags, bool *ready);
+enum gunyah_error gunyah_hypercall_msgq_recv(u64 capid, void *buff, size_t size,
+ size_t *recv_size, bool *ready);
+
#endif
--
2.43.0
Powered by blists - more mailing lists