acrn-config: Fix target xml generation issue when no P-state scaling driver is present

There seems to be a corner case where target xml file
fails to get generated if there was no P-state scaling driver
or C-state idle driver present. This patch addresses it by
handling the file not present exception and setting a warning
as well a "not available" string to successfully generate
target xml file.

Signed-off-by: Vijay Dhanraj <vijay.dhanraj@intel.com>
Tracked-On: #4199
Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Vijay Dhanraj 2019-12-05 17:34:15 -08:00 committed by wenlingz
parent 8c87ee3951
commit f3688c7e45

View File

@ -417,6 +417,7 @@ def store_cx_data(sysnode1, sysnode2, config):
""" """
i = 0 i = 0
state_cpus = {} state_cpus = {}
try:
with open(sysnode1, 'r') as acpi_idle: with open(sysnode1, 'r') as acpi_idle:
idle_driver = acpi_idle.read(32) idle_driver = acpi_idle.read(32)
@ -430,6 +431,10 @@ def store_cx_data(sysnode1, sysnode2, config):
parser_lib.print_yel("please make sure ACPI Cstate is enabled in BIOS.", warn=True) parser_lib.print_yel("please make sure ACPI Cstate is enabled in BIOS.", warn=True)
print("\t/* Cx data is not available */", file=config) print("\t/* Cx data is not available */", file=config)
return return
except IOError:
parser_lib.print_yel("No idle driver found.", warn=True)
print("\t/* Cx data is not available */", file=config)
return
files = os.listdir(sysnode2) files = os.listdir(sysnode2)
for d_path in files: for d_path in files:
@ -486,6 +491,8 @@ def store_px_data(sysnode, config):
""" """
px_tmp = PxPkg() px_tmp = PxPkg()
px_data = {} px_data = {}
try:
with open(sysnode+'cpu0/cpufreq/scaling_driver', 'r') as f_node: with open(sysnode+'cpu0/cpufreq/scaling_driver', 'r') as f_node:
freq_driver = f_node.read() freq_driver = f_node.read()
if freq_driver.find("acpi-cpufreq") == -1: if freq_driver.find("acpi-cpufreq") == -1:
@ -498,6 +505,10 @@ def store_px_data(sysnode, config):
parser_lib.print_yel("please make sure ACPI Pstate is enabled in BIOS.", warn=True) parser_lib.print_yel("please make sure ACPI Pstate is enabled in BIOS.", warn=True)
print("\t/* Px data is not available */", file=config) print("\t/* Px data is not available */", file=config)
return return
except IOError:
parser_lib.print_yel("No scaling_driver found.", warn=True)
print("\t/* Px data is not available */", file=config)
return
try: try:
with open(sysnode+'cpufreq/boost', 'r') as f_node: with open(sysnode+'cpufreq/boost', 'r') as f_node: