From: "Gary Guo" <gary@garyguo.net>
To: "Link Mauve" <linkmauve@linkmauve.fr>,
"Laura Nao" <laura.nao@collabora.com>
Cc: "Daniel Almeida" <daniel.almeida@collabora.com>,
"Alice Ryhl" <aliceryhl@google.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
rust-for-linux@vger.kernel.org, kernel@collabora.com,
"Deborah Brouwer" <deborah.brouwer@collabora.com>
Subject: Re: [PATCH v3] drm/tyr: add Job IRQ handling
Date: Thu, 06 Aug 2026 13:09:29 +0100 [thread overview]
Message-ID: <DKHULO6LPCRE.2I0PQRNA36LQD@garyguo.net> (raw)
In-Reply-To: <anHZpHh_5CZhH5N3@desktop>
On Tue Aug 4, 2026 at 1:23 PM BST, Link Mauve wrote:
> Hi,
>
> On Mon, Aug 03, 2026 at 03:34:37PM +0200, Laura Nao wrote:
>> Add a threaded IRQ wrapper for Tyr interrupt sources and use it to
>> handle the firmware Job IRQ.
>>
>> The Job IRQ reports requests from the CSF firmware, including global
>> interface requests and CSG attention bits. Only the GLB bit is currently
>> handled, as it will be used to check firmware readiness. CSG bits
>> handling will be added at a later stage. Add a Job IRQ handler that
>> masks the interrupt in the primary IRQ handler, processes pending raw
>> status in the threaded handler, clears the handled bit, and reenables
>> the mask before returning.
>> Add a wait queue and a bool flag so the handler can signal firmware
>> readiness when the GLB bit is set.
> […]
>> diff --git a/drivers/gpu/drm/tyr/fw/irq.rs b/drivers/gpu/drm/tyr/fw/irq.rs
>> new file mode 100644
>> index 000000000000..6eeb1399a7b3
>> --- /dev/null
>> +++ b/drivers/gpu/drm/tyr/fw/irq.rs
>> @@ -0,0 +1,105 @@
> […]
>> +/// Requests a threaded IRQ registration for the Job IRQ.
>> +///
>> +/// # Safety
>> +///
>> +/// Callers must not `mem::forget()` the resulting registration or otherwise prevent its
>> +/// [`Drop`] implementation from running.
>> +pub(crate) unsafe fn job_irq_init<'a>(
>> + pdev: &'a platform::Device<Bound>,
>> + iomem: Arc<IoMem<'a>>,
>> + fw_ready: Arc<AtomicBool>,
>> + job_irq_wait: Arc<WaitQueue>,
>> +) -> Result<impl PinInit<ThreadedRegistration<'a, TyrIrq<JobIrq<'a>>>, Error> + 'a> {
>> + iomem.write_reg(JOB_IRQ_MASK::zeroed().with_glb(true));
>> + let job_irq = JobIrq {
>> + iomem: iomem.clone(),
>> + fw_ready,
>> + job_irq_wait,
>> + };
>> + // SAFETY: The caller guarantees the resulting registration will not be leaked.
>> + unsafe { TyrIrq::request(pdev, c_str!("job"), job_irq) }
>
> Nowadays we use the shorter c"job" way of creating a &CStr, and I think
> the macro will even generate warnings in some configurations (perhaps
> CLIPPY=1?).
klint will produce a warning for this, but clippy won't.
Best,
Gary
>
>> +}
>> +
>> +impl TyrIrqTrait for JobIrq<'_> {
>> + fn read_status(&self) -> u32 {
>> + self.iomem.read(JOB_IRQ_STATUS).into_raw()
>> + }
>> +
>> + fn clear_mask(&self) {
>> + self.iomem.write_reg(JOB_IRQ_MASK::zeroed());
>> + }
>> +
>> + fn reenable_mask(&self) {
>> + self.iomem.write_reg(JOB_IRQ_MASK::zeroed().with_glb(true));
>> + }
>> +
>> + fn read_raw_status(&self) -> u32 {
>> + self.iomem.read(JOB_IRQ_RAWSTAT).into_raw()
>> + }
>> +
>> + fn clear_status(&self, status: u32) {
>> + self.iomem.write_reg(JOB_IRQ_CLEAR::from_raw(status));
>> + }
>> +
>> + fn mask(&self) -> u32 {
>> + JOB_IRQ_MASK::zeroed().with_glb(true).into_raw()
>> + }
>> +
>> + fn handle(&self, status: u32) {
>> + // TODO: handle other Job IRQ events (e.g. CSG attention bits) here once
>> + // support for them is added.
>> + if JOB_IRQ_RAWSTAT::from_raw(status).glb() {
>> + self.fw_ready.store(true, Ordering::Release);
>> + self.job_irq_wait.wake_ua/rust/macros/module.rsp_all();
>> + }
>> + }
>> +}
>>
>> ---
>> base-commit: 98ae54f97175c4992b4e5bff53f3c6bc24f0f491
>> change-id: 20260728-tyr-irq-v2-0b3c5022be33
>>
>> Best regards,
>> --
>> Laura Nao <laura.nao@collabora.com>
>>
>>
prev parent reply other threads:[~2026-08-06 12:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 13:34 [PATCH v3] drm/tyr: add Job IRQ handling Laura Nao
2026-08-04 12:23 ` Link Mauve
2026-08-05 10:48 ` Laura Nao
2026-08-06 8:27 ` Alice Ryhl
2026-08-06 12:09 ` Gary Guo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DKHULO6LPCRE.2I0PQRNA36LQD@garyguo.net \
--to=gary@garyguo.net \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=deborah.brouwer@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@collabora.com \
--cc=laura.nao@collabora.com \
--cc=linkmauve@linkmauve.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox