%YAML 1.2
---
$id: http://devicetree.org/schemas/gunyah/qcom,hypervisor.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Hypervisor node to define virtual devices and other services.

maintainers:
   - Murali Nalajala <mnalajal@quicinc.com>

description: |+
  Top-level node named /hypervisor that describes virtual devices and other
  services.

properties:
  compatible:
    oneOf:
        items:
          - const: qcom,gunyah-hypervisor-1.0
          - const: qcom,gunyah-hypervisor

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


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


description: |+
  The VM Identification is a virtual node that conveys to the VM information
  about itself in the context of the hypervisor-based system and may be
  present as a child of the /hypervisor node

properties:
  compatible:
    oneOf:
        description: |+
          Must contain the VM-ID compatible string, which is provisionally
          specified as "qcom,gunyah-vm-id". This should be preceded by
          a string that specifies the VM ID API version, which is currently
          1.0, thus "qcom,gunyah-vm-id-1.0".
        items:
          - const: qcom,gunyah-vm-id-1.0
          - const: qcom,gunyah-vm-id

    properties:
      qcom,vendor:
        description: must contain the VM vendor string, for example: "Qualcomm Technologies, Inc.".
        $ref: /schemas/types.yaml#/definitions/string

      qcom,vmid:
        $ref: /schemas/types.yaml#/definitions/uint32
        description: must contain the hypervisor VMID of the VM, as
                     a 32-bit value

      qcom,owner-vmid:
        $ref: /schemas/types.yaml#/definitions/uint32
        description: Contains the hypervisor VMID of the VM’s owner. The owner
                     is the VM that allocated and created the VM. VMs directly
                     managed by the resource manager, such as the HLOS do not
                     have an owner.

      qcom,image-name:
        $ref: /schemas/types.yaml#/definitions/string
        description: contains the VM image name string.

      qcom,swid:
        $ref: /schemas/types.yaml#/definitions/uint32
        description: must contain the Qualcomm Technologies, Inc. PIL software ID value.

required:
- compatible
- qcom,vmid
- qcom,owner-vmid


description: |+
  Resource Manager node which is required to communicate to Resource
  Manager VM using RM Message Queues.

properties:
  compatible:
    oneOf:
        description:
          The resource manager RPC communicate link is required to be in the
          device-tree of a VM at boot, without it, a VM may be unable to
          communicate with the Resource Manager. Resource Manager VM can
          support implementation of  various versions i.e 1.0 or 2.0

        items:
          - const: qcom,resource-manager-1-0
          - const: qcom,resource-manager
          - const: qcom,gunyah-message-queue
          - const: qcom,haven-capability

        interrupts:
          maxItems: 2

        reg:
          maxItems: 2

        qcom,is-full-duplex:
          $ref: /schemas/types.yaml#/definitions/flag
          description: This node is a pair of message queues i.e. Tx and Rx

        qcom,tx-message-size:
          $ref: /schemas/types.yaml#/definitions/uint32
          description: maximum message size in bytes, >= 240 bytes for RM IPC

        qcom,tx-queue-depth:
          $ref: /schemas/types.yaml#/definitions/uint32
          description: depth(size) of transmit queue in hypervisor

        qcom,rx-message-size:
          $ref: /schemas/types.yaml#/definitions/uint32
          description: maximum message size in bytes, >= 240 bytes for RM IPC

        qcom,rx-queue-depth:
          $ref: /schemas/types.yaml#/definitions/uint32
          description: depth(size) of receive queue in hypervisor

        qcom,console-dev:
          $ref: /schemas/types.yaml#/definitions/flag
          description: if set, the resource-manger will accept console logs
                       from the VM

        qcom,free-irq-start:
          $ref: /schemas/types.yaml#/definitions/uint32
          description: first VIRQ number which is free for virtual interrupt
                       use. Here SPI 0 = VIRQ 32.

required:
- compatible
- interrupts
- reg
- qcom,is-full-duplex

examples:
  - |
    hypervisor {
        #address-cells = <2>;
        #size-cells = <0>;
        compatible = "qcom,gunyah-hypervisor-1.0", "qcom,gunyah-hypervisor",
                     "simple-bus";
        name = "hypervisor";

        qcom,gunyah-vm {
            compatible = "qcom,gunyah-vm-id-1.0", "qcom,gunyah-vm-id";
            qcom,vendor = "Qualcomm Technologies, Inc.";
            qcom,vmid = <45>;
            qcom,owner-vmid = <3>;
        };

        qcom,resource-manager-rpc@0000000000000001 {
            compatible = "qcom,resource-manager-1-0", "qcom,resource-manager",
                          "qcom,gunyah-message-queue", "qcom,haven-capability";
            interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>, /* TX full IRQ */
                         <GIC_SPI 4 IRQ_TYPE_EDGE_RISING>; /* RX empty IRQ */
            reg = <0x00000000 0x00000000>, <0x00000000 0x00000001>;
                  /* TX, RX cap ids */
            qcom,is-full-duplex;
            qcom,free-irq-start = <0>;
            qcom,tx-queue-depth = <8>;
            qcom,tx-message-size = <0xf0>;
            qcom,rx-queue-depth = <8>;
            qcom,rx-message-size = <0xf0>;
        };
    };

