[PATCH 5/6] virt: bao: Move BAO_IPCSHMEM_HYPERCALL_ID to common header
joaopeixoto at osyx.tech
joaopeixoto at osyx.tech
Wed Jan 7 08:28:28 PST 2026
From: João Peixoto <joaopeixoto at osyx.tech>
Move the IPC shared-memory hypercall ID from architecture-specific
headers into include/linux/bao.h.
Signed-off-by: João Peixoto <joaopeixoto at osyx.tech>
---
arch/arm/include/asm/bao.h | 5 ++---
arch/arm64/include/asm/bao.h | 5 ++---
arch/riscv/include/asm/bao.h | 7 +++----
drivers/virt/bao/ipcshmem/ipcshmem.c | 5 +----
include/linux/bao.h | 3 +++
5 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/arch/arm/include/asm/bao.h b/arch/arm/include/asm/bao.h
index 5ece9ecb1455..7d13591fe669 100644
--- a/arch/arm/include/asm/bao.h
+++ b/arch/arm/include/asm/bao.h
@@ -16,14 +16,13 @@
#include <linux/arm-smccc.h>
#include <linux/bao.h>
-static inline unsigned long bao_ipcshmem_hypercall(unsigned long hypercall_id,
- unsigned long ipcshmem_id)
+static inline unsigned long bao_ipcshmem_hypercall(unsigned long ipcshmem_id)
{
struct arm_smccc_res res;
arm_smccc_hvc(ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_32,
ARM_SMCCC_OWNER_VENDOR_HYP,
- hypercall_id),
+ BAO_IPCSHMEM_HYPERCALL_ID),
ipcshmem_id, 0, 0, 0, 0, 0, 0, &res);
return res.a0;
diff --git a/arch/arm64/include/asm/bao.h b/arch/arm64/include/asm/bao.h
index c7b7ec60c042..409f4058d56e 100644
--- a/arch/arm64/include/asm/bao.h
+++ b/arch/arm64/include/asm/bao.h
@@ -16,14 +16,13 @@
#include <linux/arm-smccc.h>
#include <linux/bao.h>
-static inline unsigned long bao_ipcshmem_hypercall(unsigned long hypercall_id,
- unsigned long ipcshmem_id)
+static inline unsigned long bao_ipcshmem_hypercall(unsigned long ipcshmem_id)
{
struct arm_smccc_res res;
arm_smccc_hvc(ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_64,
ARM_SMCCC_OWNER_VENDOR_HYP,
- hypercall_id),
+ BAO_IPCSHMEM_HYPERCALL_ID),
ipcshmem_id, 0, 0, 0, 0, 0, 0, &res);
return res.a0;
diff --git a/arch/riscv/include/asm/bao.h b/arch/riscv/include/asm/bao.h
index f04e6cd33fa9..d168aba7d8ec 100644
--- a/arch/riscv/include/asm/bao.h
+++ b/arch/riscv/include/asm/bao.h
@@ -18,13 +18,12 @@
#define BAO_SBI_EXT_ID 0x08000ba0
-static inline unsigned long bao_ipcshmem_hypercall(unsigned long hypercall_id,
- unsigned long ipcshmem_id)
+static inline unsigned long bao_ipcshmem_hypercall(unsigned long ipcshmem_id)
{
struct sbiret ret;
- ret = sbi_ecall(BAO_SBI_EXT_ID, hypercall_id, ipcshmem_id, 0, 0, 0, 0,
- 0);
+ ret = sbi_ecall(BAO_SBI_EXT_ID, BAO_IPCSHMEM_HYPERCALL_ID, ipcshmem_id,
+ 0, 0, 0, 0, 0);
return ret.error;
}
diff --git a/drivers/virt/bao/ipcshmem/ipcshmem.c b/drivers/virt/bao/ipcshmem/ipcshmem.c
index f3892d41248c..593e89cb76bd 100644
--- a/drivers/virt/bao/ipcshmem/ipcshmem.c
+++ b/drivers/virt/bao/ipcshmem/ipcshmem.c
@@ -14,9 +14,6 @@
#define BAO_IPCSHMEM_NAME_LEN 16
-/* IPC through shared-memory hypercall ID */
-#define BAO_IPCSHMEM_HYPERCALL_ID 0x1
-
struct bao_ipcshmem {
struct miscdevice miscdev;
int id;
@@ -90,7 +87,7 @@ static ssize_t bao_ipcshmem_write(struct file *filp, const char __user *buf,
*ppos += count;
/* Notify Bao hypervisor */
- bao_ipcshmem_hypercall(BAO_IPCSHMEM_HYPERCALL_ID, bao->id);
+ bao_ipcshmem_hypercall(bao->id);
return count;
}
diff --git a/include/linux/bao.h b/include/linux/bao.h
index 5b06d2a17d21..b29830374788 100644
--- a/include/linux/bao.h
+++ b/include/linux/bao.h
@@ -15,6 +15,9 @@
#include <linux/types.h>
+/* IPC through shared-memory hypercall ID */
+#define BAO_IPCSHMEM_HYPERCALL_ID 0x1
+
/* Remote I/O Hypercall ID */
#define BAO_REMIO_HYPERCALL_ID 0x2
--
2.43.0
More information about the linux-riscv
mailing list