On Thu, Dec 05, 2024 at 07:58:07PM +0100, Paolo Bonzini wrote: > Date: Thu, 5 Dec 2024 19:58:07 +0100 > From: Paolo Bonzini <pbonz...@redhat.com> > Subject: Re: [RFC 12/13] rust/timer/hpet: add qdev APIs support > > On 12/5/24 07:07, Zhao Liu wrote: > > Implement QAPI support for HPET device in qdev.rs. > > > > Additionally, wrap the handling of HPET internal details as traits to be > > specifically implemented in hpet.rs. > > Why not just put everything in a simple file to avoid the traits?
Ah, I considered that qdev has many unsafe C-style wrappers, to avoid confusion with HPET state/timer methods... However, looking back now, qdev and qom are already quite clean. I will merge this into hpet.rs in the next version. > > +pub(crate) trait RamOps { > > + fn read(&mut self, addr: hwaddr, _size: c_uint) -> u64; > > + fn write(&mut self, addr: hwaddr, value: u64, size: u64); > > +} > > Please try as much as possible to make these "&self", same for the GPIO > handler. That's the point of BqlCell/BqlRefCell. :) Sure! Will do as you suggested. Regards, Zhao