1<?xml version="1.0" encoding="utf-8"?> 2 3<!-- Copyright (C) 2021-2022 Intel Corporation. --> 4<!-- SPDX-License-Identifier: BSD-3-Clause --> 5 6<xsl:stylesheet 7 version="1.0" 8 xmlns:xi="http://www.w3.org/2003/XInclude" 9 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 10 xmlns:dyn="http://exslt.org/dynamic" 11 xmlns:math="http://exslt.org/math" 12 xmlns:str="http://exslt.org/strings" 13 xmlns:acrn="http://projectacrn.org"> 14 <xsl:include href="lib.xsl" /> 15 <xsl:output method="text" /> 16 17 <xsl:template match="/acrn-offline-data"> 18 <!-- Declaration of license --> 19 <xsl:value-of select="$license" /> 20 21 <!-- Header include guard --> 22 <xsl:value-of select="acrn:include-guard('VM_CONFIGURATIONS_H')" /> 23 24 <!-- Included headers --> 25 <xsl:value-of select="acrn:include('misc_cfg.h')" /> 26 <xsl:value-of select="acrn:include('pci_devices.h')" /> 27 28 <xsl:apply-templates select="config-data/acrn-config" /> 29 30 <xsl:value-of select="acrn:include-guard-end('VM_CONFIGURATIONS_H')" /> 31 </xsl:template> 32 33 <xsl:template match="config-data/acrn-config"> 34 <xsl:call-template name="vm_count" /> 35 <xsl:call-template name="sos_vm_bootarges" /> 36 <xsl:call-template name="vm_vuart_num" /> 37 <xsl:value-of select = "acrn:define('MAX_IR_ENTRIES', //MAX_IR_ENTRIES, 'U')" /> 38 </xsl:template> 39 40 <xsl:template name ="vm_vuart_num"> 41 <xsl:variable name="vuart_nums"> 42 <xsl:for-each select = "//config-data//vm"> 43 <xsl:variable name = "vm_name" select = "./name/text()" /> 44 <xsl:variable name = "vuart_num" select = "count(//endpoint[vm_name = $vm_name]) + 1" /> 45 <xsl:value-of select = "$vuart_num" /> 46 <xsl:if test = "position() != last()"> 47 <xsl:value-of select = "','" /> 48 </xsl:if> 49 </xsl:for-each> 50 </xsl:variable> 51 <xsl:value-of select = "acrn:define('MAX_VUART_NUM_PER_VM', math:max(str:split($vuart_nums, ',')), 'U')" /> 52 </xsl:template> 53 54 <xsl:template name ="vm_count"> 55 <xsl:value-of select="acrn:comment('SERVICE_VM_NUM can only be 0 or 1; When SERVICE_VM_NUM is 1, MAX_POST_VM_NUM must be 0 too.')" /> 56 <xsl:value-of select="$newline" /> 57 <xsl:value-of select="acrn:define('PRE_VM_NUM', count(vm[acrn:is-pre-launched-vm(load_order)]), 'U')" /> 58 <xsl:value-of select="acrn:define('SERVICE_VM_NUM', count(vm[acrn:is-service-vm(load_order)]), 'U')" /> 59 <xsl:value-of select="acrn:define('MAX_POST_VM_NUM', hv/CAPACITIES/MAX_VM_NUM - count(vm[acrn:is-pre-launched-vm(load_order)]) - count(vm[acrn:is-service-vm(load_order)]) , 'U')" /> 60 <xsl:value-of select="acrn:define('MAX_TRUSTY_VM_NUM', count(vm[./secure_world_support/text() = 'y']) , 'U')" /> 61 <xsl:value-of select="acrn:define('CONFIG_MAX_VM_NUM', hv/CAPACITIES/MAX_VM_NUM , 'U')" /> 62 </xsl:template> 63 64 <xsl:template name ="sos_vm_bootarges"> 65 <xsl:if test="count(vm[load_order='SERVICE_VM'])"> 66 <xsl:value-of select="acrn:comment(concat('SERVICE_VM == VM', vm[load_order='SERVICE_VM']/@id))" /> 67 <xsl:value-of select="$newline" /> 68 <xsl:value-of select="acrn:define('SERVICE_VM_OS_BOOTARGS', 'SERVICE_VM_ROOTFS SERVICE_VM_IDLE SERVICE_VM_BOOTARGS_DIFF SERVICE_VM_BOOTARGS_MISC', '')" /> 69 </xsl:if> 70 </xsl:template> 71 72</xsl:stylesheet> 73