mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-19 09:53:01 +00:00
config-tools: allow SERIAL_CONSOLE to use any native ttyS#
Remove the restriction that SERIAL_CONSOLE needs to be ttys0, ttys1, ttys2 or ttys3. 1. Lossen the restriction in xsd. 2. Rewrite the document. 3. Refine the intx.py. Refine the logic which take effect if the <irq> is specified in "SOS_COM#_IRQ" for SOS VM's legacy vuart 0. Tracked-On: #6610 Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
This commit is contained in:
parent
c8e2060d37
commit
4ca2b3a860
@ -29,8 +29,8 @@ This option impacts the content of ``vm.(legacy_vuart id="0").base`` when :optio
|
||||
which specifies the PIO base for Service VM legacy vUART 0 (used for the console).
|
||||
The PIO base for the Service VM's legacy vUART 0 is determined using these rules:
|
||||
|
||||
- If :option:`hv.DEBUG_OPTIONS.SERIAL_CONSOLE` is ``ttys0``, ``ttys1``, ``ttys2``, or ``ttys3`` and it is a PIO in the
|
||||
native environment, the PIO base of the Service VM legacy vUART 0 would be the same as the PIO base
|
||||
- If :option:`hv.DEBUG_OPTIONS.SERIAL_CONSOLE` is any available ttyS# in the native environment,
|
||||
the PIO base of the Service VM legacy vUART 0 would be the same as the PIO base
|
||||
corresponding to :option:`hv.DEBUG_OPTIONS.SERIAL_CONSOLE` in the native environment.
|
||||
- Otherwise, a PIO base would be assigned to the Service VM legacy vUART 0 from the available PIO list.
|
||||
|
||||
|
@ -142,7 +142,7 @@ Read more about the available scheduling options in :ref:`cpu_sharing`.</xs:docu
|
||||
|
||||
<xs:simpleType name="SerialConsoleType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value=".*ttyS[0-3]" />
|
||||
<xs:pattern value=".*ttyS[\d]+" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
|
||||
|
@ -50,6 +50,23 @@ def create_vuart_irq_node(etree, vm_id, vm_type, 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 == 'SOS_COM1_IRQ' \
|
||||
or legacy_vuart_node_irq_text == 'COM3_IRQ' or legacy_vuart_node_irq_text == 'SOS_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 == 'SOS_COM2_IRQ' \
|
||||
or legacy_vuart_node_irq_text == 'COM4_IRQ' or legacy_vuart_node_irq_text == 'SOS_COM4_IRQ':
|
||||
legacy_vuart_irq = '3'
|
||||
if legacy_vuart_irq in irq_list:
|
||||
remove_irq(irq_list, legacy_vuart_irq)
|
||||
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)
|
||||
@ -59,7 +76,7 @@ def alloc_legacy_vuart_irqs(board_etree, scenario_etree, allocation_etree):
|
||||
vm_type = common.get_node("./vm_type/text()", vm_node)
|
||||
irq_list = get_native_valid_irq() if vm_type == "SOS_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 = -1
|
||||
legacy_vuart_irq = ''
|
||||
for legacy_vuart_id in legacy_vuart_id_list:
|
||||
if legacy_vuart_id == '0' and vm_type == "SOS_VM":
|
||||
if hv_debug_console in native_ttys.keys():
|
||||
@ -68,23 +85,11 @@ def alloc_legacy_vuart_irqs(board_etree, scenario_etree, allocation_etree):
|
||||
if legacy_vuart_irq in irq_list:
|
||||
remove_irq(irq_list, legacy_vuart_irq)
|
||||
else:
|
||||
legacy_vuart_irq = alloc_irq(irq_list)
|
||||
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_node_irq_text = common.get_node(f"legacy_vuart[@id = '{legacy_vuart_id}']/irq/text()", vm_node)
|
||||
if legacy_vuart_node_irq_text == 'COM1_IRQ' or legacy_vuart_node_irq_text == 'SOS_COM1_IRQ' \
|
||||
or legacy_vuart_node_irq_text == 'COM3_IRQ' or legacy_vuart_node_irq_text == 'SOS_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 == 'SOS_COM2_IRQ' \
|
||||
or legacy_vuart_node_irq_text == 'COM4_IRQ' or legacy_vuart_node_irq_text == 'SOS_COM4_IRQ':
|
||||
legacy_vuart_irq = '3'
|
||||
if legacy_vuart_irq in irq_list:
|
||||
remove_irq(irq_list, legacy_vuart_irq)
|
||||
else:
|
||||
legacy_vuart_irq = alloc_irq(irq_list)
|
||||
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), vm_type, legacy_vuart_id, legacy_vuart_irq)
|
||||
|
||||
|
@ -7,3 +7,6 @@
|
||||
|
||||
class ResourceError(Exception):
|
||||
"""Raise this error when it is out of resource"""
|
||||
|
||||
class SettingError(Exception):
|
||||
"""Raise this error when manual scenario configuration has a conflict with board information"""
|
@ -7,7 +7,7 @@
|
||||
|
||||
import sys, os, logging
|
||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'library'))
|
||||
import common, lib.lib
|
||||
import common, lib.lib, lib.error
|
||||
|
||||
def alloc_pio(pio_list):
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user