mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 21:47:22 +00:00
deb-pkg: load msr driver in board_parse.py
Tracked-On: #6688 Signed-off-by: Hu Fenglin <fenglin.hu@intel.com>
This commit is contained in:
parent
9bae63b941
commit
e6de236caa
@ -36,12 +36,38 @@ def vendor_check():
|
|||||||
vendor_name = line.split(':')[1].strip()
|
vendor_name = line.split(':')[1].strip()
|
||||||
return vendor_name == CPU_VENDOR
|
return vendor_name == CPU_VENDOR
|
||||||
|
|
||||||
|
def check_msr_files(cpu_dirs):
|
||||||
|
cpu_list = []
|
||||||
|
for cpu_num in os.listdir(cpu_dirs):
|
||||||
|
if cpu_num.isdigit():
|
||||||
|
if os.path.exists(os.path.join(cpu_dirs, "{}/msr".format(cpu_num))):
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
cpu_list.append(cpu_num)
|
||||||
|
return cpu_list
|
||||||
|
|
||||||
def check_env():
|
def check_env():
|
||||||
"""Check if there is appropriate environment on this system"""
|
"""Check if there is appropriate environment on this system"""
|
||||||
if os.path.exists(PY_CACHE):
|
if os.path.exists(PY_CACHE):
|
||||||
shutil.rmtree(PY_CACHE)
|
shutil.rmtree(PY_CACHE)
|
||||||
|
|
||||||
|
# check cpu msr file
|
||||||
|
cpu_dirs = "/dev/cpu"
|
||||||
|
if check_msr_files(cpu_dirs):
|
||||||
|
res = subprocess.Popen("modprobe msr",
|
||||||
|
shell=True, stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE, close_fds=True)
|
||||||
|
err_msg = res.stderr.readline().decode('ascii')
|
||||||
|
if err_msg:
|
||||||
|
parser_lib.print_red("{}".format(err_msg), err=True)
|
||||||
|
exit(-1)
|
||||||
|
msr_info = check_msr_files(cpu_dirs)
|
||||||
|
if msr_info:
|
||||||
|
for cpu_num in msr_info:
|
||||||
|
parser_lib.print_red("Missing CPU msr file in the {}/{}/".format(cpu_dirs, cpu_num), err=True)
|
||||||
|
parser_lib.print_red("Missing CPU msr file, please check the value of CONFIG_X86_MSR in the kernel config.", err=True)
|
||||||
|
exit(-1)
|
||||||
|
|
||||||
# check cpu vendor id
|
# check cpu vendor id
|
||||||
if not vendor_check():
|
if not vendor_check():
|
||||||
parser_lib.print_red("Please run this tools on {}!".format(CPU_VENDOR))
|
parser_lib.print_red("Please run this tools on {}!".format(CPU_VENDOR))
|
||||||
|
Loading…
Reference in New Issue
Block a user