Peios Learn
Documentation

Peios

Peios Peios Kernel Universal Directory Project

Developer Tools

Trail Acta Provium clackatoo CAF GCSL Pekit

Applications

Framewright

Standards and Conventions

Standards and Conventions Peios Specifications
Peios Kernel

Virtio bindings

Single-page view · as markdown

virtio memory mapped devices

Peios Kernel / Hardware and drivers / Device-tree binding reference / Virtio bindings

Schema identifier ($id): "http://devicetree.org/schemas/virtio/mmio.yaml#"

Schema dialect ($schema): "http://devicetree.org/meta-schemas/core.yaml#"

Maintainers (maintainers): "Jean-Philippe Brucker <jean-philippe@linaro.org>"

See https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=virtio for more details.

Properties and child nodes (properties) #

compatible — required here #

Exact value (const): "virtio,mmio"

reg — required here #

Maximum number of items (maxItems): 1

dma-coherent — not listed as required here #

true — No constraints added by this property rule.

interrupts — required here #

Maximum number of items (maxItems): 1

#iommu-cells — not listed as required here #

Required when the node corresponds to a virtio-iommu device.

Exact value (const): 1

iommus — not listed as required here #

Required for devices making accesses thru an IOMMU.

Maximum number of items (maxItems): 1

wakeup-source — not listed as required here #

Value type (type): "boolean"

Required for setting irq of a virtio_mmio device as wakeup source.

Required in this object (required): "compatible", "reg", "interrupts"

Properties not matched by properties or patternProperties in this schema (additionalProperties) #

Value type (type): "object"

Examples (examples) #

virtio@3000 {
    compatible = "virtio,mmio";
    reg = <0x3000 0x100>;
    interrupts = <41>;

    /* Device has endpoint ID 23 */
    iommus = <&viommu 23>;
};

viommu: iommu@3100 {
    compatible = "virtio,mmio";
    reg = <0x3100 0x100>;
    interrupts = <42>;

    #iommu-cells = <1>;
};

Source notes #

Annotations retained from the schema source

Line 1: SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

virtio-iommu device using the virtio-pci transport

Peios Kernel / Hardware and drivers / Device-tree binding reference / Virtio bindings

Schema identifier ($id): "http://devicetree.org/schemas/virtio/pci-iommu.yaml#"

Schema dialect ($schema): "http://devicetree.org/meta-schemas/core.yaml#"

Maintainers (maintainers): "Jean-Philippe Brucker <jean-philippe@linaro.org>"

When virtio-iommu uses the PCI transport, its programming interface is discovered dynamically by the PCI probing infrastructure. However the device tree statically describes the relation between IOMMU and DMA masters. Therefore, the PCI root complex that hosts the virtio-iommu contains a child node representing the IOMMU device explicitly.

DMA from the IOMMU device isn't managed by another IOMMU. Therefore the virtio-iommu node doesn't have an "iommus" property, and is omitted from the iommu-map property of the root complex.

All of these rules must match (allOf) #

Rule 1 #

Shared schema rule ($ref): /schemas/pci/pci-device.yaml#

Properties and child nodes (properties) #

compatible — required here #

Exactly one of these rules must match (oneOf) #

Rule 1

Array item rules (items)

Item 1

Exact value (const): "virtio,pci-iommu"

Item 2

Exact value (const): "pci1af4,1057"

Rule 2

Array item rules (items)

Item 1

Exact value (const): "pci1af4,1057"

reg — required here #

Maximum number of items (maxItems): 1

#iommu-cells — required here #

Exact value (const): 1

Required in this object (required): "compatible", "reg", "#iommu-cells"

Properties not matched by properties or patternProperties in this schema (additionalProperties) #

false

Not allowed by this rule.

Examples (examples) #

bus {
    #address-cells = <2>;
    #size-cells = <2>;

    pcie@40000000 {
        device_type = "pci";
        #address-cells = <3>;
        #size-cells = <2>;
        reg = <0x0 0x40000000  0x0 0x1000000>;
        ranges = <0x02000000 0x0 0x41000000  0x0 0x41000000  0x0 0x0f000000>;

        /*
         * The IOMMU manages all functions in this PCI domain except
         * itself. Omit BDF 00:01.0.
         */
        iommu-map = <0x0 &iommu0 0x0 0x8
                     0x9 &iommu0 0x9 0xfff7>;

        /* The IOMMU programming interface uses slot 00:01.0 */
        iommu0: iommu@1,0 {
            compatible = "pci1af4,1057";
            reg = <0x800 0 0 0 0>;
            #iommu-cells = <1>;
        };
    };

    pcie@50000000 {
        device_type = "pci";
        #address-cells = <3>;
        #size-cells = <2>;
        reg = <0x0 0x50000000  0x0 0x1000000>;
        ranges = <0x02000000 0x0 0x51000000  0x0 0x51000000  0x0 0x0f000000>;

        /*
         * The IOMMU also manages all functions from this domain,
         * with endpoint IDs 0x10000 - 0x1ffff
         */
        iommu-map = <0x0 &iommu0 0x10000 0x10000>;
    };

    ethernet {
        /* The IOMMU manages this platform device with endpoint ID 0x20000 */
        iommus = <&iommu0 0x20000>;
    };
};

Source notes #

Annotations retained from the schema source

Line 1: SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

Line 27: If compatible is present, it should contain the vendor and device ID

Line 28: according to the PCI Bus Binding specification. Since PCI provides

Line 29: built-in identification methods, compatible is not actually required.

Virtio device

Peios Kernel / Hardware and drivers / Device-tree binding reference / Virtio bindings

Schema identifier ($id): "http://devicetree.org/schemas/virtio/virtio-device.yaml#"

Schema dialect ($schema): "http://devicetree.org/meta-schemas/core.yaml#"

Maintainers (maintainers): "Viresh Kumar <viresh.kumar@linaro.org>"

These bindings are applicable to virtio devices irrespective of the bus they are bound to, like mmio or pci.

Properties and child nodes (properties) #

compatible — required here #

String pattern (pattern): "^virtio,device[0-9a-f]{1,8}$"

Virtio device nodes. "virtio,deviceID", where ID is the virtio device id. The textual representation of ID shall be in lower case hexadecimal with leading zeroes suppressed.

Required in this object (required): "compatible"

Properties not matched by properties or patternProperties in this schema (additionalProperties) #

true

Allowed by this rule.

Examples (examples) #

virtio@3000 {
    compatible = "virtio,mmio";
    reg = <0x3000 0x100>;
    interrupts = <43>;

    i2c {
        compatible = "virtio,device22";
    };
};

Source notes #

Annotations retained from the schema source

Line 1: SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

Line 16: We need a select here so we don't match all nodes with 'virtio,mmio'

Peios Learn — documentation for Peios software.

Built with Trail.