1<?xml version="1.0"?> 2<!-- Copyright (C) 2022 Intel Corporation. --> 3<!-- SPDX-License-Identifier: BSD-3-Clause --> 4<xs:schema xml:id="root" 5 xmlns:xs="http://www.w3.org/2001/XMLSchema" 6 xmlns:acrn="https://projectacrn.org"> 7 8 <xs:assert test="every $cpu in vm//cpu_affinity//pcpu_id satisfies count(processors//thread[cpu_id = $cpu]) = 1"> 9 <xs:annotation acrn:severity="warning" acrn:report-on="$cpu"> 10 <xs:documentation>The physical CPU {$cpu} allocated to VM "{$cpu/ancestor::vm/name}" does not exist on the target board. Remove this CPU from the CPU affinity setting.</xs:documentation> 11 </xs:annotation> 12 </xs:assert> 13 14 <xs:assert test="every $vm in /acrn-config/vm satisfies 15 count(distinct-values($vm//cpu_affinity//pcpu_id)) = count($vm//cpu_affinity//pcpu_id)"> 16 <xs:annotation acrn:severity="warning" acrn:report-on="$vm/cpu_affinity"> 17 <xs:documentation>VM "{$vm/name}" repeats a physical CPU affinity assignment: {$vm//cpu_affinity//pcpu_id}. Remove the duplicates.</xs:documentation> 18 </xs:annotation> 19 </xs:assert> 20 21 <xs:assert test="every $pcpu in /acrn-config/vm[vm_type = 'RTVM']//cpu_affinity//pcpu_id satisfies 22 count(/acrn-config/vm[@id != $pcpu/ancestor::vm//companion_vmid ]//cpu_affinity[.//pcpu_id = $pcpu]) <= 1"> 23 <xs:annotation acrn:severity="error" acrn:report-on="//vm//cpu_affinity[.//pcpu_id = $pcpu]"> 24 <xs:documentation>Because physical CPU {$pcpu} is assigned to a Real-time VM "{$pcpu/ancestor::vm/name}", it may not be shared with any other VM. Look for, and probably remove, duplicate affinity assignments to CPU {$pcpu} in these VM {//vm[cpu_affinity//pcpu_id = $pcpu]/name} settings.</xs:documentation> 25 </xs:annotation> 26 </xs:assert> 27 28 <xs:assert test="every $pcpu in /acrn-config/vm[own_pcpu = 'y']//cpu_affinity//pcpu_id satisfies 29 count(/acrn-config/vm[@id != $pcpu/ancestor::vm//companion_vmid]//cpu_affinity[.//pcpu_id = $pcpu]) <= 1"> 30 <xs:annotation acrn:severity="error" acrn:report-on="//vm//cpu_affinity[.//pcpu_id = $pcpu]"> 31 <xs:documentation>Physical CPU {$pcpu} is assigned to a VM "[{$pcpu/ancestor::vm/name}]" exclusively owns the physical CPUs assigned to it. Look for, and probably remove, any affinity assignments to CPU {$pcpu} in these VMs {//vm[cpu_affinity//pcpu_id = $pcpu and name != $pcpu/ancestor::vm/name]/name} settings.</xs:documentation> 32 </xs:annotation> 33 </xs:assert> 34 35 <xs:assert test="every $vm in /acrn-config/vm[load_order != 'SERVICE_VM'] satisfies 36 count($vm/cpu_affinity/pcpu[pcpu_id != '']) > 0"> 37 <xs:annotation acrn:severity="error" acrn:report-on="$vm/cpu_affinity"> 38 <xs:documentation>Assign at least one physical CPU affinity (pCPU ID) for VM "{$vm/name}".</xs:documentation> 39 </xs:annotation> 40 </xs:assert> 41 42 <xs:assert test="every $vm in /acrn-config/vm[load_order != 'SERVICE_VM'] satisfies 43 count(distinct-values(processors//thread[cpu_id = $vm//cpu_affinity//pcpu_id]/core_type)) <= 1"> 44 <xs:annotation acrn:severity="error" acrn:report-on="$vm//cpu_affinity"> 45 <xs:documentation>The physical CPUs allocated to VM "{$vm/name}" have both performance cores: {processors//thread[cpu_id = $vm//cpu_affinity//pcpu_id and core_type = 'Core']/cpu_id} and efficiency cores: {processors//thread[cpu_id = $vm//cpu_affinity//pcpu_id and core_type = 'Atom']/cpu_id}, which is unsupported. Choose either all performance or all efficiency cores for CPU affinity.</xs:documentation> 46 </xs:annotation> 47 </xs:assert> 48 49 <xs:assert test="every $vm in /acrn-config/vm[vm_type = 'RTVM'] satisfies 50 count($vm//pcpu_id[./text() = '0']) = 0"> 51 <xs:annotation acrn:severity="error" acrn:report-on="$vm//cpu_affinity"> 52 <xs:documentation>CPU 0 can not be assigned to Real-time VM "{$vm/name/text()}". Remove CPU 0 affinity setting for this VM.</xs:documentation> 53 </xs:annotation> 54 </xs:assert> 55 56 <xs:assert test="every $pcpu in /acrn-config/vm[lapic_passthrough = 'y']//cpu_affinity//pcpu_id satisfies 57 count(/acrn-config[.//VUART_TIMER_PCPU=$pcpu]) = 0"> 58 <xs:annotation acrn:severity="warning" acrn:report-on="//VUART_TIMER_PCPU"> 59 <xs:documentation>Physical CPU "{//VUART_TIMER_PCPU}" hosting vUART timer is assigned to a lapic passthrough VM. The console may be laggy.</xs:documentation> 60 </xs:annotation> 61 </xs:assert> 62 63</xs:schema> 64