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:
ooonea 2026-04-19 21:56:37 +02:00
parent 2b8f94b23e
commit b9a0d8634d
No known key found for this signature in database
GPG key ID: 3CD106C3A25275AD

View file

@ -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}'