Re: [RFC PATCH 0/2] Add support for SBI version to 0.2
From: Christoph Hellwig
Date: Tue Aug 27 2019 - 10:46:27 EST
On Mon, Aug 26, 2019 at 04:32:54PM -0700, Atish Patra wrote:
> This patch series aims to add support for SBI specification version
> v0.2. It doesn't break compatibility with any v0.1 implementation.
> Internally, all the v0.1 calls are just renamed to legacy to be in
> sync with specification [1].
>
> The patches for v0.2 support in OpenSBI are available at
> http://lists.infradead.org/pipermail/opensbi/2019-August/000422.html
>
> [1] https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc
I really don't like the current design of that SBI 0.2 spec,
and don't think implementing it as-is is helpful.
For one the way how the extension id is placed creates a compatibilty
problem, not allowing your to implement a backwards compatible sbi,
which seems bad.
Second just blindly moving all the existing calls to a single legacy
extension doesn't seem useful. We need to differenciate the existing
calls:
(1) actually board specific and have not place in a cpu abstraction
layer: getchar/putchar, these should just never be advertised in a
non-legacy setup, and the drivers using them should not probe
on a sbi 0.2+ system
(2) useful for currently taped out cpus and in the long run for
virtualization to avoid mmio traps: ipis, timers, tlb shootdown.
These should stay backwards compatible, but for sbi 0.2 be
negotiated individually
(3) in theory useful, but given how much of a big hammer sfence.i
not useful in theory: SBI_REMOTE_FENCE_I we can decide if we want
to either not allow it for sbi 0.2+ or also negotiate it. I'd
personally favor not advertising it and just use ipis to implement
it. If we want useful acceleration of i-cache synchronization
we'll need actual instructions that are much more fine grained
in the future.