Re: [PATCH 1/2] rust: add BQL-enforcing Cell variant

2024-11-27 Thread Paolo Bonzini
Il mer 27 nov 2024, 07:17 Zhao Liu ha scritto: > > and a single "regs: BqlRefCell" in PL011State. > > Here I have a possibly common question about the choice of BqlCell and > future BqlRefCell. Pls refer my comment below... > > I understand we need BqlRefCell instead of BqlCell for registers sinc

Re: [PATCH 1/2] rust: add BQL-enforcing Cell variant

2024-11-26 Thread Junjie Mao
Paolo Bonzini writes: > QEMU objects usually have their pointer shared with the "outside > world" very early in their lifetime, for example when they create their > MemoryRegions. Because at this point it is not valid anymore to > create a &mut reference to the device, individual parts of the

Re: [PATCH 1/2] rust: add BQL-enforcing Cell variant

2024-11-26 Thread Zhao Liu
On Tue, Nov 26, 2024 at 05:11:36PM +0100, Paolo Bonzini wrote: > Date: Tue, 26 Nov 2024 17:11:36 +0100 > From: Paolo Bonzini > Subject: Re: [PATCH 1/2] rust: add BQL-enforcing Cell variant > > On 11/26/24 15:56, Zhao Liu wrote: > > > > But this actually applies to

Re: [PATCH 1/2] rust: add BQL-enforcing Cell variant

2024-11-26 Thread Paolo Bonzini
On 11/26/24 15:56, Zhao Liu wrote: But this actually applies to _all_ of the device struct! Once a pointer to the device has been handed out (for example via memory_region_init_io or qdev_init_clock_in), accesses to the device struct must not use &mut anymore. is the final goal to wrap the ent

Re: [PATCH 1/2] rust: add BQL-enforcing Cell variant

2024-11-26 Thread Zhao Liu
On Fri, Nov 22, 2024 at 08:47:55AM +0100, Paolo Bonzini wrote: > Date: Fri, 22 Nov 2024 08:47:55 +0100 > From: Paolo Bonzini > Subject: [PATCH 1/2] rust: add BQL-enforcing Cell variant > X-Mailer: git-send-email 2.47.0 > > QEMU objects usually have their pointer shared with th

[PATCH 1/2] rust: add BQL-enforcing Cell variant

2024-11-21 Thread Paolo Bonzini
QEMU objects usually have their pointer shared with the "outside world" very early in their lifetime, for example when they create their MemoryRegions. Because at this point it is not valid anymore to create a &mut reference to the device, individual parts of the device struct must be made mutable