mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-16 14:28:56 +00:00
acrn-config: support generation of per vcpu clos configuraton
Added "vcpu_clos" to configuration XML, here is an example of VM2 with 2 vCPUs: <clos desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution."> <vcpu_clos>1</vcpu_clos> <vcpu_clos>0</vcpu_clos> </clos> A macro will be generated in vm_configuration.h: #define VM2_VCPU_CLOS {1U, 0U} And the macro will be used in vm_configuration.c: struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = { ... { ... .clos = VM2_VCPU_CLOS, ... } } Tracked-On: #4566 Signed-off-by: Yan, Like <like.yan@intel.com> Reviewed-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
@@ -23,7 +23,7 @@ GUEST_FLAG = ["0UL", "GUEST_FLAG_SECURE_WORLD_ENABLED", "GUEST_FLAG_LAPIC_PASSTH
|
||||
START_HPA_SIZE_LIST = ['0x20000000', '0x40000000', '0x80000000', 'CONFIG_SOS_RAM_SIZE']
|
||||
|
||||
|
||||
MULTI_ITEM = ["guest_flag", "pcpu_id", "input", "block", "network"]
|
||||
MULTI_ITEM = ["guest_flag", "pcpu_id", "vcpu_clos", "input", "block", "network"]
|
||||
|
||||
SIZE_K = 1024
|
||||
SIZE_M = SIZE_K * 1024
|
||||
@@ -36,6 +36,7 @@ class MultiItem():
|
||||
def __init__(self):
|
||||
self.guest_flag = []
|
||||
self.pcpu_id = []
|
||||
self.vcpu_clos = []
|
||||
self.vir_input = []
|
||||
self.vir_block = []
|
||||
self.vir_console = []
|
||||
@@ -378,6 +379,11 @@ def get_leaf_tag_val(config_file, branch_tag, tag_str=''):
|
||||
tmp_cpus.append(leaf.text)
|
||||
continue
|
||||
|
||||
# get vcpu_clos for vm
|
||||
if leaf.tag == "vcpu_clos" and tag_str == "vcpu_clos":
|
||||
tmp_cpus.append(leaf.text)
|
||||
continue
|
||||
|
||||
# append guest flags for each vm
|
||||
if tmp_flag and tag_str == "guest_flag":
|
||||
tmp_tag.append(tmp_flag)
|
||||
@@ -402,6 +408,10 @@ def get_leaf_value(tmp, tag_str, leaf):
|
||||
if leaf.tag == "pcpu_id" and tag_str == "pcpu_id":
|
||||
tmp.multi.pcpu_id.append(leaf.text)
|
||||
|
||||
# get vcpu_clos for vm
|
||||
if leaf.tag == "vcpu_clos" and tag_str == "vcpu_clos":
|
||||
tmp.multi.vcpu_clos.append(leaf.text)
|
||||
|
||||
# get virtio-input for vm
|
||||
if leaf.tag == "input" and tag_str == "input":
|
||||
tmp.multi.vir_input.append(leaf.text)
|
||||
@@ -426,6 +436,10 @@ def get_sub_value(tmp, tag_str, vm_id):
|
||||
if tmp.multi.pcpu_id and tag_str == "pcpu_id":
|
||||
tmp.tag[vm_id] = tmp.multi.pcpu_id
|
||||
|
||||
# append cpus for vm
|
||||
if tmp.multi.vcpu_clos and tag_str == "vcpu_clos":
|
||||
tmp.tag[vm_id] = tmp.multi.vcpu_clos
|
||||
|
||||
# append virtio input for vm
|
||||
if tmp.multi.vir_input and tag_str == "input":
|
||||
tmp.tag[vm_id] = tmp.multi.vir_input
|
||||
|
@@ -665,6 +665,29 @@ def cpus_assignment(cpus_per_vm, index):
|
||||
vm_cpu_bmp['cpu_num'] = len(cpus_per_vm[index])
|
||||
return vm_cpu_bmp
|
||||
|
||||
def clos_assignment(clos_per_vm, index):
|
||||
"""
|
||||
Get clos id assignment for vm by vm index
|
||||
:param clos_per_vm: a dictionary by vmid:cpus
|
||||
:param index: vm index
|
||||
:return: clos assignment string
|
||||
"""
|
||||
vm_clos_bmp = {}
|
||||
|
||||
for i in range(len(clos_per_vm[index])):
|
||||
if i == 0:
|
||||
if len(clos_per_vm[index]) == 1:
|
||||
clos_str = "{{{0}U}}".format(clos_per_vm[index][0])
|
||||
else:
|
||||
clos_str = "{{{0}U".format(clos_per_vm[index][0])
|
||||
else:
|
||||
if i == len(clos_per_vm[index]) - 1:
|
||||
clos_str = clos_str + ", {0}U}}".format(clos_per_vm[index][i])
|
||||
else:
|
||||
clos_str = clos_str + ", {0}U".format(clos_per_vm[index][i])
|
||||
|
||||
vm_clos_bmp['clos_map'] = clos_str
|
||||
return vm_clos_bmp
|
||||
|
||||
def get_vuart_info_id(config_file, idx):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user