[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230120224627.4053418-26-quic_eberman@quicinc.com>
Date: Fri, 20 Jan 2023 14:46:24 -0800
From: Elliot Berman <quic_eberman@...cinc.com>
To: Bjorn Andersson <quic_bjorande@...cinc.com>,
Alex Elder <elder@...aro.org>,
Elliot Berman <quic_eberman@...cinc.com>,
Murali Nalajala <quic_mnalajal@...cinc.com>,
Catalin Marinas <catalin.marinas@....com>,
"Will Deacon" <will@...nel.org>
CC: Trilok Soni <quic_tsoni@...cinc.com>,
Srivatsa Vaddagiri <quic_svaddagi@...cinc.com>,
Carl van Schaik <quic_cvanscha@...cinc.com>,
Prakruthi Deepak Heragu <quic_pheragu@...cinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Arnd Bergmann <arnd@...db.de>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Jonathan Corbet <corbet@....net>,
Bagas Sanjaya <bagasdotme@...il.com>,
Marc Zyngier <maz@...nel.org>,
Jassi Brar <jassisinghbrar@...il.com>,
Sudeep Holla <sudeep.holla@....com>,
<linux-arm-msm@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-doc@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>
Subject: [PATCH v9 25/27] virt: gunyah: Add hypercalls for sending doorbell
Gunyah doorbells allow two virtual machines to signal each other using
interrupts. Add the hypercalls needed to assert the interrupt.
Signed-off-by: Elliot Berman <quic_eberman@...cinc.com>
---
arch/arm64/gunyah/gunyah_hypercall.c | 39 ++++++++++++++++++----------
include/linux/gunyah.h | 3 +++
2 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/arch/arm64/gunyah/gunyah_hypercall.c b/arch/arm64/gunyah/gunyah_hypercall.c
index 17d87a130a3e..057e127f2b4d 100644
--- a/arch/arm64/gunyah/gunyah_hypercall.c
+++ b/arch/arm64/gunyah/gunyah_hypercall.c
@@ -12,19 +12,7 @@ static const uint32_t gunyah_known_uuids[][4] = {
{0x673d5f14, 0x9265ce36, 0xa4535fdb, 0xc1d58fcd}, /* GUNYAH (open source build) */
};
-#define GH_HYPERCALL_HYP_IDENTIFY GH_HYPERCALL(0x0000)
-#define GH_HYPERCALL_MSGQ_SEND GH_HYPERCALL(0x001B)
-#define GH_HYPERCALL_MSGQ_RECV GH_HYPERCALL(0x001C)
-#define GH_HYPERCALL_VCPU_RUN GH_HYPERCALL(0x0065)
-
-/**
- * gh_hypercall_get_uid() - Returns a UID when running under a Gunyah hypervisor
- * @uid: An array of 4 u32's (u32 uid[4];)
- *
- * Caller should compare the resulting UID to a list of known Gunyah UIDs to
- * confirm that Linux is running as a guest of Gunyah.
- */
-void gh_hypercall_get_uid(u32 uid[4])
+bool arch_is_gunyah_guest(void)
{
struct arm_smccc_res res;
u32 uid[4];
@@ -74,6 +62,31 @@ void gh_hypercall_hyp_identify(struct gh_hypercall_hyp_identify_resp *hyp_identi
}
EXPORT_SYMBOL_GPL(gh_hypercall_hyp_identify);
+int gh_hypercall_dbl_send(u64 capid, u64 new_flags, u64 *old_flags)
+{
+ struct arm_smccc_res res;
+
+ arm_smccc_1_1_hvc(GH_HYPERCALL_DBL_SEND, capid, new_flags, 0, &res);
+
+ if (res.a0)
+ return res.a0;
+
+ *old_flags = res.a1;
+
+ return res.a0;
+}
+EXPORT_SYMBOL_GPL(gh_hypercall_dbl_send);
+
+int gh_hypercall_dbl_set_mask(u64 capid, u64 enable_mask, u64 ack_mask)
+{
+ struct arm_smccc_res res;
+
+ arm_smccc_1_1_hvc(GH_HYPERCALL_DBL_SET_MASK, capid, enable_mask, ack_mask, 0, &res);
+
+ return res.a0;
+}
+EXPORT_SYMBOL_GPL(gh_hypercall_dbl_set_mask);
+
int gh_hypercall_msgq_send(u64 capid, size_t size, uintptr_t buff, int tx_flags, bool *ready)
{
struct arm_smccc_res res;
diff --git a/include/linux/gunyah.h b/include/linux/gunyah.h
index feeab01bff30..ac4879940c10 100644
--- a/include/linux/gunyah.h
+++ b/include/linux/gunyah.h
@@ -164,6 +164,9 @@ struct gh_hypercall_hyp_identify_resp {
void gh_hypercall_hyp_identify(struct gh_hypercall_hyp_identify_resp *hyp_identity);
+int gh_hypercall_dbl_send(u64 capid, u64 new_flags, u64 *old_flags);
+int gh_hypercall_dbl_set_mask(u64 capid, u64 enable_mask, u64 ack_mask);
+
#define GH_HYPERCALL_MSGQ_TX_FLAGS_PUSH BIT(0)
int gh_hypercall_msgq_send(u64 capid, size_t size, uintptr_t buff, int tx_flags, bool *ready);
--
2.39.0
Powered by blists - more mailing lists