From: "João Peixoto" <jpeixoto@osyx.tech>
To: Andrew Jones <andrew.jones@oss.qualcomm.com>, joaopeixoto@osyx.tech
Cc: linux-kernel@vger.kernel.org, ajd@linux.ibm.com, alex@ghiti.fr,
aou@eecs.berkeley.edu, bagasdotme@gmail.com,
catalin.marinas@arm.com, conor+dt@kernel.org, corbet@lwn.net,
dan.j.williams@intel.com, davidmcerdeira@osyx.tech,
devicetree@vger.kernel.org, dev@kael-k.io,
gregkh@linuxfoundation.org, haren@linux.ibm.com, heiko@sntech.de,
jose@osyx.tech, kever.yang@rock-chips.com, krzk+dt@kernel.org,
linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org,
linux-riscv@lists.infradead.org, maddy@linux.ibm.com,
mani@kernel.org, nathan@kernel.org, neil.armstrong@linaro.org,
palmer@dabbelt.com, pjw@kernel.org,
prabhakar.mahadev-lad.rj@bp.renesas.com, robh@kernel.org,
will@kernel.org
Subject: Re: [PATCH 4/6] virt: bao: Add Bao I/O dispatcher driver
Date: Fri, 7 Aug 2026 08:43:20 +0100 [thread overview]
Message-ID: <79d79806-ceda-4e79-8e9f-6420265c8efa@osyx.tech> (raw)
In-Reply-To: <4rrof4lk2zxut63u7qwxlmygpslvq5owfraatbjq3sbybtac4u@2prxnxijartx>
On 1/14/26 20:32, Andrew Jones wrote:
> On Wed, Jan 07, 2026 at 04:28:27PM +0000,joaopeixoto@osyx.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>'
Understood. For now the RISC-V backend uses the experimental extension
space,
and I have made that explicit: BAO_SBI_EXT_ID carries a comment noting a
permanent EID must be assigned through the SBI spec before RISC-V can be
considered stable, and I am marking this revision RFC for that reason. I
will
start the process of getting a Bao implementation ID registered and
switch to
'0xA000000 | <Bao-IMP-ID>' once it is assigned.
> 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
Good point, and I would value your view before I respin the ABI. The Remote
I/O hypercall currently returns several values in a2-a7, which does violate
the calling convention if Bao extensions must follow chapter 3. If they
must,
I will change the hypervisor-side ABI so the call only returns via a0/a1 and
move the extra results into a shared-memory region, then switch the helper
to __sbi_ecall(). Since that is a hypervisor ABI change I would rather agree
the direction first. Do you know of precedent for hypervisor/firmware
extensions being exempted here, or should I assume the full chapter-3 rules
apply?
(Separately, I removed the redundant input constraints from the ecall asm -
the operands are already "+r", so the extra "r" inputs were unnecessary.)
next prev parent reply other threads:[~2026-08-07 7:43 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-24 13:52 [PATCH 0/5] virt: Add Bao hypervisor IPC and I/O dispatcher drivers joaopeixoto
2025-12-24 13:52 ` [PATCH 1/5] dt-bindings: Add Bao IPC shared memory driver binding joaopeixoto
2025-12-24 16:18 ` Rob Herring (Arm)
2025-12-25 8:57 ` Krzysztof Kozlowski
2025-12-24 13:52 ` [PATCH 2/5] virt: add Bao IPC shared memory driver joaopeixoto
2025-12-24 15:53 ` Greg KH
2025-12-24 15:54 ` Greg KH
2025-12-25 9:02 ` Krzysztof Kozlowski
2025-12-24 13:52 ` [PATCH 3/5] dt-bindings: Add Bao I/O dispatcher driver binding joaopeixoto
2025-12-24 16:18 ` Rob Herring (Arm)
2025-12-25 8:58 ` Krzysztof Kozlowski
2025-12-24 13:52 ` [PATCH 4/5] virt: add Bao I/O dispatcher driver joaopeixoto
2025-12-25 9:12 ` Krzysztof Kozlowski
2025-12-24 13:52 ` [PATCH 5/5] MAINTAINERS: Add entries for Bao hypervisor drivers, headers, and DT bindings joaopeixoto
2025-12-25 8:52 ` Krzysztof Kozlowski
2025-12-25 8:51 ` [PATCH 0/5] virt: Add Bao hypervisor IPC and I/O dispatcher drivers Krzysztof Kozlowski
2026-01-07 16:28 ` [PATCH v2 0/6] " joaopeixoto
2026-01-07 16:28 ` [PATCH 1/6] dt-bindings: Add Bao IPC shared memory driver binding joaopeixoto
2026-01-07 16:46 ` Krzysztof Kozlowski
2026-08-07 7:41 ` João Peixoto
2026-08-07 7:50 ` Krzysztof Kozlowski
2026-01-07 16:28 ` [PATCH 2/6] virt: bao: Add Bao IPC shared memory driver joaopeixoto
2026-01-07 18:54 ` Randy Dunlap
2026-08-07 7:42 ` João Peixoto
2026-01-14 20:37 ` Andrew Jones
2026-08-07 7:42 ` João Peixoto
2026-01-07 16:28 ` [PATCH 3/6] dt-bindings: Add Bao I/O dispatcher driver binding joaopeixoto
2026-01-07 16:47 ` Krzysztof Kozlowski
2026-08-07 7:43 ` João Peixoto
2026-08-07 7:51 ` Krzysztof Kozlowski
2026-01-07 16:28 ` [PATCH 4/6] virt: bao: Add Bao I/O dispatcher driver joaopeixoto
2026-01-14 20:32 ` Andrew Jones
2026-08-07 7:43 ` João Peixoto [this message]
2026-01-07 16:28 ` [PATCH 5/6] virt: bao: Move BAO_IPCSHMEM_HYPERCALL_ID to common header joaopeixoto
2026-01-07 19:36 ` Greg KH
2026-08-07 7:43 ` João Peixoto
2026-01-14 20:34 ` Andrew Jones
2026-08-07 7:44 ` João Peixoto
2026-01-07 16:28 ` [PATCH 6/6] MAINTAINERS: Add entries for Bao hypervisor drivers, headers, and DT bindings joaopeixoto
2026-01-07 19:37 ` [PATCH v2 0/6] virt: Add Bao hypervisor IPC and I/O dispatcher drivers Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=79d79806-ceda-4e79-8e9f-6420265c8efa@osyx.tech \
--to=jpeixoto@osyx.tech \
--cc=ajd@linux.ibm.com \
--cc=alex@ghiti.fr \
--cc=andrew.jones@oss.qualcomm.com \
--cc=aou@eecs.berkeley.edu \
--cc=bagasdotme@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=dan.j.williams@intel.com \
--cc=davidmcerdeira@osyx.tech \
--cc=dev@kael-k.io \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=haren@linux.ibm.com \
--cc=heiko@sntech.de \
--cc=joaopeixoto@osyx.tech \
--cc=jose@osyx.tech \
--cc=kever.yang@rock-chips.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=maddy@linux.ibm.com \
--cc=mani@kernel.org \
--cc=nathan@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh@kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox