config_tools: refine console virtual UARTs

As is recommended by UX/DX reviews, the per-VM console virtual UART is now
limited to the following choices:

  - Disabled
  - a COM port from COM1 to COM4
  - PCI based

This patch converts the schema of scenario XMLs to integrate this
recommendation and add logic in the scenario upgrader to migrate data from
old scenario XMLs.

v1 -> v2:

  * Update the static allocators and C source transformers according to the
    new console vUART config item.

Tracked-On: #6690
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao 2022-02-28 23:13:06 +08:00 committed by acrnsi-robot
parent 7ad9596dd6
commit e88532b59d
27 changed files with 169 additions and 899 deletions

View File

@ -179,28 +179,12 @@ with these settings:
the PCI-vUART for the Service VM. Refer to :ref:`Enable vUART Configurations <vuart_config>`
for more details about VUART configuration.
- Edit ``vm.legacy_vuart.base`` in ``legacy_vuart 0`` and set it to ``INVALID_LEGACY_PIO``
- Edit :option:`vm.console_vuart.base` in ``console_vuart 0`` and set it to ``PCI_VUART``
- Set :option:`vm.console_vuart` to ``PCI``
.. code-block:: xml
:emphasize-lines: 3, 14
:emphasize-lines: 1
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>INVALID_COM_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<legacy_vuart id="1">
<type>VUART_LEGACY_PIO</type>
<base>INVALID_COM_BASE</base>
<irq>COM2_IRQ</irq>
<target_vm_id>1</target_vm_id>
<target_uart_id>1</target_uart_id>
</legacy_vuart>
<console_vuart id="0">
<base>PCI_VUART</base>
</console_vuart>
<console_vuart>PCI</console_vuart>
#. Remove CPU sharing VMs

View File

@ -92,14 +92,7 @@
<ramdisk_mod/>
<bootargs/>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
<p2sb>n</p2sb>
@ -132,14 +125,7 @@
quiet loglevel=3 i915.nuclear_pageflip=1 swiotlb=131072
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -158,14 +144,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="3">
@ -182,14 +161,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -105,14 +105,7 @@
idle=poll irqaffinity=0 no_ipi_broadcast=1 reboot=acpi
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>
@ -151,14 +144,7 @@
<ramdisk_mod/>
<bootargs>root=/dev/nvme0n1p3 rw rootwait console=ttyS0,115200n8 ignore_loglevel no_timer_check</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -181,14 +167,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="3">
@ -207,14 +186,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -95,14 +95,7 @@
<bootargs> rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable reboot=acpi
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>
@ -143,14 +136,7 @@
consoleblank=0 tsc=reliable reboot=acpi
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>

View File

@ -77,14 +77,7 @@
<bootargs>root=/dev/nvme0n1p3 rw rootwait console=tty0 console=ttyS0 consoleblank=0 no_timer_check quiet loglevel=3
i915.nuclear_pageflip=1</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -105,14 +98,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
</vm>
<vm id="2">
<load_order>POST_LAUNCHED_VM</load_order>
@ -130,14 +116,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="3">
@ -156,14 +135,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="4">
@ -182,14 +154,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="5">
@ -208,14 +173,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="6">
@ -234,14 +192,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -92,14 +92,7 @@
<ramdisk_mod/>
<bootargs/>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
<p2sb>n</p2sb>
@ -134,14 +127,7 @@
<bootargs>root=/dev/nvme0n1p3 rw rootwait console=tty0 console=ttyS0 consoleblank=0 no_timer_check quiet loglevel=3
i915.nuclear_pageflip=1 swiotlb=131072</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -160,14 +146,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="3">
@ -184,14 +163,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -115,14 +115,7 @@
<ramdisk_mod/>
<bootargs>rw rootwait root=/dev/sda3 no_ipi_broadcast=1 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel consoleblank=0 tsc=reliable clocksource=tsc x2apic_phys processor.max_cstate=0 intel_idle.max_cstate=0 intel_pstate=disable mce=ignore_ce audit=0 isolcpus=nohz,domain,1 nohz_full=1 rcu_nocbs=1 nosoftlockup idle=poll irqaffinity=0 reboot=acpi </bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>
@ -154,14 +147,7 @@
<bootargs>root=/dev/nvme0n1p3 rw rootwait console=tty0 consoleblank=0 no_timer_check quiet loglevel=3
i915.nuclear_pageflip=1 swiotlb=131072</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -182,14 +168,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="3">
@ -206,14 +185,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -95,14 +95,7 @@
<bootargs> rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable reboot=acpi
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>
@ -143,14 +136,7 @@
consoleblank=0 tsc=reliable reboot=acpi
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>

View File

@ -84,14 +84,7 @@
<bootargs>root=/dev/nvme0n1p3 rw rootwait console=tty0 console=ttyS0 consoleblank=0 no_timer_check quiet loglevel=3
i915.nuclear_pageflip=1 swiotlb=131072</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -112,14 +105,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="2">
@ -139,14 +125,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="3">
@ -165,14 +144,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="4">
@ -191,14 +163,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="5">
@ -217,14 +182,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="6">
@ -243,14 +201,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -92,14 +92,7 @@
<ramdisk_mod/>
<bootargs/>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
<p2sb>n</p2sb>
@ -134,14 +127,7 @@
<bootargs>root=/dev/nvme0n1p3 rw rootwait console=tty0 console=ttyS0 consoleblank=0 no_timer_check quiet loglevel=3
i915.nuclear_pageflip=1 swiotlb=131072</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -160,14 +146,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="3">
@ -184,14 +163,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -95,14 +95,7 @@
<bootargs> rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable reboot=acpi
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>
@ -143,14 +136,7 @@
consoleblank=0 tsc=reliable reboot=acpi
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>

View File

@ -96,14 +96,7 @@
<bootargs>rw rootwait root=/dev/nvme0n1p3 console=tty0 console=ttyS0 consoleblank=0 no_timer_check quiet loglevel=3
i915.nuclear_pageflip=1 swiotlb=131072</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -124,14 +117,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="2">
@ -151,14 +137,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="3">
@ -177,14 +156,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="4">
@ -203,14 +175,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="5">
@ -229,14 +194,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="6">
@ -255,14 +213,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -76,14 +76,7 @@
<bootargs>root=/dev/vda1 earlyprintk=serial,ttyS0,115200n8 rw rootwait console=tty0 console=ttyS0 consoleblank=0 no_timer_check ignore_loglevel
ignore_loglevel no_timer_check intel_iommu=off tsc=reliable</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -102,13 +95,6 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>INVALID_COM_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>None</console_vuart>
</vm>
</acrn-config>

View File

@ -92,14 +92,7 @@
<ramdisk_mod/>
<bootargs/>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
<p2sb>n</p2sb>
@ -135,14 +128,7 @@
i915.nuclear_pageflip=1 swiotlb=131072
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -161,14 +147,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="3">
@ -185,14 +164,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -95,14 +95,7 @@
<bootargs> rw rootwait root=/dev/sda3 console=ttyS0 noxsave nohpet no_timer_check ignore_loglevel log_buf_len=16M consoleblank=0 tsc=reliable reboot=acpi
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>
@ -143,14 +136,7 @@
consoleblank=0 tsc=reliable reboot=acpi
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>

View File

@ -97,14 +97,7 @@
i915.nuclear_pageflip=1 swiotlb=131072
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -126,14 +119,7 @@
<size>0</size>
</epc_section>
<priority>PRIO_LOW</priority>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="2">
@ -154,14 +140,7 @@
<size>0</size>
</epc_section>
<priority>PRIO_LOW</priority>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -84,14 +84,7 @@
<ramdisk_mod/>
<bootargs/>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>
@ -124,14 +117,7 @@
<bootargs>root=/dev/sda3 rw rootwait console=tty0 console=ttyS0 consoleblank=0 no_timer_check quiet loglevel=3
i915.nuclear_pageflip=1</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -150,14 +136,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -104,14 +104,7 @@
reboot=acpi
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>
@ -143,14 +136,7 @@
<bootargs>root=/dev/nvme0n1p3 rw rootwait console=tty0 consoleblank=0 no_timer_check quiet loglevel=3
i915.nuclear_pageflip=1</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -171,14 +157,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="3">
@ -195,14 +174,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -89,14 +89,7 @@
reboot=acpi
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>
@ -137,14 +130,7 @@
consoleblank=0 tsc=reliable reboot=acpi
</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<mmio_resources>
<TPM2>n</TPM2>
</mmio_resources>

View File

@ -62,14 +62,7 @@
<bootargs>root=/dev/sda3 rw rootwait console=tty0 console=ttyS0 consoleblank=0 no_timer_check quiet loglevel=3
i915.nuclear_pageflip=1</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -90,14 +83,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>INVALID_COM_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>None</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -76,14 +76,7 @@
<bootargs>root=/dev/nvme0n1p3 rw rootwait console=tty0 console=ttyS0 consoleblank=0 no_timer_check quiet loglevel=3
i915.nuclear_pageflip=1</bootargs>
</os_config>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>SERVICE_VM_COM1_BASE</base>
<irq>SERVICE_VM_COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<pci_devs>
<pci_dev/>
</pci_devs>
@ -104,14 +97,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
</vm>
<vm id="2">
<load_order>POST_LAUNCHED_VM</load_order>
@ -129,14 +115,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="3">
@ -155,14 +134,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="4">
@ -181,14 +153,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="5">
@ -207,14 +172,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
<vm id="6">
@ -233,14 +191,7 @@
<base>0</base>
<size>0</size>
</epc_section>
<legacy_vuart id="0">
<type>VUART_LEGACY_PIO</type>
<base>COM1_BASE</base>
<irq>COM1_IRQ</irq>
</legacy_vuart>
<console_vuart id="0">
<base>INVALID_PCI_BASE</base>
</console_vuart>
<console_vuart>COM Port 1</console_vuart>
<PTM>n</PTM>
</vm>
</acrn-config>

View File

@ -231,13 +231,48 @@ class ScenarioUpgrader(ScenarioTransformer):
self.move_data_by_xpath(".//BUILD_TYPE", xsd_element_node, xml_parent_node, new_nodes)
return False
def move_legacy_vuart(self, xsd_element_node, xml_parent_node, new_nodes):
# Preserve the legacy vuart for console only.
def move_console_vuart(self, xsd_element_node, xml_parent_node, new_nodes):
new_node = etree.Element(xsd_element_node.get("name"))
new_node.text = "None"
new_nodes.append(new_node)
vm_load_order = next(iter(self.get_from_old_data(xml_parent_node, ".//load_order/text()")), None)
legacy_vuart = self.get_from_old_data(xml_parent_node, ".//legacy_vuart[@id = '0']")
if legacy_vuart:
new_nodes.append(legacy_vuart[0])
for child in legacy_vuart[0].iter():
self.old_data_nodes.discard(child)
legacy_vuart = legacy_vuart[0] if legacy_vuart else None
console_vuart = self.get_from_old_data(xml_parent_node, ".//console_vuart")
console_vuart = console_vuart[0] if console_vuart else None
if legacy_vuart is None and console_vuart is None:
return False
if console_vuart is not None and console_vuart.text:
new_node.text = console_vuart.text
elif legacy_vuart is not None and legacy_vuart.find("type").text == "VUART_LEGACY_PIO":
vuart_base = legacy_vuart.find("base").text
if vuart_base == "CONFIG_COM_BASE":
# The new schema does not support arbitrary configuration of console vUART bases. Report the data as lost.
return False
elif vuart_base.endswith("COM1_BASE"):
new_node.text = "COM Port 1"
elif vuart_base.endswith("COM2_BASE"):
new_node.text = "COM Port 2"
elif vuart_base.endswith("COM3_BASE"):
new_node.text = "COM Port 3"
elif vuart_base.endswith("COM4_BASE"):
new_node.text = "COM Port 4"
if vm_load_order == "SERVICE_VM":
logging.info(f"The console virtual UART of the service VM is moved to {new_node.text}. Please double check the console= command line option in the OS bootargs of the service VM.")
elif console_vuart is not None and console_vuart.find("base") != "INVALID_PCI_BASE":
new_node.text = "PCI"
if legacy_vuart is not None:
for n in legacy_vuart.iter():
self.old_data_nodes.discard(n)
if console_vuart is not None:
for n in console_vuart.iter():
self.old_data_nodes.discard(n)
return False
def move_vuart_connections(self, xsd_element_node, xml_parent_node, new_nodes):
@ -369,7 +404,7 @@ class ScenarioUpgrader(ScenarioTransformer):
"security_vm": partialmethod(move_guest_flag, "GUEST_FLAG_SECURITY_VM"),
"BUILD_TYPE": move_build_type,
"legacy_vuart": move_legacy_vuart,
"console_vuart": move_console_vuart,
"vuart_connections": move_vuart_connections,
"IVSHMEM": move_ivshmem,
"vm_type": move_vm_type,

View File

@ -177,6 +177,17 @@ must exactly match the module tag in the GRUB multiboot cmdline.</xs:documentati
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="ConsoleVuartConfiguration">
<xs:restriction base="xs:string">
<xs:enumeration value="None" />
<xs:enumeration value="COM Port 1" />
<xs:enumeration value="COM Port 2" />
<xs:enumeration value="COM Port 3" />
<xs:enumeration value="COM Port 4" />
<xs:enumeration value="PCI" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="VuartType">
<xs:annotation>
<xs:documentation>vCOM type</xs:documentation>
@ -209,141 +220,6 @@ must exactly match the module tag in the GRUB multiboot cmdline.</xs:documentati
</xs:sequence>
</xs:complexType>
<xs:simpleType name="LegacyVuartType">
<xs:annotation acrn:configurable="n">
<xs:documentation>vCOM type</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="VUART_LEGACY_PIO" />
<xs:enumeration value="VUART_PCI" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LegacyVuartBase">
<xs:annotation>
<xs:documentation>A string with either ``SERVICE_VM_COM1_BASE``,
``SERVICE_VM_COM2_BASE``, ``SERVICE_VM_COM3_BASE``, ``SERVICE_VM_COM4_BASE``,
``COM1_BASE``, ``COM2_BASE``, ``COM3_BASE``, ``COM4_BASE``,
``CONFIG_COM_BASE``, or indicating it's disabled with ``INVALID_COM_BASE``.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="SERVICE_VM_COM1_BASE" />
<xs:enumeration value="SERVICE_VM_COM2_BASE" />
<xs:enumeration value="SERVICE_VM_COM3_BASE" />
<xs:enumeration value="SERVICE_VM_COM4_BASE" />
<xs:enumeration value="COM1_BASE" />
<xs:enumeration value="COM2_BASE" />
<xs:enumeration value="COM3_BASE" />
<xs:enumeration value="COM4_BASE" />
<xs:enumeration value="CONFIG_COM_BASE" />
<xs:enumeration value="INVALID_COM_BASE" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="LegacyVuartIrq">
<xs:annotation acrn:configurable="n">
<xs:documentation>A string with either ``SERVICE_VM_COM1_IRQ``,
``SERVICE_VM_COM2_IRQ``, ``SERVICE_VM_COM3_IRQ``, ``SERVICE_VM_COM4_IRQ``,
``COM1_IRQ``, ``COM2_IRQ``, ``COM3_IRQ``, ``COM4_IRQ``,
``CONFIG_COM_IRQ`` or ``0``. If ``0`` is set, the vuart will
use polling mode.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="SERVICE_VM_COM1_IRQ" />
<xs:enumeration value="SERVICE_VM_COM2_IRQ" />
<xs:enumeration value="SERVICE_VM_COM3_IRQ" />
<xs:enumeration value="SERVICE_VM_COM4_IRQ" />
<xs:enumeration value="COM1_IRQ" />
<xs:enumeration value="COM2_IRQ" />
<xs:enumeration value="COM3_IRQ" />
<xs:enumeration value="COM4_IRQ" />
<xs:enumeration value="CONFIG_COM_IRQ" />
<xs:enumeration value="0" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="LegacyVuartConfiguration">
<xs:sequence>
<xs:element name="type" type="LegacyVuartType" default="VUART_LEGACY_PIO">
<xs:annotation>
<xs:documentation>vUART (COM) type; only legacy PIO mode is
supported.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="base" type="LegacyVuartBase">
<xs:annotation>
<xs:documentation>vUART (COM) enabling switch. Enable by exposing its COM_BASE
(e.b., ``SERVICE_VM_COM1_BASE`` for Service VM); disable by returning
``INVALID_COM_BASE``.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="irq" type="LegacyVuartIrq">
<xs:annotation>
<xs:documentation>vCOM IRQ.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="target_vm_id" type="xs:integer" default="1" minOccurs="0">
<xs:annotation>
<xs:documentation>COM2 is used for VM communications. When it is enabled, specify which
target VM the current VM connects to.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="target_uart_id" type="xs:integer" default="1" minOccurs="0">
<xs:annotation>
<xs:documentation>Target vUART ID to which the vCOM2 connects.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:integer" use="required"/>
</xs:complexType>
<xs:simpleType name="PCIVuartBase">
<xs:annotation>
<xs:documentation>A string with ``PCI_VUART`` or indicating its
disabled using ``INVALID_PCI_BASE``.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="PCI_VUART" />
<xs:enumeration value="INVALID_PCI_BASE" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="ConsoleVuartConfiguration">
<xs:sequence>
<xs:element name="base" type="PCIVuartBase" default="INVALID_PCI_BASE">
<xs:annotation>
<xs:documentation>Console vUART (A.K.A PCI based vUART) enabling switch.
Enable by specifying PCI_VUART; disable by specifying
``INVALID_PCI_BASE``.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:integer" use="required" />
</xs:complexType>
<xs:complexType name="CommunicationVuartConfiguration">
<xs:sequence>
<xs:element name="base" type="PCIVuartBase" default="INVALID_PCI_BASE">
<xs:annotation>
<xs:documentation>Communication vUART (A.K.A PCI based vUART) enabling switch.
Enable by specifying PCI_VUART; disable by specifying
``INVALID_PCI_BASE``.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="target_vm_id" type="xs:integer">
<xs:annotation>
<xs:documentation>specify which target VM the current VM connects to.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="target_uart_id" type="xs:integer">
<xs:annotation>
<xs:documentation>Target vUART ID to which the ``communication_vuart`` connects.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:integer" use="required" />
</xs:complexType>
<xs:complexType name="MMIOResourcesConfiguration">
<xs:sequence>
<xs:element name="TPM2" type="Boolean" default="n" minOccurs="0">

View File

@ -400,13 +400,7 @@ Refer SDM 17.19.2 for details, and use with caution.</xs:documentation>
argument and memory.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="legacy_vuart" type="LegacyVuartConfiguration" minOccurs="1" maxOccurs="8">
<xs:annotation>
<xs:documentation>Specify the vUART (aka COM) with the vUART ID by its ``id`` attribute.
Refer to :ref:`vuart_config` for detailed vUART settings.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="console_vuart" type="ConsoleVuartConfiguration">
<xs:element name="console_vuart" type="ConsoleVuartConfiguration" default="None">
<xs:annotation>
<xs:documentation>Specify the console vUART (aka PCI based vUART) with the vUART ID by
its ``id`` attribute.</xs:documentation>

View File

@ -50,51 +50,6 @@ def create_vuart_irq_node(etree, vm_id, load_order, vuart_id, irq):
common.append_node(f"./legacy_vuart[@id = '{vuart_id}']/irq", irq, allocation_vm_node)
def assign_legacy_vuart_irqs(vm_node, legacy_vuart_id, irq_list):
legacy_vuart_node_irq_text = common.get_node(f"legacy_vuart[@id = '{legacy_vuart_id}']/irq/text()", vm_node)
legacy_vuart_irq = ''
if legacy_vuart_node_irq_text == 'COM1_IRQ' or legacy_vuart_node_irq_text == 'SERVICE_VM_COM1_IRQ' \
or legacy_vuart_node_irq_text == 'COM3_IRQ' or legacy_vuart_node_irq_text == 'SERVICE_VM_COM3_IRQ':
legacy_vuart_irq = '4'
if legacy_vuart_irq in irq_list:
remove_irq(irq_list, legacy_vuart_irq)
elif legacy_vuart_node_irq_text == 'COM2_IRQ' or legacy_vuart_node_irq_text == 'SERVICE_VM_COM2_IRQ' \
or legacy_vuart_node_irq_text == 'COM4_IRQ' or legacy_vuart_node_irq_text == 'SERVICE_VM_COM4_IRQ':
legacy_vuart_irq = '3'
if legacy_vuart_irq in irq_list:
remove_irq(irq_list, legacy_vuart_irq)
elif legacy_vuart_node_irq_text == '0':
legacy_vuart_irq = '0'
else:
legacy_vuart_irq = alloc_irq(irq_list)
return legacy_vuart_irq
def alloc_legacy_vuart_irqs(board_etree, scenario_etree, allocation_etree):
native_ttys = lib.lib.get_native_ttys()
hv_debug_console = lib.lib.parse_hv_console(scenario_etree)
vm_node_list = scenario_etree.xpath("//vm")
for vm_node in vm_node_list:
load_order = common.get_node("./load_order/text()", vm_node)
irq_list = get_native_valid_irq() if load_order == "SERVICE_VM" else [f"{d}" for d in list(range(1,15))]
legacy_vuart_id_list = vm_node.xpath("legacy_vuart[base != 'INVALID_COM_BASE']/@id")
legacy_vuart_irq = ''
for legacy_vuart_id in legacy_vuart_id_list:
if legacy_vuart_id == '0' and load_order == "SERVICE_VM":
if hv_debug_console in native_ttys.keys():
if native_ttys[hv_debug_console]['irq'] < LEGACY_IRQ_MAX:
legacy_vuart_irq = native_ttys[hv_debug_console]['irq']
if legacy_vuart_irq in irq_list:
remove_irq(irq_list, legacy_vuart_irq)
else:
legacy_vuart_irq = assign_legacy_vuart_irqs(vm_node, legacy_vuart_id, irq_list)
else:
raise lib.error.ResourceError(f"{hv_debug_console} is not in the native environment! The ttyS available are: {native_ttys.keys()}")
else:
legacy_vuart_irq = assign_legacy_vuart_irqs(vm_node, legacy_vuart_id, irq_list)
create_vuart_irq_node(allocation_etree, common.get_node("./@id", vm_node), load_order, legacy_vuart_id, legacy_vuart_irq)
def alloc_vuart_connection_irqs(board_etree, scenario_etree, allocation_etree):
native_ttys = lib.lib.get_native_ttys()
hv_debug_console = lib.lib.parse_hv_console(scenario_etree)
@ -250,6 +205,5 @@ def alloc_device_irqs(board_etree, scenario_etree, allocation_etree):
pt_intx_node.text += f" ({irq}, {virq})"
def fn(board_etree, scenario_etree, allocation_etree):
alloc_legacy_vuart_irqs(board_etree, scenario_etree, allocation_etree)
alloc_vuart_connection_irqs(board_etree, scenario_etree, allocation_etree)
alloc_device_irqs(board_etree, scenario_etree, allocation_etree)

View File

@ -9,63 +9,10 @@ import sys, os, logging
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'library'))
import common, lib.lib, lib.error
def alloc_pio(pio_list):
try:
base = pio_list[0]
remove_pio(pio_list, base)
return base
except IndexError as e:
raise lib.error.ResourceError("Cannot allocate a pio base, the available pio base list:{}, {}".format(e, pio_list))
def remove_pio(pio_list, base):
try:
pio_list.remove(base)
except ValueError as e:
raise ValueError("Cannot remove a pio base:{} from the available pio base list:{}, {}". format(base, e, pio_list)) from e
def assign_legacy_vuart_io_port(vm_node, legacy_vuart_id):
legacy_vuart_base = ""
legacy_vuart_node_base_text = common.get_node(f"./legacy_vuart[@id = '{legacy_vuart_id}']/base/text()", vm_node)
if legacy_vuart_node_base_text == 'COM1_BASE' or legacy_vuart_node_base_text == 'SERVICE_VM_COM1_BASE':
legacy_vuart_base = '0x3F8'
elif legacy_vuart_node_base_text == 'COM2_BASE' or legacy_vuart_node_base_text == 'SERVICE_VM_COM2_BASE':
legacy_vuart_base = '0x2F8'
elif legacy_vuart_node_base_text == 'COM3_BASE' or legacy_vuart_node_base_text == 'SERVICE_VM_COM3_BASE':
legacy_vuart_base = '0x3E8'
elif legacy_vuart_node_base_text == 'COM4_BASE' or legacy_vuart_node_base_text == 'SERVICE_VM_COM4_BASE':
legacy_vuart_base = '0x2E8'
return legacy_vuart_base
def create_vuart_base_node(etree, vm_id, vuart_id, vuart_base):
vm_node = common.get_node(f"/acrn-config/vm[@id = '{vm_id}']", etree)
if vm_node is None:
vm_node = common.append_node("/acrn-config/vm", None, etree, id = vm_id)
vuart_node = common.get_node(f"./legacy_vuart[@id = '{vuart_id}']", vm_node)
if vuart_node is None:
vuart_node = common.append_node("./legacy_vuart", None, vm_node, id = vuart_id)
if common.get_node(f"./base", vuart_node) is None:
common.append_node(f"./base", vuart_base, vuart_node)
def fn(board_etree, scenario_etree, allocation_etree):
native_ttys = lib.lib.get_native_ttys()
hv_debug_console = lib.lib.parse_hv_console(scenario_etree)
vm_node_list = scenario_etree.xpath("//vm")
for vm_node in vm_node_list:
load_order = common.get_node("./load_order/text()", vm_node)
legacy_vuart_base = ""
legacy_vuart_id_list = vm_node.xpath("legacy_vuart[base != 'INVALID_COM_BASE']/@id")
for legacy_vuart_id in legacy_vuart_id_list:
if legacy_vuart_id == '0' and load_order == "SERVICE_VM":
if hv_debug_console in native_ttys.keys():
if native_ttys[hv_debug_console]['type'] == "portio":
legacy_vuart_base = native_ttys[hv_debug_console]['base']
else:
legacy_vuart_base = assign_legacy_vuart_io_port(vm_node, legacy_vuart_id)
else:
raise lib.error.ResourceError(f"{hv_debug_console} is not in the native environment! The ttyS available are: {native_ttys.keys()}")
else:
legacy_vuart_base = assign_legacy_vuart_io_port(vm_node, legacy_vuart_id)
if legacy_vuart_base != "":
create_vuart_base_node(allocation_etree, common.get_node("./@id", vm_node), legacy_vuart_id, legacy_vuart_base)
# With the console vUART explicitly specified as COM port and communication vUART with explicit I/O port base
# addresses, there is no need to allocate any port I/O for now.
#
# This allocator is preserved here, though, as the implicit vUART connections for system-level power management,
# which has to be port I/O based and are to be added later, will need I/O port allocation again.
pass

View File

@ -102,7 +102,7 @@
<xsl:apply-templates select="memory" />
<xsl:apply-templates select="os_config" />
<xsl:call-template name="acpi_config" />
<xsl:call-template name="legacy_vuart" />
<xsl:apply-templates select="console_vuart" />
<xsl:call-template name="vuart_connection" />
<xsl:call-template name="pci_dev_num" />
<xsl:call-template name="pci_devs" />
@ -246,23 +246,35 @@
</xsl:if>
</xsl:template>
<xsl:template name="legacy_vuart">
<xsl:variable name="vm_id" select="@id" />
<xsl:for-each select="legacy_vuart">
<xsl:variable name="vuart_id" select="@id" />
<xsl:value-of select="acrn:initializer(concat('vuart[', $vuart_id, ']'), '{', true())" />
<xsl:value-of select="acrn:initializer('type', type)" />
<xsl:if test="base != 'INVALID_COM_BASE'">
<xsl:value-of select="acrn:initializer('addr.port_base', concat(../../../../allocation-data/acrn-config/vm[@id=$vm_id]/legacy_vuart[@id=$vuart_id]/base, 'U'))" />
<xsl:value-of select="acrn:initializer('irq', concat(../../../../allocation-data/acrn-config/vm[@id=$vm_id]/legacy_vuart[@id=$vuart_id]/irq, 'U'))" />
<xsl:if test="@id != '0'">
<xsl:value-of select="acrn:initializer('t_vuart.vm_id', concat(target_vm_id, 'U'))" />
<xsl:value-of select="acrn:initializer('t_vuart.vuart_id', concat(target_uart_id, 'U'))" />
</xsl:if>
</xsl:if>
<xsl:text>},</xsl:text>
<xsl:value-of select="$newline" />
</xsl:for-each>
<xsl:template match="console_vuart">
<xsl:value-of select="acrn:initializer('vuart[0]', '{', true())" />
<xsl:choose>
<xsl:when test="./text() = 'COM Port 1'">
<xsl:value-of select="acrn:initializer('type', 'VUART_LEGACY_PIO')" />
<xsl:value-of select="acrn:initializer('addr.port_base', '0x3F8U')" />
<xsl:value-of select="acrn:initializer('irq', '4U')" />
</xsl:when>
<xsl:when test="./text() = 'COM Port 2'">
<xsl:value-of select="acrn:initializer('type', 'VUART_LEGACY_PIO')" />
<xsl:value-of select="acrn:initializer('addr.port_base', '0x2F8U')" />
<xsl:value-of select="acrn:initializer('irq', '3U')" />
</xsl:when>
<xsl:when test="./text() = 'COM Port 3'">
<xsl:value-of select="acrn:initializer('type', 'VUART_LEGACY_PIO')" />
<xsl:value-of select="acrn:initializer('addr.port_base', '0x3E8U')" />
<xsl:value-of select="acrn:initializer('irq', '4U')" />
</xsl:when>
<xsl:when test="./text() = 'COM Port 4'">
<xsl:value-of select="acrn:initializer('type', 'VUART_LEGACY_PIO')" />
<xsl:value-of select="acrn:initializer('addr.port_base', '0x2E8U')" />
<xsl:value-of select="acrn:initializer('irq', '3U')" />
</xsl:when>
<xsl:when test="./text() = 'PCI'">
<xsl:value-of select="acrn:initializer('type', 'VUART_PCI')" />
</xsl:when>
</xsl:choose>
<xsl:text>},</xsl:text>
<xsl:value-of select="$newline" />
</xsl:template>
<xsl:template name="vuart_connection">