From 3c53d3e2095c8f8b831e5db9f93367d565af369c Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Fri, 20 Nov 2026 01:28:56 +1100 Subject: [PATCH] drm/asahi: g17: M5: drop the unreachable EAGAIN retry of a host-port submission Firmware::submit_m5_render_pair() wrote a render pair's records, then the transaction through the M5 host command port, and on EAGAIN dropped the pair view, took the registration power hold and tried once more. Firmware::submit_m5_work() had the same retry for a single transaction. Both were added with the M5 host-port submission. G17Resources::submit_m5_work() cannot return EAGAIN: it returns Ok on a J813 forms boot, ENODEV once the register mapping is revoked, and otherwise only the result of try_write64(), which fails with EINVAL for an offset outside the mapping. The host command port needs no core power ("Core activity is not a prerequisite"), so no powered-state check exists that could refuse the transaction. The retry branch has never run, and the hold it would have taken is a no-op on M5 anyway: the V26A428_M5 variant has registration_power_hold false, since its firmware powers the cores for work by its own policy. Firmware::submit_m5_work() has no caller. Write the pair and submit once; any error propagates as before. Remove the uncalled single-transaction wrapper. Behaviour is unchanged on every SoC: the removed branch was unreachable. Fixes: 9b1f7788a69e ("drm/asahi: g17: M5: install M5 queues and submit through the host command port") Signed-off-by: Ryan Murray --- drivers/gpu/drm/asahi/g17/mod.rs | 43 +++++++------------------------- 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/asahi/g17/mod.rs b/drivers/gpu/drm/asahi/g17/mod.rs index ca362da3e93f5..e19cd54cd15bb 100644 --- a/drivers/gpu/drm/asahi/g17/mod.rs +++ b/drivers/gpu/drm/asahi/g17/mod.rs @@ -900,21 +900,10 @@ impl Firmware { power::release(self) } - /// Retry a temporarily unavailable transaction once under a registration - /// power hold. Other access errors propagate to the retained owner. - fn submit_m5_work(&mut self, submission: &fw::m5::queue::HardwareSubmission) -> Result { - match self.bridge.regs.submit_m5_work(submission) { - Err(error) if error == EAGAIN => { - self.acquire_registration_power()?; - self.bridge.regs.submit_m5_work(submission) - } - result => result, - } - } - /// Both outer slots and their capacity are checked before any host-port - /// write. An EAGAIN retry drops the old views and revalidates them under a - /// power hold. After a successful transaction, publication is infallible. + /// write. The host command port needs no core power, and its transaction + /// fails only once the register mapping is gone; the error propagates. + /// After a successful transaction, publication is infallible. fn submit_m5_render_pair( &mut self, priority: u8, @@ -925,26 +914,12 @@ impl Firmware { deferred: bool, cursors: Option<[u32; 3]>, ) -> Result<[u32; 2]> { - let mut commit_accounting = Some(commit_accounting); - let mut publish_inner = Some(publish_inner); - let mut cursors = cursors; - for attempt in 0..2 { - let pair = self.init.m5_work_pair(priority, &records[0], &records[1], cursors.take())?; - pair.prepare(); - if let Some(commit) = commit_accounting.take() { commit()?; } - match self.bridge.regs.submit_m5_work(submission) { - Err(error) if error == EAGAIN && attempt == 0 => { - drop(pair); - self.acquire_registration_power()?; - } - Err(error) => return Err(error), - Ok(()) => { - if let Some(publish) = publish_inner.take() { publish(); } - return Ok(if deferred { pair.next() } else { pair.publish() }); - } - } - } - Err(EAGAIN) + let pair = self.init.m5_work_pair(priority, &records[0], &records[1], cursors)?; + pair.prepare(); + commit_accounting()?; + self.bridge.regs.submit_m5_work(submission)?; + publish_inner(); + Ok(if deferred { pair.next() } else { pair.publish() }) } /// Called at actual submission publication, not while a queued job is merely being built.