Alex Kolovsky

Configuring hardware.dts

This file describes all MMIO peripherals available in the system.

The element that contains all the information is called soc:

// hardware.dts
/dts-v1/;

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

    soc {

      // Configurations...
    };
};

Peripheral Descriptions

The main configuration elements are MMIO peripheral descriptions, which are used to define the hypervisor’s guests.

The template for this node is:

peripheral_name {
  // Configurations...
};

Example:

// hardware.dts

/dts-v1/;

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

    soc {

      uart: serial@10000000 {

        // Configurations...
      };
    };
};

Each peripheral node has the following required properties:

reg

reg — Contains the MMIO peripheral regions. Each peripheral can have more than one region.

The template for this field is:

reg = <addr_hi addr_lo size_hi size_lo ...>;

Example:

// hardware.dts

/dts-v1/;

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

    soc {

      uart: serial@10000000 {

        // Elements 0-1: MMIO base address (0x00000000_10000000)
        // Elements 2-3: Size (8 bytes)
  			reg = <0x0 0x10000000 0x0 0x8>;

        // Configurations...
      };
    };
};

This indicates that there are one MMIO region for the uart peripheral:

compatible

The compatible property contains the compatible string of the peripheral.

It is used to connect such peripherals with drivers describe in modules.toml.

The template for this field is:

compatible = "compatible_str";

Example:

// hardware.dts

/dts-v1/;

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

    soc {

      uart: serial@10000000 {

        compatible = "ns16550a";

        // Configurations...
      };
    };
};

This indicates that the uart peripheral will use a driver matching the ns16550a compatible field, if needed.

memory-policy

The memory-policy property accepts “emulate” or “passthrough”, indicating whether the peripheral must be emulated or accessed directly.

The template for this field is:

memory-policy = "memory-policy_str";

Example:

// hardware.dts

/dts-v1/;

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

    soc {

      uart: serial@10000000 {

        compatible = "passthrough";

        // Configurations...
      };
    };
};

This indicates that the uart peripheral can be accessed directly.