# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/firmware/gunyah-hypervisor.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Gunyah Hypervisor

maintainers:
  - Prakruthi Deepak Heragu <quic_pheragu@quicinc.com>
  - Elliot Berman <quic_eberman@quicinc.com>

description: |+
  Gunyah virtual machines use this information to determine the capability IDs
  of the message queues used to communicate with the Gunyah Resource Manager.
  See also: https://github.com/quic/gunyah-resource-manager/blob/develop/src/vm_creation/dto_construct.c

properties:
  compatible:
    const: gunyah-hypervisor

  "#address-cells":
    description: Number of cells needed to represent 64-bit capability IDs.
    const: 2

  "#size-cells":
    description: must be 0, because capability IDs are not memory address
                  ranges and do not have a size.
    const: 0

patternProperties:
  "^gunyah-resource-mgr(@.*)?":
    type: object
    description:
      Resource Manager node which is required to communicate to Resource
      Manager VM using Gunyah Message Queues.

    properties:
      compatible:
        const: gunyah-resource-manager

      reg:
        items:
          - description: Gunyah capability ID of the TX message queue
          - description: Gunyah capability ID of the RX message queue

      interrupts:
        items:
          - description: Interrupt for the TX message queue
          - description: Interrupt for the RX message queue

    additionalProperties: false

    required:
      - compatible
      - reg
      - interrupts

additionalProperties: false

required:
  - compatible
  - "#address-cells"
  - "#size-cells"

examples:
  - |
    #include <dt-bindings/interrupt-controller/arm-gic.h>

    hypervisor {
        #address-cells = <2>;
        #size-cells = <0>;
        compatible = "gunyah-hypervisor";

        gunyah-resource-mgr@0 {
            compatible = "gunyah-resource-manager";
            interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>, /* TX allowed IRQ */
                         <GIC_SPI 4 IRQ_TYPE_EDGE_RISING>; /* RX requested IRQ */
            reg = <0x00000000 0x00000000>, /* TX capability ID */
                  <0x00000000 0x00000001>; /* RX capability ID */
        };
    };
