Files
qemu/rust
Zhao Liu aef4e4637d rust/hpet: Borrow BqlRefCell<HPETRegisters> at top level
Lockless IO requires to lock the registers during MMIO access. So it's
necessary to get (or borrow) registers data at top level, and not to
borrow again in child function calls.

Change the argument types from BqlRefCell<HPETRegisters> to
&HPETRegisters/&mut HPETRegisters in child methods, and do borrow the
data once at top level.

This allows BqlRefCell<HPETRegisters> to be directly replaced with
Mutex<HPETRegisters> in subsequent steps without causing lock reentrancy
issues.

Note, passing reference instead of BqlRef/BqlRefMut because BqlRefMut
cannot be re-borrowed as BqlRef, though BqlRef/BqlRefMut themselves play
as the "guard". Passing reference is directly and the extra
bql::is_locked check could help to consolidate safety guarantee.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20251113051937.4017675-19-zhao1.liu@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-27 10:11:10 +01:00
..
2025-12-27 10:11:10 +01:00
2025-12-27 10:11:09 +01:00
2025-12-27 10:11:10 +01:00
2025-12-27 10:11:10 +01:00
2025-12-27 10:11:10 +01:00
2025-12-27 10:11:09 +01:00
2025-12-27 10:11:10 +01:00
2024-11-05 14:18:15 +01:00