<?xml version="1.0"?>
<!-- Copyright (C) 2022 Intel Corporation. -->
<!-- SPDX-License-Identifier: BSD-3-Clause -->

<xs:schema xml:id="root"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:acrn="https://projectacrn.org">

  <xs:assert test="every $VM_NAME in /acrn-config//IVSHMEM//VM_NAME satisfies
                  every $REGION_NAME in /acrn-config//IVSHMEM_REGION[IVSHMEM_VMS/IVSHMEM_VM/VM_NAME=$VM_NAME]/NAME satisfies
                  count(/acrn-config//IVSHMEM_REGION[NAME=$REGION_NAME]/IVSHMEM_VMS/IVSHMEM_VM[VM_NAME=$VM_NAME]) = 1">
    <xs:annotation acrn:severity="error" acrn:report-on="$REGION_NAME">
        <xs:documentation>VM "{$VM_NAME}" may not be duplicated in the list of VMs that have access to the Inter-VM shared memory region "{$REGION_NAME}".</xs:documentation>
    </xs:annotation>
  </xs:assert>

  <xs:assert test="every $NAME in /acrn-config//IVSHMEM_REGION//NAME satisfies
                  not(/acrn-config//IVSHMEM_REGION//NAME = '')">
    <xs:annotation acrn:severity="error" acrn:report-on="$NAME">
      <xs:documentation>InterVM shared memory region name must be set </xs:documentation>
    </xs:annotation>
  </xs:assert>

</xs:schema>
