mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 01:07:57 +00:00
vUART: change S5 vUART resource
This patch is to change the vUART resource occupied by S5 function between Service VM and guest VM to avoid the standard UART port conflict when legacy UART passthrough to guest VM. Tracked-On: #8622 Signed-off-by: YuanXin-Intel <xin.yuan@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com> Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
This commit is contained in:
committed by
acrnsi-robot
parent
87dffcbc92
commit
e4429d632b
@@ -74,6 +74,9 @@ def alloc_vuart_connection_irqs(board_etree, scenario_etree, allocation_etree):
|
||||
remove_irq(irq_list, 3)
|
||||
if 4 in irq_list:
|
||||
remove_irq(irq_list, 4)
|
||||
else:
|
||||
if 14 in irq_list:
|
||||
remove_irq(irq_list, 14)
|
||||
vuart_id = 1
|
||||
legacy_vuart_irq = "0"
|
||||
vmname = get_node("./name/text()", vm_node)
|
||||
@@ -97,7 +100,7 @@ def alloc_vuart_connection_irqs(board_etree, scenario_etree, allocation_etree):
|
||||
vuart_id = vuart_id + 1
|
||||
# Allocate irq for S5 vuart, we have to use the irq of COM2
|
||||
if load_order != "SERVICE_VM":
|
||||
legacy_vuart_irq = alloc_standard_irq("0x2F8")
|
||||
legacy_vuart_irq = alloc_irq(irq_list)
|
||||
create_vuart_irq_node(allocation_etree, get_node("./@id", vm_node), load_order, str(vuart_id), legacy_vuart_irq)
|
||||
vuart_id = vuart_id + 1
|
||||
|
||||
|
@@ -8,9 +8,11 @@
|
||||
import sys
|
||||
import acrn_config_utilities, lib.error
|
||||
from acrn_config_utilities import get_node
|
||||
from collections import defaultdict
|
||||
|
||||
# The COM1 was used for console vUART, so we alloc io_port frome COM2~COM4
|
||||
service_port_list = list(range(0x9000, 0x9100, 8))
|
||||
val = lambda:list(range(0x9000, 0x9100, 8))
|
||||
vm_port_list = defaultdict(val)
|
||||
|
||||
def create_s5_vuart_connection(allocation_etree, service_vm_name, service_vm_port, user_vm_name, user_vm_port):
|
||||
vuart_connections_node = get_node(f"/acrn-config/hv/vuart_connections", allocation_etree)
|
||||
@@ -49,23 +51,25 @@ def get_console_vuart_port(scenario_etree, vm_name):
|
||||
|
||||
def alloc_free_port(scenario_etree, load_order, vm_name):
|
||||
port_list = scenario_etree.xpath(f"//endpoint[vm_name = '{vm_name}']/io_port/text()")
|
||||
if load_order == "SERVICE_VM":
|
||||
vm_id = int(get_node(f"//vm[load_order = 'SERVICE_VM']/@id", scenario_etree))
|
||||
else:
|
||||
vm_id = int(get_node(f"//vm[name = '{vm_name}']/@id", scenario_etree))
|
||||
console_port = get_console_vuart_port(scenario_etree, vm_name)
|
||||
if console_port is not None:
|
||||
port_list.append(console_port.replace("U", ""))
|
||||
|
||||
tmp_list = []
|
||||
for port in port_list:
|
||||
tmp_list.append(int(port, 16))
|
||||
|
||||
if load_order == "SERVICE_VM":
|
||||
tmp_list = []
|
||||
for port in port_list:
|
||||
tmp_list.append(int(port, 16))
|
||||
|
||||
global service_port_list
|
||||
service_port_list = list(set(service_port_list) - set(tmp_list))
|
||||
service_port_list.sort()
|
||||
port = hex(service_port_list[0])
|
||||
service_port_list.remove(service_port_list[0])
|
||||
return str(port).upper()
|
||||
else:
|
||||
return "0x2F8"
|
||||
global vm_port_list
|
||||
vm_port_list[vm_id] = list(set(vm_port_list[vm_id]) - set(tmp_list))
|
||||
vm_port_list[vm_id].sort()
|
||||
port = hex(vm_port_list[vm_id][0])
|
||||
vm_port_list[vm_id].remove(vm_port_list[vm_id][0])
|
||||
return str(port).upper()
|
||||
|
||||
def alloc_vuart_connection_info(board_etree, scenario_etree, allocation_etree):
|
||||
user_vm_list = scenario_etree.xpath(f"//vm[load_order != 'SERVICE_VM']")
|
||||
|
Reference in New Issue
Block a user