acrn-config: add PCI VUART config in launch config UI

Add PCI VUART config for post-launched VMs in launch config UI. Users
can configure the console_vuart, configure or dynamically add or remove
communication_vuart based on the communication vuarts which are configured
from the scenario xml.

Tracked-On: #5394

Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
This commit is contained in:
Shuang Zheng 2020-10-20 20:02:06 +08:00 committed by wenlingz
parent 788f28035d
commit 4f5885c271
5 changed files with 33 additions and 6 deletions

View File

@ -1003,7 +1003,8 @@ function save_launch(generator=null) {
$("select").each(function(){
var id = $(this).attr('id');
var value = $(this).val();
if(id.indexOf('pcpu_id')>=0 || id.indexOf('shm_region')>=0 || id.indexOf('pci_dev')>=0) {
if(id.indexOf('pcpu_id')>=0 || id.indexOf('shm_region')>=0
|| id.indexOf('communication_vuart')>=0 || id.indexOf('pci_dev')>=0) {
if(id in launch_config) {
launch_config[id].push(value);
} else {

View File

@ -207,7 +207,7 @@ the launch scripts will be generated into misc/acrn-config/xmls/config-xmls/[boa
{% elif elem.getchildren() != [] %}
{% if 'multiselect' not in elem.attrib or elem.attrib['multiselect'] != 'true' %}
{% set first_multi_child = {'block': 0, 'network': 0, 'input': 0, 'pcpu_id': 0, 'shm_region': 0,
'passthrough_devices': 0, 'virtio_devices': 0} %}
'passthrough_devices': 0, 'virtio_devices': 0, 'communication_vuart': 0} %}
{% for sub_elem in elem.getchildren() %}
{% set sub_elem_text = '' if sub_elem.text == None else sub_elem.text %}
{% if 'configurable' not in sub_elem.attrib or sub_elem.attrib['configurable'] != '0' %}
@ -218,7 +218,7 @@ the launch scripts will be generated into misc/acrn-config/xmls/config-xmls/[boa
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
{{elem.tag}}</label>
{% do first_multi_child.update({elem.tag: first_multi_child[elem.tag]+1}) %}
{% elif sub_elem.tag in ['pcpu_id', 'shm_region'] and first_multi_child[sub_elem.tag] == 0 %}
{% elif sub_elem.tag in ['pcpu_id', 'shm_region', 'communication_vuart'] and first_multi_child[sub_elem.tag] == 0 %}
<label class="col-sm-1 control-label" data-toggle="tooltip"
title="{{sub_elem.attrib['desc'] if 'desc' in sub_elem.attrib else sub_elem.tag}}">
{{elem.tag}}</label>
@ -233,7 +233,7 @@ the launch scripts will be generated into misc/acrn-config/xmls/config-xmls/[boa
{{sub_elem.tag}}</label>
{% if ','.join(['uos', elem.tag, sub_elem.tag]) not in launch_item_values
and elem.tag != 'cpu_affinity' and elem.tag != 'shm_regions'%}
and elem.tag not in ['cpu_affinity', 'shm_regions', 'communication_vuarts']%}
<div class="col-sm-5">
{% if 'readonly' in sub_elem.attrib and sub_elem.attrib['readonly'] == 'true' %}
<input type="text" class="form-control" readonly
@ -262,7 +262,7 @@ the launch scripts will be generated into misc/acrn-config/xmls/config-xmls/[boa
{% if elem.tag == 'cpu_affinity' %}
{% set item_key = ','.join(['uos', elem.tag]) %}
{% elif elem.tag == 'shm_regions' %}
{% elif elem.tag in ['shm_regions', 'communication_vuarts'] %}
{% set item_key = ','.join(['uos:id='+vm.attrib['id'], elem.tag, sub_elem.tag]) %}
{% else %}
{% set item_key = ','.join(['uos', elem.tag, sub_elem.tag]) %}
@ -284,7 +284,7 @@ the launch scripts will be generated into misc/acrn-config/xmls/config-xmls/[boa
{% endif %}
{% endfor %}
</select>
{% if elem.tag in ['cpu_affinity', 'shm_regions'] %}
{% if elem.tag in ['cpu_affinity', 'shm_regions', 'communication_vuarts'] %}
<button type="button" class="btn" id="add_shm_{{first_multi_child[sub_elem.tag]}}">+</button>
{% if not first_multi_child[sub_elem.tag] %}
<button type="button" disabled class="btn" id="remove_shm_{{first_multi_child[sub_elem.tag]}}">-</button>

View File

@ -53,6 +53,7 @@ def get_launch_item_values(board_info, scenario_info=None):
launch_item_values['uos,poweroff_channel'] = launch_cfg_lib.PM_CHANNEL
launch_item_values["uos,cpu_affinity"] = board_cfg_lib.get_processor_info()
launch_cfg_lib.set_shm_regions(launch_item_values, scenario_info)
launch_cfg_lib.set_pci_vuarts(launch_item_values, scenario_info)
return launch_item_values

View File

@ -599,6 +599,30 @@ def set_shm_regions(launch_item_values, scenario_info):
print(e)
def set_pci_vuarts(launch_item_values, scenario_info):
try:
launch_item_values['uos,console_vuart'] = DM_VUART0
vm_types = common.get_leaf_tag_map(scenario_info, 'vm_type')
sos_vm_id = 0
for vm_id, vm_type in vm_types.items():
if vm_type in ['SOS_VM']:
sos_vm_id = vm_id
for vm in common.get_config_root(scenario_info).getchildren():
if vm.tag == 'vm' and scenario_cfg_lib.VM_DB[vm_types[int(vm.attrib['id'])]]['load_type'] == 'POST_LAUNCHED_VM':
uos_id = int(vm.attrib['id']) - sos_vm_id
pci_vuart_key = 'uos:id={},communication_vuarts,communication_vuart'.format(uos_id)
for elem in vm.getchildren():
if elem.tag == 'communication_vuart':
for sub_elem in elem.getchildren():
if sub_elem.tag == 'base' and sub_elem.text == 'PCI_VUART':
if pci_vuart_key not in launch_item_values.keys():
launch_item_values[pci_vuart_key] = ['', elem.attrib['id']]
else:
launch_item_values[pci_vuart_key].append(elem.attrib['id'])
except:
return
def check_shm_regions(launch_shm_regions, scenario_info):
launch_item_values = {}
set_shm_regions(launch_item_values, scenario_info)

View File

@ -55,6 +55,7 @@ UUID_DB = {
VM_DB = {
'SOS_VM':{'load_type':'SOS_VM', 'severity':'SEVERITY_SOS', 'uuid':UUID_DB['SOS_VM']},
'SAFETY_VM':{'load_type':'PRE_LAUNCHED_VM', 'severity':'SEVERITY_SAFETY_VM', 'uuid':UUID_DB['SAFETY_VM']},
'PRE_RT_VM':{'load_type':'PRE_LAUNCHED_VM', 'severity':'SEVERITY_RTVM', 'uuid':UUID_DB['PRE_RT_VM']},
'PRE_STD_VM':{'load_type':'PRE_LAUNCHED_VM', 'severity':'SEVERITY_STANDARD_VM', 'uuid':UUID_DB['PRE_STD_VM']},
'POST_STD_VM':{'load_type':'POST_LAUNCHED_VM', 'severity':'SEVERITY_STANDARD_VM', 'uuid':UUID_DB['POST_STD_VM']},
'POST_RT_VM':{'load_type':'POST_LAUNCHED_VM', 'severity':'SEVERITY_RTVM', 'uuid':UUID_DB['POST_RT_VM']},