acrn-config: by-pass acpi_idle/acpi_cpufreq for parsing target board

Current board parse logic would be broken if acpi_idle/acpi-cpufreq
driver is not loaded by native kernel.
This patch would just leave a warning to user and continue to parse
other information in this case.

Tracked-On: #4082
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Wei Liu
2019-11-12 09:18:20 +08:00
committed by wenlingz
parent 631c461314
commit cdd086a81d
3 changed files with 46 additions and 26 deletions

View File

@@ -433,13 +433,15 @@ def store_cx_data(sysnode1, sysnode2, config):
idle_driver = acpi_idle.read(32)
if idle_driver.find("acpi_idle") == -1:
parser_lib.print_yel("The Cx data for ACRN relies on " +\
"acpi_idle driver but it is not found, ", warn=True, end=False)
if idle_driver.find("intel_idle") == 0:
parser_lib.print_red("The tool need to run with acpi_idle driver, " +
"please add intel_idle.max_cstate=0 in kernel " +
"cmdline to fall back to acpi_idle driver", err=True)
print("please add idle=nomwait in kernel " +\
"cmdline to fall back to acpi_idle driver")
else:
parser_lib.print_red("acpi_idle driver is not found.", err=True)
sys.exit(1)
parser_lib.print_yel("please make sure ACPI Cstate is enabled in BIOS.", warn=True)
print("\t/* Cx data is not available */", file=config)
return
files = os.listdir(sysnode2)
for d_path in files:
@@ -499,13 +501,15 @@ def store_px_data(sysnode, config):
with open(sysnode+'cpu0/cpufreq/scaling_driver', 'r') as f_node:
freq_driver = f_node.read()
if freq_driver.find("acpi-cpufreq") == -1:
parser_lib.print_yel("The Px data for ACRN relies on " +\
"acpi-cpufreq driver but it is not found, ", warn=True, end=False)
if freq_driver.find("intel_pstate") == 0:
parser_lib.print_red("The tool need to run with acpi_cpufreq driver, " +
"please add intel_pstate=disable in kernel cmdline " +
"to fall back to acpi-cpufreq driver.", err=True)
print("please add intel_pstate=disable in kernel " +\
"cmdline to fall back to acpi-cpufreq driver")
else:
parser_lib.print_red("acpi-cpufreq driver is not found.", err=True)
sys.exit(1)
parser_lib.print_yel("please make sure ACPI Pstate is enabled in BIOS.", warn=True)
print("\t/* Px data is not available */", file=config)
return
try:
with open(sysnode+'cpufreq/boost', 'r') as f_node:

View File

@@ -16,15 +16,22 @@ def check_dmi():
return os.path.exists("/sys/firmware/dmi")
def print_yel(msg, warn=False):
def print_yel(msg, warn=False, end=True):
"""Output the message with the color of yellow
:param msg: the stings which will be output to STDOUT
:param warn: the condition if needs to be output the color of yellow with 'Warning'
:param end: The flag of it needs to combine with the next line for stdout
"""
if warn:
print("\033[1;33mWarning\033[0m:"+msg)
if end:
print("\033[1;33mWarning\033[0m:"+msg)
else:
print("\033[1;33mWarning\033[0m:"+msg, end="")
else:
print("\033[1;33m{0}\033[0m".format(msg))
if end:
print("\033[1;33m{}\033[0m".format(msg))
else:
print("\033[1;33m{}\033[0m".format(msg), end="")
def print_red(msg, err=False):