[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4rrof4lk2zxut63u7qwxlmygpslvq5owfraatbjq3sbybtac4u@2prxnxijartx>
Date: Wed, 14 Jan 2026 14:32:38 -0600
From: Andrew Jones <andrew.jones@....qualcomm.com>
To: joaopeixoto@...x.tech
Cc: linux-kernel@...r.kernel.org, ajd@...ux.ibm.com, alex@...ti.fr,
aou@...s.berkeley.edu, bagasdotme@...il.com, catalin.marinas@....com,
conor+dt@...nel.org, corbet@....net, dan.j.williams@...el.com,
davidmcerdeira@...x.tech, devicetree@...r.kernel.org, dev@...l-k.io,
gregkh@...uxfoundation.org, haren@...ux.ibm.com, heiko@...ech.de,
jose@...x.tech, kever.yang@...k-chips.com, krzk+dt@...nel.org,
linux-arm-kernel@...ts.infradead.org, linux-doc@...r.kernel.org,
linux-riscv@...ts.infradead.org, maddy@...ux.ibm.com, mani@...nel.org,
nathan@...nel.org, neil.armstrong@...aro.org, palmer@...belt.com,
pjw@...nel.org, prabhakar.mahadev-lad.rj@...renesas.com,
robh@...nel.org, will@...nel.org
Subject: Re: [PATCH 4/6] virt: bao: Add Bao I/O dispatcher driver
On Wed, Jan 07, 2026 at 04:28:27PM +0000, joaopeixoto@...x.tech wrote:
...
> diff --git a/arch/riscv/include/asm/bao.h b/arch/riscv/include/asm/bao.h
> index 35658f37e1bd..f04e6cd33fa9 100644
> --- a/arch/riscv/include/asm/bao.h
> +++ b/arch/riscv/include/asm/bao.h
> @@ -14,6 +14,7 @@
> #define __ASM_RISCV_BAO_H
>
> #include <asm/sbi.h>
> +#include <linux/bao.h>
>
> #define BAO_SBI_EXT_ID 0x08000ba0
>
> @@ -28,4 +29,33 @@ static inline unsigned long bao_ipcshmem_hypercall(unsigned long hypercall_id,
> return ret.error;
> }
>
> +static inline unsigned long
> +bao_remio_hypercall(struct bao_remio_hypercall_ctx *ctx)
> +{
> + register uintptr_t a0 asm("a0") = (uintptr_t)(ctx->dm_id);
> + register uintptr_t a1 asm("a1") = (uintptr_t)(ctx->addr);
> + register uintptr_t a2 asm("a2") = (uintptr_t)(ctx->op);
> + register uintptr_t a3 asm("a3") = (uintptr_t)(ctx->value);
> + register uintptr_t a4 asm("a4") = (uintptr_t)(ctx->request_id);
> + register uintptr_t a5 asm("a5") = (uintptr_t)(0);
> + register uintptr_t a6 asm("a6") = (uintptr_t)(BAO_REMIO_HYPERCALL_ID);
> + register uintptr_t a7 asm("a7") = (uintptr_t)(0x08000ba0);
^ BAO_SBI_EXT_ID
Using the experimental extension ID space would be fine for an RFC, but
this can't be merged until an SBI implementation ID for Bao is added to
the RISC-V SBI spec. Then the Bao EID would be '0xA000000 | <Bao-IMP-ID>'
I think we'll also need to discuss whether or not firmware/hypervisor-
specific extensions are exempt from all rules in chapter 3 of the SBI
spec other than a7 being the EID. If not, then this function should
just call __sbi_ecall() and the Bao hypercalls will not be allowed to
modify any registers except a0 and a1.
> +
> + asm volatile("ecall"
> + : "+r"(a0), "+r"(a1), "+r"(a2), "+r"(a3), "+r"(a4),
> + "+r"(a5), "+r"(a6), "+r"(a7)
> + : "r"(a0), "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5),
> + "r"(a6), "r"(a7)
> + : "memory");
> +
> + ctx->addr = a2;
> + ctx->op = a3;
> + ctx->value = a4;
> + ctx->access_width = a5;
> + ctx->request_id = a6;
> + ctx->npend_req = a7;
> +
> + return a0;
> +}
Thanks,
drew
Powered by blists - more mailing lists