On Fri, Feb 21, 2025 at 06:03:39PM +0100, Paolo Bonzini wrote: > Date: Fri, 21 Feb 2025 18:03:39 +0100 > From: Paolo Bonzini <pbonz...@redhat.com> > Subject: [PATCH 12/15] rust: sysbus: wrap SysBusDevice with Opaque<> > X-Mailer: git-send-email 2.48.1 > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > rust/hw/timer/hpet/src/hpet.rs | 2 +- > rust/qemu-api/src/bindings.rs | 3 --- > rust/qemu-api/src/sysbus.rs | 25 ++++++++++++++++++------- > 3 files changed, 19 insertions(+), 11 deletions(-) > > diff --git a/rust/hw/timer/hpet/src/hpet.rs b/rust/hw/timer/hpet/src/hpet.rs > index be27eb0eff4..19e63465cff 100644 > --- a/rust/hw/timer/hpet/src/hpet.rs > +++ b/rust/hw/timer/hpet/src/hpet.rs > @@ -741,7 +741,7 @@ fn reset_hold(&self, _type: ResetType) { > HPETFwConfig::update_hpet_cfg( > self.hpet_id.get(), > self.capability.get() as u32, > - sbd.mmio[0].addr, > + unsafe { *sbd.as_ptr() }.mmio[0].addr,
We can wrap this unsafe code into SysBusDeviceMethods...then the device won't introduce more unsafe code. > ); > > // to document that the RTC lowers its output on reset as well Others, fine for me, Reviewed-by: Zhao Liu <zhao1....@intel.com>