Hi everyone, This RFC is based on top of Danilo's initial driver stub series v4 [1] and adds very basic support for the Timer and Falcon devices, in order to see and "feel" the proposed register access abstractions and discuss them before moving forward with GSP initialization. It is kept simple and short on purpose, to avoid bumping into a wall with much more device code because my assumptions were incorrect. The main addition is the nv_reg!() register definition macro, which aims at providing safe and convenient access to all useful registers and their fields. I elaborate on its definition in the patch that introduces it ; it is also probably better to look at all the register definitions to understand how it can be used, and the services it provides. Right now it provides accessors and builders for all the fields of a register. It will probably need to be extended with more operations as we deem them useful. The timer device has not changed much from v1, with the exception of having its own Timestamp type to easily obtain Durations between two samples. The falcon implementation is still super incomplete, and just designed to illustrate how the register macros can be used. I have more progress in a private branch, but want to keep the focus on the nv_reg!() macro for this review since the rest will ultimately depend on it. It would be charitable to say that my Rust macro skills are lacking ; so please point out any deficiency in its definition. I am also not entirely sure about the syntax for register definition - I would like to keep things simple and close to OpenRM (notably for the mask definitions) to make it easier to port definition from it into Nova. [1] https://lore.kernel.org/nouveau/20250226175552.29381-1-dakr@xxxxxxxxxx/T/ Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx> --- Changes in v2: - Don't hold the Bar guard in methods that can sleep. - Added a Timestamp type for Timer to safely and easily get durations between two measurements. - Added a macro to make register definitions easier. - Added a very basic falcon implementation to define more registers and exercise the register definition macro. - Link to v1: https://lore.kernel.org/r/20250217-nova_timer-v1-0-78c5ace2d987@xxxxxxxxxx --- Alexandre Courbot (5): rust: add useful ops for u64 rust: make ETIMEDOUT error available gpu: nova-core: add register definition macro gpu: nova-core: add basic timer device gpu: nova-core: add falcon register definitions and probe code drivers/gpu/nova-core/driver.rs | 4 +- drivers/gpu/nova-core/falcon.rs | 124 +++++++++++++++ drivers/gpu/nova-core/gpu.rs | 70 ++++++++- drivers/gpu/nova-core/nova_core.rs | 2 + drivers/gpu/nova-core/regs.rs | 311 ++++++++++++++++++++++++++++++++----- drivers/gpu/nova-core/timer.rs | 124 +++++++++++++++ rust/kernel/error.rs | 1 + rust/kernel/lib.rs | 1 + rust/kernel/num.rs | 43 +++++ 9 files changed, 639 insertions(+), 41 deletions(-) --- base-commit: 3ac10b625b709d59556cd2c1bf8a009c2bfdbefc change-id: 20250216-nova_timer-c69430184f54 Best regards, -- Alexandre Courbot <acourbot@xxxxxxxxxx>