[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 09/15] rust: irq: wrap IRQState with Opaque<>
From: |
Zhao Liu |
Subject: |
Re: [PATCH 09/15] rust: irq: wrap IRQState with Opaque<> |
Date: |
Tue, 25 Feb 2025 16:26:18 +0800 |
> +/// An opaque wrapper around [`bindings::IRQState`].
> +#[repr(transparent)]
> +#[derive(Debug, qemu_api_macros::Wrapper)]
> +pub struct IRQState(Opaque<bindings::IRQState>);
> +
> /// Interrupt sources are used by devices to pass changes to a value
> (typically
> /// a boolean). The interrupt sink is usually an interrupt controller or
> /// GPIO controller.
> @@ -22,8 +28,7 @@
> /// method sends a `true` value to the sink. If the guest has to see a
> /// different polarity, that change is performed by the board between the
> /// device and the interrupt controller.
> -pub type IRQState = bindings::IRQState;
> -
> +///
> /// Interrupts are implemented as a pointer to the interrupt "sink", which
> has
> /// type [`IRQState`]. A device exposes its source as a QOM link property
> using
> /// a function such as [`SysBusDeviceMethods::init_irq`], and
> @@ -41,7 +46,7 @@ pub struct InterruptSource<T = bool>
> where
> c_int: From<T>,
> {
> - cell: BqlCell<*mut IRQState>,
> + cell: BqlCell<*mut bindings::IRQState>,
Once we've already wrapper IRQState in Opaque<>, should we still use
bindings::IRQState?
Although InterruptSource just stores a pointer. However, I think we can
use wrapped IRQState here instead of the native binding type, since this
item is also crossing the FFI boundary. What do you think?
> _marker: PhantomData<T>,
> }
>
- Re: [PATCH 04/15] rust: pl011, qemu_api tests: do not use ClassInitImpl, (continued)
- [PATCH 05/15] rust: qom: get rid of ClassInitImpl, Paolo Bonzini, 2025/02/21
- [PATCH 08/15] rust: timer: wrap QEMUTimer with Opaque<>, Paolo Bonzini, 2025/02/21
- [PATCH 07/15] rust: qemu_api_macros: add Wrapper derive macro, Paolo Bonzini, 2025/02/21
- [PATCH 06/15] rust: cell: add wrapper for FFI types, Paolo Bonzini, 2025/02/21
- [PATCH 09/15] rust: irq: wrap IRQState with Opaque<>, Paolo Bonzini, 2025/02/21
- Re: [PATCH 09/15] rust: irq: wrap IRQState with Opaque<>,
Zhao Liu <=
- [PATCH 10/15] rust: qom: wrap Object with Opaque<>, Paolo Bonzini, 2025/02/21
- [PATCH 12/15] rust: sysbus: wrap SysBusDevice with Opaque<>, Paolo Bonzini, 2025/02/21
- [PATCH 11/15] rust: qdev: wrap Clock and DeviceState with Opaque<>, Paolo Bonzini, 2025/02/21
- [PATCH 13/15] rust: memory: wrap MemoryRegion with Opaque<>, Paolo Bonzini, 2025/02/21