From a3661b4af860099c7e9c44e332ec1cff0d6c81e9 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Thu, 1 Oct 2026 11:38:46 -0400 Subject: gsp-phys: use the reference default for a zero sequencer poll timeout A zero REG_POLL timeout dword is the reference's GPU_TIMEOUT_DEFAULT sentinel: the reference substitutes the platform default (microseconds; 4 s in graphics mode, the default platform) before waiting. The executor clamped zero to the 1 us floor, i.e. one jiffy, so a poll that was not already satisfied failed the boot in 1 ms. The live 0x1002 sequencer element contains exactly one REG_POLL with timeout=0 (addr 0x110040); substitute the 4 s graphics-mode default and then keep the existing 1 us .. 10 s clamp. --- kernel/gsp_phys_booter.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'kernel') diff --git a/kernel/gsp_phys_booter.c b/kernel/gsp_phys_booter.c index 7966bc8..aaf8f6d 100644 --- a/kernel/gsp_phys_booter.c +++ b/kernel/gsp_phys_booter.c @@ -227,9 +227,14 @@ bool gsp_phys_boot_requested(void) * REG_POLL timeout dword is microseconds in the reference: * kgspExecuteSequencerBuffer_IMPL passes regPoll.timeout straight to * gpuSetTimeout() (kernel_gsp.c:4844), and message_queue_cpu.c:518-519 - * documents that unit ("Set a timeout of 1 sec" -> 1000000). Clamped to - * 1 us .. 10 s here. + * documents that unit ("Set a timeout of 1 sec" -> 1000000). A zero dword is + * GPU_TIMEOUT_DEFAULT (gpu_timeout.h:40); timeoutSet() replaces it with the + * platform default (gpu_timeout.c:235-237), which osGetTimeoutParams() sets + * to 4 s in graphics mode (the switch default, os.c:1952) and 30 s in + * compute mode (os.c:1956). Use the 4 s graphics-mode default for zero, then + * clamp to 1 us .. 10 s here. */ +#define GSP_PHYS_SEQ_POLL_TIMEOUT_DEFAULT_US 4000000u #define GSP_PHYS_SEQ_POLL_TIMEOUT_MIN_US 1u #define GSP_PHYS_SEQ_POLL_TIMEOUT_MAX_US 10000000u #define GSP_PHYS_SEQ_DELAY_MAX_US 1000000 @@ -1422,7 +1427,8 @@ static bool gsp_phys_seq_addr_valid(void __iomem *bar0, /* * REG_POLL: wait for (reg & mask) == value with a bounded timeout, then log * the observed value when it expires (reference kgspExecuteSequencerBuffer). - * The dword is microseconds (gpuSetTimeout); the reference spins in + * The dword is microseconds (gpuSetTimeout); a zero dword selects the + * reference's platform default (GPU_TIMEOUT_DEFAULT). The reference spins in * osSpinLoop, ours sleeps coarsely, so the resolution is coarser while the * bound stays exact. */ @@ -1432,6 +1438,8 @@ static int gsp_phys_seq_reg_poll(void __iomem *bar0, u32 addr, u32 mask, unsigned long deadline; u32 sleep_lo, sleep_hi, observed; + if (timeout_us == 0) + timeout_us = GSP_PHYS_SEQ_POLL_TIMEOUT_DEFAULT_US; timeout_us = clamp_t(u32, timeout_us, GSP_PHYS_SEQ_POLL_TIMEOUT_MIN_US, GSP_PHYS_SEQ_POLL_TIMEOUT_MAX_US); deadline = jiffies + usecs_to_jiffies(timeout_us); -- cgit v1.2.3