acrn-hypervisor/misc/config_tools/xforms/board_info.h.xsl
Junjie Mao b5b22bf98b board_inspector: avoid hard-coded topo level names
While the terms to refer to CPU topology levels are originally borrowed
from MSR listings in SDMs (i.e. thread, core, die and package), we now
align the topology information with the CPUID topology enumeration
leaf (which does not have a "package" level) in the
implementation. However, some hard-coded level types are not updated
accordingly, leading to strangely organized nodes in the generated board
XML.

This patch refines the CPU extractor of the board inspector by removing
such hard code. Also the XPATH counting the total number of threads is
refined to tolerate the variance of reported intermediate levels.

Tracked-On: #6689
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-01-29 11:54:03 +08:00

81 lines
3.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 Intel Corporation. -->
<!-- SPDX-License-Identifier: BSD-3-Clause -->
<xsl:stylesheet
version="1.0"
xmlns:xi="http://www.w3.org/2003/XInclude"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dyn="http://exslt.org/dynamic"
xmlns:math="http://exslt.org/math"
xmlns:acrn="http://projectacrn.org">
<xsl:include href="lib.xsl" />
<xsl:output method="text" />
<xsl:template match="/acrn-offline-data">
<!-- Declaration of license -->
<xsl:value-of select="$license" />
<!-- Header include guard -->
<xsl:value-of select="acrn:include-guard('BOARD_INFO_H')" />
<xsl:apply-templates select="config-data/acrn-config" />
<xsl:apply-templates select="board-data/acrn-config" />
<xsl:apply-templates select="allocation-data/acrn-config" />
<xsl:value-of select="acrn:include-guard-end('BOARD_INFO_H')" />
</xsl:template>
<xsl:template match="config-data/acrn-config">
<xsl:if test="count(//p2sb[text() = 'y'])">
<xsl:call-template name="p2sb" />
</xsl:if>
<xsl:call-template name="MAX_HIDDEN_PDEVS_NUM" />
</xsl:template>
<xsl:template match="board-data/acrn-config">
<xsl:call-template name="MAX_PCPU_NUM" />
<xsl:call-template name="MAX_VMSIX_ON_MSI_PDEVS_NUM" />
<xsl:variable name="physical_address_bits" select="//processors/model/attribute[@id='physical_address_bits']/text()" />
<xsl:if test="$physical_address_bits">
<xsl:value-of select="acrn:define('MAXIMUM_PA_WIDTH', $physical_address_bits[1], 'U')" />
</xsl:if>
</xsl:template>
<xsl:template match="allocation-data/acrn-config">
<xsl:apply-templates select="hv/MMIO" />
</xsl:template>
<xsl:template name="p2sb">
<xsl:value-of select="acrn:define('P2SB_VGPIO_DM_ENABLED', '', '')" />
<xsl:value-of select="acrn:define('P2SB_BAR_ADDR', '0xFD000000', 'UL')" />
<xsl:value-of select="acrn:define('P2SB_BAR_ADDR_GPA', '0xFD000000', 'UL')" />
<xsl:value-of select="acrn:define('P2SB_BAR_SIZE', '0x1000000', 'UL')" />
<xsl:value-of select="acrn:define('P2SB_BASE_GPIO_PORT_ID', '0x69', 'U')" />
<xsl:value-of select="acrn:define('P2SB_MAX_GPIO_COMMUNITIES', '0x6', 'U')" />
</xsl:template>
<xsl:template name="MAX_HIDDEN_PDEVS_NUM">
<xsl:value-of select="acrn:define('MAX_HIDDEN_PDEVS_NUM', acrn:get-hidden-device-num(), 'U')" />
</xsl:template>
<xsl:template name="MAX_PCPU_NUM">
<xsl:value-of select="acrn:define('MAX_PCPU_NUM', count(//processors//thread), 'U')" />
</xsl:template>
<xsl:template name="MAX_VMSIX_ON_MSI_PDEVS_NUM">
<xsl:value-of select="acrn:define('MAX_VMSIX_ON_MSI_PDEVS_NUM', sum(dyn:map(//device, 'acrn:is-vmsix-supported-device(./vendor, ./identifier)')), 'U')" />
</xsl:template>
<xsl:template match="MMIO">
<xsl:value-of select="acrn:define('MMIO32_START', //MMIO32_START, 'UL')" />
<xsl:value-of select="acrn:define('MMIO32_END', //MMIO32_END, 'UL')" />
<xsl:value-of select="acrn:define('MMIO64_START', //MMIO64_START, 'UL')" />
<xsl:value-of select="acrn:define('MMIO64_END', //MMIO64_END, 'UL')" />
<xsl:value-of select="acrn:define('HI_MMIO_START', //HI_MMIO_START, 'UL')" />
<xsl:value-of select="acrn:define('HI_MMIO_END', //HI_MMIO_END, 'UL')" />
</xsl:template>
</xsl:stylesheet>