summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_phys_booter.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/gsp_phys_booter.c')
-rw-r--r--kernel/gsp_phys_booter.c14
1 files changed, 11 insertions, 3 deletions
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);