Re: [PATCH v2 3/3] RISC-V: Move SBI related macros under uapi.
From: Anup Patel
Date: Thu Oct 03 2019 - 01:30:51 EST
On Sat, Sep 28, 2019 at 3:51 AM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
>
> On Thu, Sep 26, 2019 at 05:09:15PM -0700, Atish Patra wrote:
> > All SBI related macros can be reused by KVM RISC-V and userspace tools
> > such as kvmtool, qemu-kvm. SBI calls can also be emulated by userspace
> > if required. Any future vendor extensions can leverage this to emulate
> > the specific extension in userspace instead of kernel.
>
> Just because userspace can use them that doesn't mean they are a
> userspace API. Please don't do this as this limits how we can ever
> remove previously existing symbols. Just copy over the current
> version of the file into the other project of your choice instead
> of creating and API we need to maintain.
These defines are indeed part of KVM userspace API because we will
be forwarding SBI calls not handled by KVM RISC-V kernel module to
KVM userspace (QEMU/KVMTOOL). The forwarded SBI call details
are passed to userspace via "struct kvm_run" of KVM_RUN ioctl.
Please refer PATCH17 and PATCH18 of KVM RISC-V v8 series.
Currently, we implement SBI v0.1 for KVM Guest hence we end-up
forwarding CONSOLE_GETCHAR and CONSOLE_PUTCHART to
KVM userspace.
In future we will implement SBI v0.2 for KVM Guest where we will be
forwarding the SBI v0.2 experimental and vendor extension calls
to KVM userspace.
Eventually, we will stop emulating SBI v0.1 for Guest once we have
all required calls in SBI v0.2. At that time, all SBI v0.1 calls will be
always forwarded to KVM userspace.
Regards,
Anup