Re: [RFC PATCH v3 4/6] virt: bao: add I/O dispatcher driver
Will Deacon <[email protected]>
| Newsgroups | org.kernel.vger.linux-doc,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-riscv,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <anrrf0J9C9zSrAgF@willie-the-truck> |
On Fri, Aug 07, 2026 at 08:39:31AM +0100, João Peixoto wrote: > Add the Bao I/O dispatcher, used by backend VMs to service I/O on behalf > of frontend guests. It bridges Bao's Remote I/O mechanism to userspace > VirtIO backend device models. > > Each backend device has a contiguous shared-memory region for exchanging > I/O buffers with its frontend and an interrupt the hypervisor uses to > signal pending requests. Userspace drives the dispatcher through a set of > ioctls on a misc character device. > > Co-developed-by: José Martins <[email protected]> > Signed-off-by: José Martins <[email protected]> > Co-developed-by: David Cerdeira <[email protected]> > Signed-off-by: David Cerdeira <[email protected]> > Signed-off-by: João Peixoto <[email protected]> > --- > diff --git a/arch/arm64/include/asm/bao.h b/arch/arm64/include/asm/bao.h > index ab9b283168e3..1dc09a2c261b 100644 > --- a/arch/arm64/include/asm/bao.h > +++ b/arch/arm64/include/asm/bao.h > @@ -14,6 +14,7 @@ > #define __ASM_ARM64_BAO_H > > #include <linux/arm-smccc.h> > +#include <linux/bao.h> > > static inline unsigned long bao_ipcshmem_hypercall(unsigned long hypercall_id, > unsigned long ipcshmem_id) > @@ -28,4 +29,33 @@ static inline unsigned long bao_ipcshmem_hypercall(unsigned long hypercall_id, > return res.a0; > } > > +static inline unsigned long > +bao_remio_hypercall(struct bao_remio_hypercall_ctx *ctx) > +{ > + register int x0 asm("x0") = > + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_64, > + ARM_SMCCC_OWNER_VENDOR_HYP, BAO_REMIO_HYPERCALL_ID); > + register u64 x1 asm("x1") = ctx->dm_id; > + register u64 x2 asm("x2") = ctx->addr; > + register u64 x3 asm("x3") = ctx->op; > + register u64 x4 asm("x4") = ctx->value; > + register u64 x5 asm("x5") = ctx->request_id; > + register u64 x6 asm("x6") = 0; > + > + asm volatile("hvc 0\n\t" > + : "=r"(x0), "=r"(x1), "=r"(x2), "=r"(x3), "=r"(x4), > + "=r"(x5), "=r"(x6) > + : "r"(x0), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5) > + : "memory"); > + > + ctx->addr = x1; > + ctx->op = x2; > + ctx->value = x3; > + ctx->access_width = x4; > + ctx->request_id = x5; > + ctx->npend_req = x6; > + > + return x0; > +} Why aren't you using SMCCC for this? You should be able to use that (like you did for bao_ipcshmem_hypercall()) and then there would be no need to add any code to arch/arm64/. Will