gpu: nova-core: add helper function to wait on condition
authorAlexandre Courbot <acourbot@nvidia.com>
Thu, 19 Jun 2025 13:23:55 +0000 (22:23 +0900)
committerDanilo Krummrich <dakr@kernel.org>
Mon, 23 Jun 2025 17:09:11 +0000 (19:09 +0200)
commita03c9bd953c2482aec8013c9c857b4d53031b54d
treee45b48184aa4b0c833f9bd21b0cf797319b0959e
parent94a08721435cc9a8de9f9ce83e9fe13d38d24771
gpu: nova-core: add helper function to wait on condition

While programming the hardware, we frequently need to busy-wait until
a condition (like a given bit of a register to switch value) happens.

Add a basic `wait_on` helper function to wait on such conditions
expressed as a closure, with a timeout argument.

This is temporary as we will switch to `read_poll_timeout` [1] once it
is available.

Link: https://lore.kernel.org/lkml/20250220070611.214262-8-fujita.tomonori@gmail.com/
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://lore.kernel.org/r/20250619-nova-frts-v6-11-ecf41ef99252@nvidia.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/gpu/nova-core/util.rs