[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DAD3292B-2DBF-442A-8B60-A999AE0F6511@collabora.com>
Date: Sat, 12 Jul 2025 20:32:37 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Danilo Krummrich <dakr@...nel.org>
Cc: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Benno Lossin <lossin@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Krzysztof Wilczyński <kwilczynski@...nel.org>,
linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org,
linux-pci@...r.kernel.org
Subject: Re: [PATCH v6 3/6] rust: irq: add support for non-threaded IRQs and
handlers
> On 12 Jul 2025, at 18:24, Danilo Krummrich <dakr@...nel.org> wrote:
>
> On Thu Jul 3, 2025 at 9:30 PM CEST, Daniel Almeida wrote:
>> +/// Callbacks for an IRQ handler.
>> +pub trait Handler: Sync {
>> + /// The hard IRQ handler.
>> + ///
>> + /// This is executed in interrupt context, hence all corresponding
>> + /// limitations do apply.
>> + ///
>> + /// All work that does not necessarily need to be executed from
>> + /// interrupt context, should be deferred to a threaded handler.
>> + /// See also [`ThreadedRegistration`].
>> + fn handle(&self) -> IrqReturn;
>> +}
>
> One thing I forgot, the IRQ handlers should have a &Device<Bound> argument,
> i.e.:
>
> fn handle(&self, dev: &Device<Bound>) -> IrqReturn
>
> IRQ registrations naturally give us this guarantee, so we should take advantage
> of that.
>
> - Danilo
Hi Danilo,
I do not immediately see a way to get a Device<Bound> from here:
unsafe extern "C" fn handle_irq_callback<T: Handler>(_irq: i32, ptr: *mut c_void) -> c_uint {
Refall that we've established `ptr` to be the address of the handler. This
came after some back and forth and after the extensive discussion that Benno
and Boqun had w.r.t to pinning in request_irq().
Powered by blists - more mailing lists