Relaxed checks for /dev/mem access. Fix #136

This commit is contained in:
erpalma
2019-09-06 09:34:22 +02:00
parent f155eea88a
commit c89c12475a

View File

@@ -512,7 +512,9 @@ def power_thread(config, regs, exit_event):
try: try:
mchbar_mmio = MMIO(0xFED159A0, 8) mchbar_mmio = MMIO(0xFED159A0, 8)
except MMIOError: except MMIOError:
fatal('Unable to open /dev/mem. Try to disable Secure Boot.') warning('Unable to open /dev/mem. TDP override might not work correctly.')
warning('Try to disable Secure Boot and/or enable CONFIG_DEVMEM in kernel config.')
mchbar_mmio = None
next_hwp_write = 0 next_hwp_write = 0
while not exit_event.is_set(): while not exit_event.is_set():
@@ -564,6 +566,7 @@ def power_thread(config, regs, exit_event):
write_value, read_value, match write_value, read_value, match
) )
) )
if mchbar_mmio is not None:
# set MCHBAR register to the same PL1/2 values # set MCHBAR register to the same PL1/2 values
mchbar_mmio.write32(0, write_value & 0xFFFFFFFF) mchbar_mmio.write32(0, write_value & 0xFFFFFFFF)
mchbar_mmio.write32(4, write_value >> 32) mchbar_mmio.write32(4, write_value >> 32)
@@ -613,9 +616,10 @@ def check_kernel():
pass pass
if kernel_config is None: if kernel_config is None:
print('[W] Unable to obtain and validate kernel config.') print('[W] Unable to obtain and validate kernel config.')
return
elif not re.search('CONFIG_DEVMEM=y', kernel_config): elif not re.search('CONFIG_DEVMEM=y', kernel_config):
fatal('Bad kernel config: you need CONFIG_DEVMEM=y.') warning('Bad kernel config: you need CONFIG_DEVMEM=y.')
elif not re.search('CONFIG_X86_MSR=(y|m)', kernel_config): if not re.search('CONFIG_X86_MSR=(y|m)', kernel_config):
fatal('Bad kernel config: you need CONFIG_X86_MSR builtin or as module.') fatal('Bad kernel config: you need CONFIG_X86_MSR builtin or as module.')