Re: [PATCH 1/2] dt-bindings: spi: add bindings for spi-virtio
From: Francesco Valla
Date: Wed Sep 30 2026 - 14:53:05 EST
Hello Krzysztof,
On Wed, Sep 30, 2026 at 02:03:17PM +0200, Krzysztof Kozlowski wrote:
> On Tue, Sep 29, 2026 at 06:41:55PM +0200, Francesco Valla wrote:
> > Add bindings for spi-virtio based on virtio-device, reflecting what
> > already exists for gpio-virtio and i2c-virtio. A node using the bindings
>
> Existing code is not a reason to add more code. Existing bugs are not a
> reason to add more bugs. Please provide proper rationale why this suits
> DT.
>
When a non-discoverable bus (SPI in this case, but that's true also for
e.g. the I2C and GPIO cases I mentioned) made available by a virtio
transport is registered, the devicetree can be used to declare its child
devices (if any) and/or other properties (say,i GPIOs tied to CS lines
for the SPI usecase).
The virtio framework already searches for a node with a suitable
compatible when registering a device [1]; this binding is thus not
introducing a new functionality, but allowing proper validation of
nodes tied to spi-virtio devices.
> > is not used to instantiate the device, which is registered by the
> > transport (e.g.: virtio-mmio), but to define its properties and
> > establish dependencies with other nodes.
> >
> > Add the new bindings inside the MAINTAINERS file.
> >
> > Signed-off-by: Francesco Valla <francesco@xxxxxxxx>
> > ---
> > .../devicetree/bindings/spi/spi-virtio.yaml | 53 ++++++++++++++++++++++
> > MAINTAINERS | 1 +
> > 2 files changed, 54 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/spi/spi-virtio.yaml b/Documentation/devicetree/bindings/spi/spi-virtio.yaml
> > new file mode 100644
> > index 000000000000..5b8639dd2e1f
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/spi/spi-virtio.yaml
> > @@ -0,0 +1,53 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/spi/spi-virtio.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Virtio SPI controller device
> > +
> > +maintainers:
> > + - Francesco Valla <francesco@xxxxxxxx>
> > +
> > +allOf:
> > + - $ref: /schemas/spi/spi-controller.yaml#
> > + - $ref: /schemas/virtio/virtio-device.yaml#
> > +
> > +description:
> > + Virtio SPI controller device, see /schemas/virtio/virtio-device.yaml for
> > + more details.
> > +
> > +properties:
> > + $nodename:
> > + const: spi
> > +
> > + compatible:
> > + const: virtio,device2d
>
> From where does the compatible come from?
>
This is the compatible the virtio framework is expecting [1]; '2d' is the
hexadecimal representation of 45, which is the virtio identifier for a
SPI device [2].
> Best regards,
> Krzysztof
>
Thank you
Regards,
Francesco
[1] https://elixir.bootlin.com/linux/v7.2.8/source/drivers/virtio/virtio.c#L488
[2] https://docs.oasis-open.org/virtio/virtio/v1.4/virtio-v1.4.html @ 5.21.1