config_tools: support vUART Timer pCPU configuration

This patch is to allow user to pin vUART timer to specific pCPU via ACRN
config tool. User can configure by setting "vUART timer pCPU ID" under
Hypervisor->Advanced Parameters.

Tracked-On: #8648
Signed-off-by: Haiwei Li <haiwei.li@intel.com>
This commit is contained in:
Haiwei Li 2024-07-04 17:14:13 +08:00 committed by acrnsi-robot
parent f47b2b6860
commit 529ade37a4
7 changed files with 34 additions and 6 deletions

View File

@ -47,6 +47,9 @@ static void init_debug_post(uint16_t pcpu_id)
if (pcpu_id == BSP_CPU_ID) {
/* Initialize the shell */
shell_init();
}
if (pcpu_id == VUART_TIMER_CPU) {
console_setup_timer();
}

View File

@ -211,7 +211,7 @@ void console_setup_timer(void)
}
/* When lapic-pt is enabled for a vcpu working on the pcpu hosting
* console timer (currently BSP), we utilize vm-exits to drive the console.
* console timer, we utilize vm-exits to drive the console.
*
* Note that currently this approach will result in a laggy shell when
* the number of VM-exits/second is low (which is mostly true when lapic-pt is
@ -222,8 +222,7 @@ void console_vmexit_callback(struct acrn_vcpu *vcpu)
static uint64_t prev_tsc = 0;
uint64_t tsc;
/* console_setup_timer is called on BSP only. */
if ((pcpuid_from_vcpu(vcpu) == BSP_CPU_ID) && (is_lapic_pt_enabled(vcpu))) {
if ((pcpuid_from_vcpu(vcpu) == VUART_TIMER_CPU) && (is_lapic_pt_enabled(vcpu))) {
tsc = cpu_ticks();
if (tsc - prev_tsc > (TICKS_PER_MS * CONSOLE_KICK_TIMER_TIMEOUT)) {
console_timer_callback(NULL);
@ -234,10 +233,14 @@ void console_vmexit_callback(struct acrn_vcpu *vcpu)
void suspend_console(void)
{
del_timer(&console_timer);
if (VUART_TIMER_CPU == BSP_CPU_ID) {
del_timer(&console_timer);
}
}
void resume_console(void)
{
console_setup_timer();
if (VUART_TIMER_CPU == BSP_CPU_ID) {
console_setup_timer();
}
}

View File

@ -34,6 +34,7 @@
#define RX_BUF_SIZE CONFIG_VUART_RX_BUF_SIZE
#define TX_BUF_SIZE CONFIG_VUART_TX_BUF_SIZE
#define VUART_TIMER_CPU CONFIG_VUART_TIMER_PCPU
#define INVAILD_VUART_IDX 0xFFU
#define COM1_BASE 0x3F8U

File diff suppressed because one or more lines are too long

View File

@ -53,4 +53,11 @@
</xs:annotation>
</xs:assert>
<xs:assert test="every $pcpu in /acrn-config/vm[lapic_passthrough = 'y']//cpu_affinity//pcpu_id satisfies
count(/acrn-config[.//VUART_TIMER_PCPU=$pcpu]) = 0">
<xs:annotation acrn:severity="warning" acrn:report-on="//VUART_TIMER_PCPU">
<xs:documentation>Physical CPU "{//VUART_TIMER_PCPU}" hosting vUART timer is assigned to a lapic passthrough VM. The console may be laggy.</xs:documentation>
</xs:annotation>
</xs:assert>
</xs:schema>

View File

@ -154,6 +154,16 @@ If your VM is not a security VM, leave this option unchecked. </xs:documentation
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="VUART_TIMER_PCPU" type="xs:integer" default="0">
<xs:annotation acrn:title="vUART timer pCPU ID" acrn:views="advanced"
acrn:options="//processors//thread/cpu_id/text()"
acrn:option-names="if (count(distinct-values(//processors//thread/core_type)) &gt; 1)
then (for $thread in //processors//thread return concat($thread/cpu_id, ' (', if ($thread/core_type = 'Core') then 'P-Core' else 'E-Core', ')'))
else //processors//thread/cpu_id/text()"
acrn:options-sorted-by="int">
<xs:documentation>pCPU ID of the vUART timer is allowed to pin to.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="RDT" type="RDTType">
<xs:annotation acrn:title="Intel Resource Director Tech" acrn:views="">
<xs:documentation>Intel Resource Director Technology (RDT) provides cache and memory bandwidth allocation features. The features can be used to improve an application's real-time performance.</xs:documentation>

View File

@ -166,6 +166,10 @@
<xsl:call-template name="integer-by-key">
<xsl:with-param name="key" select="'VUART_TX_BUF_SIZE'" />
</xsl:call-template>
<xsl:call-template name="integer-by-key">
<xsl:with-param name="key" select="'VUART_TIMER_PCPU'" />
</xsl:call-template>
</xsl:template>
<xsl:template match="MEMORY">