mirror of
https://github.com/erpalma/throttled.git
synced 2026-04-21 06:03:56 +00:00
throttled: use mmio.write64/read64 for MCHBAR PKG_POWER_LIMIT
Replaces the open-coded write32(0, low) + write32(4, high) pair (and the matching read32 merge in the debug path) with a single 64-bit access. Besides being less code, this also closes a small window between the two 32-bit writes in which the register briefly held (new_low, old_high). Signed-off-by: ooonea <35407790+ooonea@users.noreply.github.com>
This commit is contained in:
parent
2b8f94b23e
commit
b9a0d8634d
1 changed files with 2 additions and 3 deletions
|
|
@ -770,10 +770,9 @@ def power_thread(config, regs, exit_event, cpuid):
|
|||
log(f'[D] MSR PACKAGE_POWER_LIMIT - write {write_value:#x} - read {read_value:#x} - match {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)
|
||||
mchbar_mmio.write64(0, write_value)
|
||||
if args.debug:
|
||||
read_value = mchbar_mmio.read32(0) | (mchbar_mmio.read32(4) << 32)
|
||||
read_value = mchbar_mmio.read64(0)
|
||||
match = OK if write_value == read_value else ERR
|
||||
log(
|
||||
f'[D] MCHBAR PACKAGE_POWER_LIMIT - write {write_value:#x} - read {read_value:#x} - match {match}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue