1<?xml version="1.0"?>
2<xs:schema xml:id="root"
3           xmlns:xs="http://www.w3.org/2001/XMLSchema"
4           xmlns:acrn="https://projectacrn.org">
5
6  <xs:assert test="if (//VCAT_ENABLED = 'y')
7                   then (//CDP_ENABLED = 'n' and //RDT_ENABLED = 'y')
8                   else true()">
9    <xs:annotation acrn:severity="error" acrn:report-on="//CDP_ENABLED">
10      <xs:documentation>Hypervisor Virtual Cache Allocation Technology may be enabled only when hypervisor Code and Data Prioritization is disabled.</xs:documentation>
11    </xs:annotation>
12  </xs:assert>
13
14  <xs:assert test="if (//RDT_ENABLED = 'y' and //CDP_ENABLED = 'y')
15                   then (count(//capability[./@id = 'CDP']) = count(//cache[./@level = '2' or ./@level = '3']))
16                   else true()">
17    <xs:annotation acrn:severity="error" acrn:report-on="//CDP_ENABLED">
18      <xs:documentation>Code and Data Prioritization can only be opened when all L2 and L3 cache region has 'CDP' capability.</xs:documentation>
19    </xs:annotation>
20  </xs:assert>
21
22  <xs:assert test="if (count(//virtual_cat_support[text() = 'y']) > 0)
23                   then (//RDT_ENABLED = 'y' and //VCAT_ENABLED = 'y')
24                   else true()">
25    <xs:annotation acrn:severity="error" acrn:report-on="//VCAT_ENABLED">
26      <xs:documentation>VM Virtual Cache Allocation Technology may be enabled only when hypervisor Virtual Cache Allocation Technology is enabled.</xs:documentation>
27    </xs:annotation>
28  </xs:assert>
29
30  <xs:assert test="every $vm in //vm satisfies $vm//load_order != 'SERVICE_VM' or count($vm//lapic_passthrough[text() = 'y']) = 0 or count(//nested_virtualization_support[text() = 'y']) > 0">
31    <xs:annotation acrn:severity="error" acrn:report-on="$vm//lapic_passthrough">
32      <xs:documentation>The Service VM may not use LAPIC passthrough unless hypervisor Nested Virtualization is enabled.</xs:documentation>
33    </xs:annotation>
34  </xs:assert>
35
36  <xs:assert test="empty(vm[load_order ='PRE_LAUNCHED_VM' and vm_type='RTVM']) or
37		   every $cap in caches/cache[@level=3]/capability[@id='Software SRAM'] satisfies
38		   (compare($cap/end, '0x80000000') &lt; 0 or compare($cap/start, '0xf8000000') &gt;= 0)">
39    <xs:annotation acrn:severity="warning" acrn:report-on="hv//SSRAM_ENABLED">
40      <xs:documentation>The physical software SRAM region may not overlap with pre-defined regions in any VM.
41
42When a pre-launched RTVM is enabled, the physical software SRAM is allocated to it at the same guest physical
43address. Thus it is assumed that the software SRAM region does not overlap with any pre-defined region in the
44pre-launched VM, such as the guest PCI hole which resides at 2GB - 3.5GB.
45
46This error cannot be fixed by adjusting the configuration. Report a `GitHub issue &lt;https://github.com/projectacrn/acrn-hypervisor/issues&gt;`_ if you receive this error.</xs:documentation>
47    </xs:annotation>
48  </xs:assert>
49
50  <xs:assert test="every $needed in number-of-clos-id-needed(/acrn-config) satisfies
51                   every $capacity in min(//caches/cache/capability[@id='CAT']/clos_number) satisfies
52                   $needed &lt; $capacity">
53    <xs:annotation acrn:severity="error" acrn:report-on="/acrn-config/hv/CACHE_REGION">
54      <xs:documentation>The current CAT configuration requires {string($needed)} CLOS IDs, which exceeds the capacity of the platform which supports {string($capacity)} at most.</xs:documentation>
55    </xs:annotation>
56  </xs:assert>
57
58  <xs:assert test="every $cache in //CACHE_ALLOCATION satisfies
59                   every $ssram in //caches/cache[@level=$cache/CACHE_LEVEL and @id=$cache/CACHE_ID]/capability[@id='Software SRAM'] satisfies
60                   every $policy in $cache/POLICY satisfies
61                   bitwise-and($policy/CLOS_MASK, $ssram/waymask) = 0">
62    <xs:annotation acrn:severity="error" acrn:report-on="/acrn-config/hv/CACHE_REGION">
63      <xs:documentation>VM '{$policy/VM}' vCPU '{$policy/VCPU}' cannot use chunk(s) {bits-of($ssram/waymask)} of L{$cache/CACHE_LEVEL} cache (cache ID: {$cache/CACHE_ID}) as those chunks are consumed by software SRAM. </xs:documentation>
64    </xs:annotation>
65  </xs:assert>
66
67</xs:schema>
68