|
@@ -512,7 +512,9 @@ def power_thread(config, regs, exit_event):
|
|
|
try:
|
|
|
mchbar_mmio = MMIO(0xFED159A0, 8)
|
|
|
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
|
|
|
while not exit_event.is_set():
|
|
@@ -564,17 +566,18 @@ def power_thread(config, regs, exit_event):
|
|
|
write_value, read_value, match
|
|
|
)
|
|
|
)
|
|
|
- # set MCHBAR register to the same PL1/2 values
|
|
|
- mchbar_mmio.write32(0, write_value & 0xFFFFFFFF)
|
|
|
- mchbar_mmio.write32(4, write_value >> 32)
|
|
|
- if args.debug:
|
|
|
- read_value = mchbar_mmio.read32(0) | (mchbar_mmio.read32(4) << 32)
|
|
|
- match = OK if write_value == read_value else ERR
|
|
|
- print(
|
|
|
- '[D] MCHBAR PACKAGE_POWER_LIMIT - write {:#x} - read {:#x} - match {}'.format(
|
|
|
- write_value, read_value, match
|
|
|
+ if mchbar_mmio is not None:
|
|
|
+ # set MCHBAR register to the same PL1/2 values
|
|
|
+ mchbar_mmio.write32(0, write_value & 0xFFFFFFFF)
|
|
|
+ mchbar_mmio.write32(4, write_value >> 32)
|
|
|
+ if args.debug:
|
|
|
+ read_value = mchbar_mmio.read32(0) | (mchbar_mmio.read32(4) << 32)
|
|
|
+ match = OK if write_value == read_value else ERR
|
|
|
+ print(
|
|
|
+ '[D] MCHBAR PACKAGE_POWER_LIMIT - write {:#x} - read {:#x} - match {}'.format(
|
|
|
+ write_value, read_value, match
|
|
|
+ )
|
|
|
)
|
|
|
- )
|
|
|
|
|
|
wait_t = config.getfloat(power['source'], 'Update_Rate_s')
|
|
|
enable_hwp_mode = config.getboolean('AC', 'HWP_Mode', fallback=False)
|
|
@@ -613,9 +616,10 @@ def check_kernel():
|
|
|
pass
|
|
|
if kernel_config is None:
|
|
|
print('[W] Unable to obtain and validate kernel config.')
|
|
|
+ return
|
|
|
elif not re.search('CONFIG_DEVMEM=y', kernel_config):
|
|
|
- fatal('Bad kernel config: you need CONFIG_DEVMEM=y.')
|
|
|
- elif not re.search('CONFIG_X86_MSR=(y|m)', kernel_config):
|
|
|
+ warning('Bad kernel config: you need CONFIG_DEVMEM=y.')
|
|
|
+ if not re.search('CONFIG_X86_MSR=(y|m)', kernel_config):
|
|
|
fatal('Bad kernel config: you need CONFIG_X86_MSR builtin or as module.')
|
|
|
|
|
|
|