mbox series

[V4,0/5] virtio: Add virtio-device bindings

Message ID cover.1627362340.git.viresh.kumar@linaro.org
Headers show
Series virtio: Add virtio-device bindings | expand

Message

Viresh Kumar July 27, 2021, 5:23 a.m. UTC
Hi,

Currently the DT only provides support for following node types for virtio-mmio
nodes:

        virtio_mmio@a000000 {
                dma-coherent;
                interrupts = <0x00 0x10 0x01>;
                reg = <0x00 0xa000000 0x00 0x200>;
                compatible = "virtio,mmio";
        };

Here, each virtio-mmio corresponds to a virtio-device. But there is no way for
other users in the DT to show their dependency on virtio devices.

This patchset provides that support.

The first patch adds virtio-device bindings to allow for device sub-nodes to be
present and the second patch updates the virtio core to update the of_node.

Other patches add bindings for i2c and gpio devices.

Tested on x86 with qemu for arm64.

V3->V4:
- The binding is named "virtio,deviceXXXXXXXX" now.
- The virtio binding doesn't restrict the node names anymore.
- The i2c/gpio nodes are named i2c and gpio now.
- Dropped including gpio.yaml.
- Updated code to match the new binding name.
- Use "type: object" in additional-property.

V2/2.1->V3:
- Added review-tags from Arnd and Wolfram.
- Only the 5th patch changed otherwise:
  - Use of_device_is_compatible() instead of keeping a list of devices.
  - Use snprintf (with BUG_ON on return value) to create the compatible string,
    whose length is fixed using "virtio,XXXXXXXX".
  - Use dev_of_node().

V1->V2:
- The changes (both binding and code) are made at virtio level, instead of
  virtio-mmio. This allows the same to be used by all device types, irrespective
  of the transport mechanism.

- Dropped the reg property and used compatible in the form "virtio,<DID>".

- Dropped dt-bindings/virtio/virtio_ids.h.

- Add a patch to sync virtio-ids from spec, required for the last patch.

--
Viresh

Viresh Kumar (5):
  dt-bindings: virtio: Add binding for virtio devices
  dt-bindings: i2c: Add bindings for i2c-virtio
  dt-bindings: gpio: Add bindings for gpio-virtio
  uapi: virtio_ids: Sync ids with specification
  virtio: Bind virtio device to device-tree node

 .../devicetree/bindings/gpio/gpio-virtio.yaml | 59 +++++++++++++++++++
 .../devicetree/bindings/i2c/i2c-virtio.yaml   | 51 ++++++++++++++++
 .../devicetree/bindings/virtio/mmio.yaml      |  3 +-
 .../bindings/virtio/virtio-device.yaml        | 41 +++++++++++++
 drivers/virtio/virtio.c                       | 57 +++++++++++++++++-
 include/uapi/linux/virtio_ids.h               | 12 ++++
 6 files changed, 219 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-virtio.yaml
 create mode 100644 Documentation/devicetree/bindings/i2c/i2c-virtio.yaml
 create mode 100644 Documentation/devicetree/bindings/virtio/virtio-device.yaml

Comments

Viresh Kumar Aug. 4, 2021, 3:56 a.m. UTC | #1
On 27-07-21, 10:53, Viresh Kumar wrote:
> Hi,
> 
> Currently the DT only provides support for following node types for virtio-mmio
> nodes:
> 
>         virtio_mmio@a000000 {
>                 dma-coherent;
>                 interrupts = <0x00 0x10 0x01>;
>                 reg = <0x00 0xa000000 0x00 0x200>;
>                 compatible = "virtio,mmio";
>         };
> 
> Here, each virtio-mmio corresponds to a virtio-device. But there is no way for
> other users in the DT to show their dependency on virtio devices.
> 
> This patchset provides that support.
> 
> The first patch adds virtio-device bindings to allow for device sub-nodes to be
> present and the second patch updates the virtio core to update the of_node.
> 
> Other patches add bindings for i2c and gpio devices.
> 
> Tested on x86 with qemu for arm64.

Michael,

I hope you will be picking this series (Now that it is reviewed by
others) ? Just so you know, Wolfram needs the 4th patch, 4/5, to base
the virtio-i2c driver over it and has requested an immutable branch
for the same.

Thanks.
Viresh Kumar Aug. 31, 2021, 5:31 a.m. UTC | #2
On 27-07-21, 10:53, Viresh Kumar wrote:
> Hi,

> 

> Currently the DT only provides support for following node types for virtio-mmio

> nodes:

> 

>         virtio_mmio@a000000 {

>                 dma-coherent;

>                 interrupts = <0x00 0x10 0x01>;

>                 reg = <0x00 0xa000000 0x00 0x200>;

>                 compatible = "virtio,mmio";

>         };

> 

> Here, each virtio-mmio corresponds to a virtio-device. But there is no way for

> other users in the DT to show their dependency on virtio devices.

> 

> This patchset provides that support.

> 

> The first patch adds virtio-device bindings to allow for device sub-nodes to be

> present and the second patch updates the virtio core to update the of_node.

> 

> Other patches add bindings for i2c and gpio devices.

> 

> Tested on x86 with qemu for arm64.


Michael, are you picking these up for 5.15 ?

-- 
viresh
Michael S. Tsirkin Aug. 31, 2021, 2:25 p.m. UTC | #3
On Tue, Aug 31, 2021 at 11:01:05AM +0530, Viresh Kumar wrote:
> On 27-07-21, 10:53, Viresh Kumar wrote:
> > Hi,
> > 
> > Currently the DT only provides support for following node types for virtio-mmio
> > nodes:
> > 
> >         virtio_mmio@a000000 {
> >                 dma-coherent;
> >                 interrupts = <0x00 0x10 0x01>;
> >                 reg = <0x00 0xa000000 0x00 0x200>;
> >                 compatible = "virtio,mmio";
> >         };
> > 
> > Here, each virtio-mmio corresponds to a virtio-device. But there is no way for
> > other users in the DT to show their dependency on virtio devices.
> > 
> > This patchset provides that support.
> > 
> > The first patch adds virtio-device bindings to allow for device sub-nodes to be
> > present and the second patch updates the virtio core to update the of_node.
> > 
> > Other patches add bindings for i2c and gpio devices.
> > 
> > Tested on x86 with qemu for arm64.
> 
> Michael, are you picking these up for 5.15 ?

Okay.

> -- 
> viresh