acrn-config: Extract RDT resource and CLOS from target

xml file

This patch adds support for parsing RDT resources and
its max clos, max supported mask values from the target xml file.

Tracked-On: #3715
Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Vijay Dhanraj 2020-02-25 14:11:13 -08:00 committed by wenlingz
parent 4a007cc3a9
commit 89a635438d
2 changed files with 19 additions and 14 deletions

View File

@ -220,7 +220,7 @@ def get_rootfs(config_file):
def clos_info_parser(board_info): def clos_info_parser(board_info):
""" Parse CLOS information """ """ Parse CLOS information """
return common.get_max_clos(board_info) return common.get_max_clos_mask(board_info)
def get_pre_launch_cnt(config_file): def get_pre_launch_cnt(config_file):

View File

@ -8,6 +8,7 @@ import sys
import getopt import getopt
import shutil import shutil
import subprocess import subprocess
import re
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
SOURCE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../') SOURCE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../')
@ -592,25 +593,29 @@ def handle_root_dev(line):
return False return False
def get_max_clos(board_file): def get_max_clos_mask(board_file):
""" """
Parse CLOS information Parse CLOS information
:param board_file: it is a file what contains board information for script to read from :param board_file: it is a file what contains board information for script to read from
:return: type of cache support for clos and clos max number :return: type of rdt resource supported and their corresponding clos max.
""" """
rdt_res=[]
rdt_res_clos_max=[]
rdt_res_mask_max=[]
cache_support = False clos_lines = get_board_info(board_file, "<CLOS_INFO>", "</CLOS_INFO>")
clos_max = 0 for line in clos_lines:
if line.split(':')[0].strip() == "rdt resources supported":
rdt_res = line.split(':')[1].strip()
elif line.split(':')[0].strip() == "rdt resource clos max":
rdt_res_clos_max = line.split(':')[1].strip()
elif line.split(':')[0].strip() == "rdt resource mask max":
rdt_res_mask_max = line.split(':')[1].strip()
cat_lines = get_board_info(board_file, "<CLOS_INFO>", "</CLOS_INFO>") if (len(rdt_res) == 0) or (len(rdt_res_clos_max) == 0):
return rdt_res, rdt_res_clos_max, rdt_res_mask_max
for line in cat_lines: else:
if line.split(':')[0].strip() == "clos supported by cache": return list(re.split(', |\s |,', rdt_res)), list(map(int, rdt_res_clos_max.split(','))), list(re.split(', |\s |,', rdt_res_mask_max))
cache_support = line.split(':')[1].strip()
elif line.split(':')[0].strip() == "clos max":
clos_max = int(line.split(':')[1])
return (cache_support, clos_max)
def undline_name(name): def undline_name(name):