Re: [PATCH v2 0/4] rust: add `Alignment` type

2025-08-05 Thread Alexandre Courbot
On Mon Aug 4, 2025 at 11:16 PM JST, Miguel Ojeda wrote: > On Mon, Aug 4, 2025 at 1:45 PM Alexandre Courbot wrote: >> >> - The `last_set_bit` function is dropped, with the recommendation to use >> the standard library's `checked_ilog2` which does essentially the same &

Re: [PATCH v2 2/4] rust: add `Alignment` type

2025-08-05 Thread Alexandre Courbot
On Tue Aug 5, 2025 at 12:47 AM JST, Daniel Almeida wrote: >> +/// [`align_down!`] macros. >> +/// >> +/// Heavily inspired by the [`Alignment`] nightly feature from the Rust >> standard library, and >> +/// hopefully to be eventually replaced by it. > > It’s a bit hard to parse this. > > Also, I

Re: [PATCH v2 2/4] rust: add `Alignment` type

2025-08-05 Thread Alexandre Courbot
On Mon Aug 4, 2025 at 11:17 PM JST, Miguel Ojeda wrote: > On Mon, Aug 4, 2025 at 1:45 PM Alexandre Courbot wrote: >> >> +/// align down/up operations. The alignment operations are done using the >> [`align_up!`] and >> +/// [`align_down!`] macros. > > These int

Re: [PATCH v2 1/4] rust: add `CheckedAdd` trait

2025-08-05 Thread Alexandre Courbot
On Mon Aug 4, 2025 at 11:37 PM JST, Daniel Almeida wrote: > Hi Alex, > >> On 4 Aug 2025, at 08:45, Alexandre Courbot wrote: >> >> Rust provides traits for standard arithmetic and logic operations, but >> in the context of the kernel we often need to consider

[PATCH v2 4/4] gpu: nova-core: use `checked_ilog2` to emulate `fls`

2025-08-04 Thread Alexandre Courbot
responding TODO item. Signed-off-by: Alexandre Courbot --- Documentation/gpu/nova/core/todo.rst | 14 -- drivers/gpu/nova-core/falcon/hal/ga102.rs | 4 ++-- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/Documentation/gpu/nova/core/todo.rst b/Documentation/gpu

[PATCH v2 3/4] gpu: nova-core: use Alignment for alignment-related operations

2025-08-04 Thread Alexandre Courbot
Make use of the newly-available `Alignment` type and remove the corresponding TODO item. Signed-off-by: Alexandre Courbot --- Documentation/gpu/nova/core/todo.rst| 1 - drivers/gpu/nova-core/fb.rs | 6 +++--- drivers/gpu/nova-core/firmware/fwsec.rs | 11 +-- drivers

[PATCH v2 2/4] rust: add `Alignment` type

2025-08-04 Thread Alexandre Courbot
same name. It provides the same interface as its upstream namesake, while extending it with `align_up` and `align_down` operations that are usable on any integer type. Signed-off-by: Alexandre Courbot --- rust/kernel/lib.rs | 1 + rust/kernel/ptr.rs | 213

[PATCH v2 0/4] rust: add `Alignment` type

2025-08-04 Thread Alexandre Courbot
/libs-team/issues/631 [3] https://doc.rust-lang.org/std/ptr/struct.Alignment.html Signed-off-by: Alexandre Courbot --- Changes in v2: - Fix indentation of paste! in impl_last_set_bit. - Link to v1: https://lore.kernel.org/r/20250620-num-v1-0-7ec3d3fb0...@nvidia.com Changes since split from the

[PATCH v2 1/4] rust: add `CheckedAdd` trait

2025-08-04 Thread Alexandre Courbot
providing the `checked_add` operation and implement it for all integer types. Its name and location are inspired by the user-space `num` crate. This trait is to be first used by the `Alignment` type. Signed-off-by: Alexandre Courbot --- rust/kernel/lib.rs | 1 + rust/kernel/num.rs | 28

Re: [PATCH 1/3] rust: add `num` module with `PowerOfTwo` type

2025-08-04 Thread Alexandre Courbot
On Mon Aug 4, 2025 at 12:15 AM JST, Miguel Ojeda wrote: > On Sun, Aug 3, 2025 at 3:13 PM Alexandre Courbot wrote: >> >> We got some interesting feedback on the ACP already. I have been pointed >> to `checked_ilog2` as an equivalent of `last_set_bit`, and it *does* >

Re: [PATCH 1/3] rust: add `num` module with `PowerOfTwo` type

2025-08-03 Thread Alexandre Courbot
On Sat Aug 2, 2025 at 11:18 PM JST, Miguel Ojeda wrote: > On Sat, Aug 2, 2025 at 4:02 PM Alexandre Courbot wrote: >> >> Belated thanks for the suggestion; I have finally opened an ACP for >> `last_set_bit` (and `first_set_bit` while we are at it): >> https://github.com

Re: [PATCH 1/3] rust: add `num` module with `PowerOfTwo` type

2025-08-02 Thread Alexandre Courbot
On Fri Jun 20, 2025 at 11:02 PM JST, Alice Ryhl wrote: > On Fri, Jun 20, 2025 at 3:59 PM Alexandre Courbot wrote: >> > Similarly, if they stabilize the `Alignment` one (only) and we end up >> > only using our `PowerOfTwo` for `usize` and those use cases, then >> >

Re: [PATCH v2 01/19] gpu: nova-core: register: minor grammar and spelling fixes

2025-07-29 Thread Alexandre Courbot
On Mon Jul 28, 2025 at 10:25 PM JST, Steven Price wrote: > On 28/07/2025 12:43, Alexandre Courbot wrote: >> On Mon Jul 28, 2025 at 4:51 PM JST, Steven Price wrote: >>> On 28/07/2025 05:59, Alexandre Courbot wrote: >>>> Hi Daniel, thanks for the review! >>>&g

Re: [PATCH 1/2] gpu: nova-core: vbios: split out PmuLookupTableHeader from PmuLookupTable

2025-07-28 Thread Alexandre Courbot
On Sun Jul 27, 2025 at 6:48 PM JST, Rhys Lloyd wrote: > Separating the header allows the use of `size_of::()` > instead of the magic number 4. > > Signed-off-by: Rhys Lloyd > --- > drivers/gpu/nova-core/vbios.rs | 56 +- > 1 file changed, 35 insertions(+), 21 delet

Re: [PATCH v2 01/19] gpu: nova-core: register: minor grammar and spelling fixes

2025-07-28 Thread Alexandre Courbot
On Mon Jul 28, 2025 at 4:51 PM JST, Steven Price wrote: > On 28/07/2025 05:59, Alexandre Courbot wrote: >> Hi Daniel, thanks for the review! >> >> On Sat Jul 26, 2025 at 1:14 AM JST, Daniel Almeida wrote: >>> Hi Alex. Thank you and John for working on this in g

Re: [PATCH v2 17/19] gpu: nova-core: register: add support for register arrays

2025-07-27 Thread Alexandre Courbot
On Sat Jul 26, 2025 at 4:12 AM JST, Daniel Almeida wrote: >> macro_rules! register { >> // Creates a register at a fixed offset of the MMIO space. >> ($name:ident @ $offset:literal $(, $comment:literal)? { $($fields:tt)* } >> ) => { >> @@ -187,6 +238,35 @@ macro_rules! register { >>

Re: [PATCH v2 15/19] gpu: nova-core: register: redesign relative registers

2025-07-27 Thread Alexandre Courbot
On Sat Jul 26, 2025 at 3:56 AM JST, Daniel Almeida wrote: > Hi Alex, > >> On 18 Jul 2025, at 04:26, Alexandre Courbot wrote: >> >> The relative registers are currently very unsafe to use: callers can >> specify any constant as the base address for access, m

Re: [PATCH v2 07/19] gpu: nova-core: register: move OFFSET declaration to I/O impl block

2025-07-27 Thread Alexandre Courbot
On Sat Jul 26, 2025 at 2:03 AM JST, Daniel Almeida wrote: > > >> On 18 Jul 2025, at 04:26, Alexandre Courbot wrote: >> >> The OFFSET const is an I/O property, and having to pass it to the >> @common rule makes it impossible to make I/O optional, as we want to get

Re: [PATCH v2 01/19] gpu: nova-core: register: minor grammar and spelling fixes

2025-07-27 Thread Alexandre Courbot
Hi Daniel, thanks for the review! On Sat Jul 26, 2025 at 1:14 AM JST, Daniel Almeida wrote: > Hi Alex. Thank you and John for working on this in general. It will be useful > for the whole ecosystem! :) > >> On 18 Jul 2025, at 04:26, Alexandre Courbot wrote: >>

Re: [PATCH] gpu: nova-core: vbios: use offset_of in PmuLookupTableHeader::new

2025-07-25 Thread Alexandre Courbot
On Fri Jul 18, 2025 at 4:36 PM JST, Rhys Lloyd wrote: > Use the offset_of macro for each struct field, annotate the > `PmuLookupTableHeader` struct with `#[repr(C)]` attribute, > and add a TODO message to use FromBytes when available. > > Signed-off-by: Rhys Lloyd > --- > drivers/gpu/nova-core/vb

Re: [PATCH v3] gpu: nova-core: vbios: change PmuLookupTableEntry to use size_of

2025-07-25 Thread Alexandre Courbot
On Fri Jul 18, 2025 at 4:36 PM JST, Rhys Lloyd wrote: > Annotate the PmuLookupTableEntry with an `#[repr(C, packed)]` attribute. > Removes another magic number by making the struct the same size as > the data it needs to read, allowing the use of > `size_of::()` > > Signed-off-by: Rhys Lloyd Look

Re: [PATCH v2] gpu: nova-core: vbios: use size_of instead of magic number

2025-07-25 Thread Alexandre Courbot
On Fri Jul 18, 2025 at 4:36 PM JST, Rhys Lloyd wrote: > 12 is identical to the value of `size_of::()`, > so use the latter instead. > > Signed-off-by: Rhys Lloyd Looking good - I'll push this to nova-next unless someone complains. Thanks!

Re: [PATCH 1/3] rust: add `num` module with `PowerOfTwo` type

2025-07-24 Thread Alexandre Courbot
Hi Benno, Sorry, took some time to come back to this! On Sun Jun 22, 2025 at 5:11 PM JST, Benno Lossin wrote: > On Fri Jun 20, 2025 at 3:14 PM CEST, Alexandre Courbot wrote: >> +/// An unsigned integer which is guaranteed to be a power of 2. >> +/// >> +/// # Invariant

Re: [PATCH v2 16/19] gpu: nova-core: falcon: add distinct base address for PFALCON2

2025-07-22 Thread Alexandre Courbot
On Sat Jul 19, 2025 at 5:23 AM JST, John Hubbard wrote: > On 7/18/25 12:26 AM, Alexandre Courbot wrote: > ... >> diff --git a/drivers/gpu/nova-core/falcon/gsp.rs >> b/drivers/gpu/nova-core/falcon/gsp.rs >> index >> 0db9f94036

Re: [PATCH v2 02/19] gpu: nova-core: register: fix typo

2025-07-22 Thread Alexandre Courbot
On Sat Jul 19, 2025 at 4:05 AM JST, Boqun Feng wrote: > On Fri, Jul 18, 2025 at 04:26:07PM +0900, Alexandre Courbot wrote: >> A space was missing between arguments in this invocation. >> > > It's obvious up to driver and Nova folks, but I feel this commit better > fo

[PATCH v2 02/19] gpu: nova-core: register: fix typo

2025-07-18 Thread Alexandre Courbot
A space was missing between arguments in this invocation. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/regs/macros.rs index

[PATCH v2 18/19] gpu: nova-core: falcon: use register arrays for FUSE registers

2025-07-18 Thread Alexandre Courbot
FUSE registers are an array of 16 consecutive registers. Use the newly available register array feature to define them properly and improve the code using them. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/falcon/hal/ga102.rs | 33 ++- drivers/gpu/nova

[PATCH v2 19/19] gpu: nova-core: register: add support for relative array registers

2025-07-18 Thread Alexandre Courbot
Add support for declaring arrays of registers available from a variable base. This is effectively a combination of the relative and array registers features. nova-core does not make much use of this yet, but it will become helpful to have for GSP boot. Signed-off-by: Alexandre Courbot

[PATCH v2 17/19] gpu: nova-core: register: add support for register arrays

2025-07-18 Thread Alexandre Courbot
-checking is effective for array accesses performed with a constant. For cases where the index cannot be known at compile time, `try_` variants of the accessors are also made available that return `EINVAL` if the access is out-of-bounds. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core

[PATCH v2 15/19] gpu: nova-core: register: redesign relative registers

2025-07-18 Thread Alexandre Courbot
a relative register, and, since the valid bases are all known at compile-time, also guarantees that all I/O accesses are done within the valid bounds of the I/O range. Signed-off-by: Alexandre Courbot --- Documentation/gpu/nova/core/todo.rst | 1 - drivers/gpu/nova-core/falcon.rs

[PATCH v2 16/19] gpu: nova-core: falcon: add distinct base address for PFALCON2

2025-07-18 Thread Alexandre Courbot
registers definitions to assign a distinct `PFalcon2Base` base address to each falcon engine. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/falcon.rs | 7 ++- drivers/gpu/nova-core/falcon/gsp.rs | 6 +- drivers/gpu/nova-core/falcon/sec2.rs | 6 +- drivers/gpu/nova

[PATCH v2 09/19] gpu: nova-core: register: add missing doccomments for fixed registers I/O accessors

2025-07-18 Thread Alexandre Courbot
Add the missing doccomments for these accessors, as having a bit of inline documentation is always helpful. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova

[PATCH v2 14/19] gpu: nova-core: register: use #[inline(always)] for all methods

2025-07-18 Thread Alexandre Courbot
These methods should always be inlined, so use the strongest compiler hint that exists to maximize the chance they will indeed be. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a

[PATCH v2 13/19] gpu: nova-core: register: split @io rule into fixed and relative versions

2025-07-18 Thread Alexandre Courbot
. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/regs/macros.rs index f0942dc29210f703fddd4d86b758173f75b3477a

[PATCH v2 12/19] gpu: nova-core: register: generate correct `Default` implementation

2025-07-18 Thread Alexandre Courbot
The `Default` implementation of a register should be the aggregate of the default values of all its fields, and not simply be zeroed. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 26 +++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff

[PATCH v2 11/19] gpu: nova-core: register: improve `Debug` implementation

2025-07-18 Thread Alexandre Courbot
Now that we have an internal rule to dispatch field information where needed, use it to generate a better `Debug` implementation where the raw hexadecimal value of the register is displayed, as well as the `Debug` values of its individual fields. Signed-off-by: Alexandre Courbot --- drivers/gpu

[PATCH v2 05/19] gpu: nova-core: register: simplify @leaf_accessor rule

2025-07-18 Thread Alexandre Courbot
The `$type` metavariable is not used in the @leaf_accessor rule, so remove it. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/regs

[PATCH v2 10/19] gpu: nova-core: register: add fields dispatcher internal rule

2025-07-18 Thread Alexandre Courbot
us to reuse the captured field information partially to provide better `Debug` and `Default` implementations in following patches. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 42 +++- 1 file changed, 32 insertions(+), 10 deletions

[PATCH v2 07/19] gpu: nova-core: register: move OFFSET declaration to I/O impl block

2025-07-18 Thread Alexandre Courbot
The OFFSET const is an I/O property, and having to pass it to the @common rule makes it impossible to make I/O optional, as we want to get to eventually. Thus, move OFFSET to the I/O impl block so it is not needed by the @common rule anymore. Signed-off-by: Alexandre Courbot --- drivers/gpu

[PATCH v2 03/19] gpu: nova-core: register: allow fields named `offset`

2025-07-18 Thread Alexandre Courbot
` the field's range constant to avoid the name collision. Reported-by: Timur Tabi Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs.rs| 4 ++-- drivers/gpu/nova-core/regs/macros.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nova

[PATCH v2 08/19] gpu: nova-core: register: fix documentation and indentation

2025-07-18 Thread Alexandre Courbot
Fix a few documentation inconsistencies, and harmonize indentation where possible. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 34 +- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/nova-core/regs

[PATCH v2 01/19] gpu: nova-core: register: minor grammar and spelling fixes

2025-07-18 Thread Alexandre Courbot
break up a run-on sentence, for clarity. Cc: Alexandre Courbot Cc: Danilo Krummrich Signed-off-by: John Hubbard Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/nova

[PATCH v2 06/19] gpu: nova-core: register: remove `try_` accessors for relative registers

2025-07-18 Thread Alexandre Courbot
Relative registers are always accessed using a literal base, meaning their validity can always be checked at compile-time. Thus remove the `try_` accessors that have no purpose. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 38

[PATCH v2 04/19] gpu: nova-core: register: improve documentation for basic registers

2025-07-18 Thread Alexandre Courbot
Reword parts of the documentation that were a bit heavy to read, and harmonize/fix the examples. The relative registers section is about to be redesigned and its documentation rewritten, so do not touch this part. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 24

[PATCH v2 00/19] gpu: nova-core: register!() macro improvements

2025-07-18 Thread Alexandre Courbot
ive slices instead of NVIDIA's OpenRM format, - ... and proper suitability assessment by other driver contributors. These should be trivial compared to the work that is done in this series. Signed-off-by: Alexandre Courbot --- Changes in v2: - Improve documentation and add layout diagram f

Re: [PATCH] gpu: nova-core: fix bounds check in PmuLookupTableEntry::new

2025-07-16 Thread Alexandre Courbot
On Sun Jul 13, 2025 at 11:51 AM JST, Rhys Lloyd wrote: > data is sliced from 2..6, but the bounds check data.len() < 5 > does not satisfy those bounds. > > Fixes: 47c4846e4319 ("gpu: nova-core: vbios: Add support for FWSEC ucode > extraction") > > Signed-off-by: Rhys Lloyd Applied to nova-next,

Re: [PATCH] gpu: nova-core: vbios: use size_of instead of magic number

2025-07-15 Thread Alexandre Courbot
On Mon Jul 14, 2025 at 7:43 PM JST, Rhys Lloyd wrote: > 12 is identical to the value of `size_of::()`, > so use the latter instead. > > Signed-off-by: Rhys Lloyd > --- > drivers/gpu/nova-core/vbios.rs | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/nova-core/v

Re: [PATCH] gpu: nova-core: vbios: split out PmuLookupTableHeader from PmuLookupTable

2025-07-15 Thread Alexandre Courbot
On Mon Jul 14, 2025 at 7:43 PM JST, Rhys Lloyd wrote: > Separating the header allows the use of `size_of::()` > instead of the magic number 4. > > Signed-off-by: Rhys Lloyd > --- > drivers/gpu/nova-core/vbios.rs | 56 +- > 1 file changed, 35 insertions(+), 21 delet

Re: [PATCH v2] gpu: nova-core: vbios: change PmuLookupTableEntry to relax alignment

2025-07-15 Thread Alexandre Courbot
On Tue Jul 15, 2025 at 12:22 AM JST, Joel Fernandes wrote: > > > On 7/14/2025 10:53 AM, Alice Ryhl wrote: >> On Mon, Jul 14, 2025 at 4:49 PM Joel Fernandes wrote: >>> >>> Hello, Rhys, >>> >>> On Mon, Jul 14, 2025 at 04:02:23AM -0700, Rhys Lloyd wrote: Instead of the data field containing a u3

Re: [PATCH] gpu: nova-core: define named constants for magic numbers

2025-07-13 Thread Alexandre Courbot
On Sun Jul 13, 2025 at 11:51 AM JST, Rhys Lloyd wrote: > Introduce an associated constant `MIN_LEN` for each struct that checks > the length of the input data in its constructor against a magic number. > > Signed-off-by: Rhys Lloyd As I mentioned in [1], I think this would be better addressed by

Re: [PATCH] gpu: nova-core: fix bounds check in PmuLookupTableEntry::new

2025-07-13 Thread Alexandre Courbot
Rhys Lloyd > --- > Changes in v2: Since this is a v2, the message subject should have read "[PATCH v2]". You can achieve this by passing `-v 2` to git format-patch. No need to resend, just pointing it out for next time. :) For the fix in itself, Reviewed-by: Alexandre Courbot

[PATCH v4 7/8] Documentation: gpu: nova-core: Document fwsec operation and layout

2025-07-07 Thread Alexandre Courbot
From: Joel Fernandes Add explanation of fwsec with diagrams. This helps clarify how the nova-core falcon boot works. Signed-off-by: Joel Fernandes Signed-off-by: Alexandre Courbot --- Documentation/gpu/nova/core/fwsec.rst | 181 ++ Documentation/gpu/nova

[PATCH v4 8/8] Documentation: gpu: nova-core: Document basics of the Falcon

2025-07-07 Thread Alexandre Courbot
Nouveau code. Signed-off-by: Joel Fernandes Reviewed-by: Bagas Sanjaya Signed-off-by: Alexandre Courbot --- Documentation/gpu/nova/core/falcon.rst | 158 + Documentation/gpu/nova/index.rst | 1 + 2 files changed, 159 insertions(+) diff --git a

[PATCH v4 5/8] Documentation: gpu: nova-core: Document vbios layout

2025-07-07 Thread Alexandre Courbot
ff-by: Alexandre Courbot --- Documentation/gpu/nova/core/vbios.rst | 181 ++ Documentation/gpu/nova/index.rst | 1 + 2 files changed, 182 insertions(+) diff --git a/Documentation/gpu/nova/core/vbios.rst b/Documentation/gpu/nova/core/vbios.rst new file mode 1

[PATCH v4 6/8] Documentation: gpu: nova-core: Document devinit process

2025-07-07 Thread Alexandre Courbot
: Alexandre Courbot --- Documentation/gpu/nova/core/devinit.rst | 61 + Documentation/gpu/nova/index.rst| 1 + 2 files changed, 62 insertions(+) diff --git a/Documentation/gpu/nova/core/devinit.rst b/Documentation/gpu/nova/core/devinit.rst new file mode

[PATCH v4 2/8] gpu: nova-core: Clarify sysmembar operations

2025-07-07 Thread Alexandre Courbot
From: Joel Fernandes sysmembar is a critical operation that the GSP falcon needs to perform in the reset sequence. Add some code comments to clarify. [acour...@nvdidia.com: move relevant documentation to SysmemFlush type] Signed-off-by: Joel Fernandes Signed-off-by: Alexandre Courbot

[PATCH v4 4/8] gpu: nova-core: convert `/*` comments to `//`

2025-07-07 Thread Alexandre Courbot
The second form is preferred, and there was no reason to use the first. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs.rs | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/nova-core/regs.rs b/drivers/gpu/nova-core/regs.rs index

[PATCH v4 3/8] gpu: nova-core: Clarify falcon code

2025-07-07 Thread Alexandre Courbot
From: Joel Fernandes Add documentation strings, comments and AES mode for completeness to the Falcon signatures. Signed-off-by: Joel Fernandes Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/falcon.rs | 29 ++--- 1 file changed, 22 insertions(+), 7

[PATCH v4 0/8] Documentation for nova-core

2025-07-07 Thread Alexandre Courbot
g/all/db0i8wah970b.25d3s59ayf...@nvidia.com/ Signed-off-by: Joel Fernandes Signed-off-by: Alexandre Courbot --- Changes in v4: - Convert `/*` comments into `//`. - Fix missing slashes in doccomments and minor typos. - Move some less-important paragraphs to notes in the RST files. - Link to v3:

[PATCH v4 1/8] gpu: nova-core: Add code comments related to devinit

2025-07-07 Thread Alexandre Courbot
Fernandes Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/gfw.rs | 39 +++ drivers/gpu/nova-core/regs.rs | 14 -- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/nova-core/gfw.rs b/drivers/gpu/nova-core/gfw.rs

Re: [PATCH v3 1/7] gpu: nova-core: Add code comments related to devinit

2025-07-07 Thread Alexandre Courbot
On Sun Jul 6, 2025 at 10:42 PM JST, Miguel Ojeda wrote: > On Wed, Jul 2, 2025 at 1:04 PM Alexandre Courbot wrote: >> >> +// Check that FWSEC has lowered its protection level before reading >> the GFW_BOOT status. > > `GFW_BOOT` (another one below), since it

[PATCH 18/18] gpu: nova-core: registers: add support for relative array registers

2025-07-04 Thread Alexandre Courbot
Add support for declaring arrays of registers available from a variable base. This is effectively a combination of the relative and array registers features. nova-core does not make much use of this yet, but it will become helpful to have for GSP boot. Signed-off-by: Alexandre Courbot

[PATCH 17/18] gpu: nova-core: falcon: use register arrays for FUSE registers

2025-07-04 Thread Alexandre Courbot
FUSE registers are an array of 16 consecutive registers. Use the newly available register array feature to define them properly and improve the code using them. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/falcon/hal/ga102.rs | 33 ++- drivers/gpu/nova

[PATCH 14/18] gpu: nova-core: register: redesign relative registers

2025-07-04 Thread Alexandre Courbot
a relative register, and, since the valid bases are all known at compile-time, also guarantees that all I/O accesses are done within the valid bounds of the I/O range. Signed-off-by: Alexandre Courbot --- Documentation/gpu/nova/core/todo.rst | 1 - drivers/gpu/nova-core/falcon.rs

[PATCH 16/18] gpu: nova-core: register: add support for register arrays

2025-07-04 Thread Alexandre Courbot
-checking is effective for array accesses performed with a constant. For cases where the index cannot be known at compile time, `try_` variants of the accessors are also made available that return `EINVAL` if the access is out-of-bounds. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core

[PATCH 15/18] gpu: nova-core: falcon: add distinct base address for PFALCON2

2025-07-04 Thread Alexandre Courbot
registers definitions to assign a distinct `PFalcon2Base` base address to each falcon engine. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/falcon.rs | 7 ++- drivers/gpu/nova-core/falcon/gsp.rs | 6 +- drivers/gpu/nova-core/falcon/sec2.rs | 6 +- drivers/gpu/nova

[PATCH 13/18] gpu: nova-core: register: use #[inline(always)] for all methods

2025-07-04 Thread Alexandre Courbot
These methods should always be inlined, so use the strongest compiler hint that exists to maximize the chance they will indeed be. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a

[PATCH 12/18] gpu: nova-core: register: split @io rule into fixed and relative versions

2025-07-04 Thread Alexandre Courbot
. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/regs/macros.rs index 97895800ff7031d287b3bbd03a00b1ca71014aa8

[PATCH 10/18] gpu: nova-core: register: improve `Debug` implementation

2025-07-04 Thread Alexandre Courbot
Now that we have an internal rule to dispatch field information where needed, use it to generate a better `Debug` implementation where the raw hexadecimal value of the register is displayed, as well as the `Debug` values of its individual fields. Signed-off-by: Alexandre Courbot --- drivers/gpu

[PATCH 11/18] gpu: nova-core: register: generate correct `Default` implementation

2025-07-04 Thread Alexandre Courbot
The `Default` implementation of a register should be the aggregate of the default values of all its fields, and not simply be zeroed. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 26 +++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff

[PATCH 09/18] gpu: nova-core: register: add fields dispatcher internal rule

2025-07-04 Thread Alexandre Courbot
us to reuse the captured field information partially to provide better `Debug` and `Default` implementations in following patches. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 42 +++- 1 file changed, 32 insertions(+), 10 deletions

[PATCH 08/18] gpu: nova-core: register: add missing doccomments for fixed registers I/O accessors

2025-07-04 Thread Alexandre Courbot
Add the missing doccomments for these accessors, as having a bit of inline documentation is always helpful. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova

[PATCH 06/18] gpu: nova-core: register: move OFFSET declaration to I/O impl block

2025-07-04 Thread Alexandre Courbot
The OFFSET const is an I/O property, and having to pass it to the @common rule makes it impossible to make I/O optional, as we want to get to eventually. Thus, move OFFSET to the I/O impl block so it is not needed by the @common rule anymore. Signed-off-by: Alexandre Courbot --- drivers/gpu

[PATCH 07/18] gpu: nova-core: register: fix documentation and indentation

2025-07-04 Thread Alexandre Courbot
Fix a few documentation inconsistencies, and harmonize indentation where possible. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 34 +- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/nova-core/regs

[PATCH 05/18] gpu: nova-core: register: remove `try_` accessors for relative registers

2025-07-04 Thread Alexandre Courbot
Relative registers are always accessed using a literal base, meaning their validity can always be checked at compile-time. Thus remove the `try_` accessors that have no purpose. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 38

[PATCH 04/18] gpu: nova-core: register: simplify @leaf_accessor rule

2025-07-04 Thread Alexandre Courbot
The `$type` metavariable is not used in the @leaf_accessor rule, so remove it. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/regs

[PATCH 03/18] gpu: nova-core: register: fix alias documentation

2025-07-04 Thread Alexandre Courbot
The provided example had its matching closing parentheses missing. Also simplify the example itself and reword the explanation a bit. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu

[PATCH 00/18] gpu: nova-core: register!() macro improvements

2025-07-04 Thread Alexandre Courbot
ive slices instead of NVIDIA's OpenRM format, - ... and proper suitability assessment by other driver contributors. These should be trivial compared to the work that is done in this series. Signed-off-by: Alexandre Courbot --- Alexandre Courbot (17): gpu: nova-core: register: fix

[PATCH 02/18] gpu: nova-core: register: fix typo

2025-07-04 Thread Alexandre Courbot
A space was missing between arguments in this invocation. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/regs/macros.rs index

[PATCH 01/18] gpu: nova-core: register: minor grammar and spelling fixes

2025-07-04 Thread Alexandre Courbot
break up a run-on sentence, for clarity. Cc: Alexandre Courbot Cc: Danilo Krummrich Signed-off-by: John Hubbard Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/nova

[PATCH v3 3/7] gpu: nova-core: Clarify falcon code

2025-07-02 Thread Alexandre Courbot
From: Joel Fernandes Add documentation strings, comments and AES mode for completeness to the Falcon signatures. Signed-off-by: Joel Fernandes Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/falcon.rs | 29 ++--- 1 file changed, 22 insertions(+), 7

[PATCH v3 1/7] gpu: nova-core: Add code comments related to devinit

2025-07-02 Thread Alexandre Courbot
Fernandes Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/gfw.rs | 39 +++ drivers/gpu/nova-core/regs.rs | 16 ++-- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/nova-core/gfw.rs b/drivers/gpu/nova-core/gfw.rs

[PATCH v3 5/7] Documentation: gpu: nova-core: Document devinit process

2025-07-02 Thread Alexandre Courbot
From: Joel Fernandes devinit is mentioned in the code. This patch explains it so it is clear what it does. devinit is not only essential at boot-time, but also at runtime due to suspend-resume and things like re-clocking. Signed-off-by: Joel Fernandes Signed-off-by: Alexandre Courbot

[PATCH v3 2/7] gpu: nova-core: Clarify sysmembar operations

2025-07-02 Thread Alexandre Courbot
From: Joel Fernandes sysmembar is a critical operation that the GSP falcon needs to perform in the reset sequence. Add some code comments to clarify. [acour...@nvdidia.com: move relevant documentation to SysmemFlush type] Signed-off-by: Joel Fernandes Signed-off-by: Alexandre Courbot

[PATCH v3 7/7] Documentation: gpu: nova-core: Document basics of the Falcon

2025-07-02 Thread Alexandre Courbot
Nouveau code. Signed-off-by: Joel Fernandes Signed-off-by: Alexandre Courbot --- Documentation/gpu/nova/core/falcon.rst | 158 + Documentation/gpu/nova/index.rst | 1 + 2 files changed, 159 insertions(+) diff --git a/Documentation/gpu/nova/core/falcon.rst

[PATCH v3 6/7] Documentation: gpu: nova-core: Document fwsec operation and layout

2025-07-02 Thread Alexandre Courbot
From: Joel Fernandes Add explanation of fwsec with diagrams. This helps clarify how the nova-core falcon boot works. Signed-off-by: Joel Fernandes Signed-off-by: Alexandre Courbot --- Documentation/gpu/nova/core/fwsec.rst | 182 ++ Documentation/gpu/nova

[PATCH v3 4/7] Documentation: gpu: nova-core: Document vbios layout

2025-07-02 Thread Alexandre Courbot
ff-by: Alexandre Courbot --- Documentation/gpu/nova/core/vbios.rst | 180 ++ Documentation/gpu/nova/index.rst | 1 + 2 files changed, 181 insertions(+) diff --git a/Documentation/gpu/nova/core/vbios.rst b/Documentation/gpu/nova/core/vbios.rst new file mode 1

[PATCH v3 0/7] Documentation for nova-core

2025-07-02 Thread Alexandre Courbot
g/all/db0i8wah970b.25d3s59ayf...@nvidia.com/ Signed-off-by: Joel Fernandes Signed-off-by: Alexandre Courbot --- Changes in v3: - Rebase on top of latest nova-next. - Reorganize patches a bit and use standard prefixes. - Convert diagrams to only use ASCII characters (thanks Bagas!). - Move sysm

Re: [PATCH v6 00/24] nova-core: run FWSEC-FRTS to perform first stage of GSP initialization

2025-06-30 Thread Alexandre Courbot
On Tue Jul 1, 2025 at 12:43 AM JST, Danilo Krummrich wrote: > On 6/24/25 4:56 AM, Alexandre Courbot wrote: >> On Tue Jun 24, 2025 at 6:01 AM JST, Danilo Krummrich wrote: >>> There's one thing that would be nice to fix subsequently, which is properly >>> resettin

Re: [PATCH v2 0/7] Documentation for nova-core

2025-06-30 Thread Alexandre Courbot
On Mon Jun 30, 2025 at 7:37 PM JST, Danilo Krummrich wrote: > On 5/3/25 6:07 AM, Joel Fernandes wrote: >> Hello, >> >> Please find attached initial documentation for nova-core mainly about the >> vbios >> and boot process. It helps build an understanding of the boot code. All the >> information i

Re: [PATCH 0/4] rust: add `FromPrimitive` support

2025-06-25 Thread Alexandre Courbot
On Tue Jun 24, 2025 at 12:14 AM JST, Jesung Yang wrote: > This patch series introduces a new `FromPrimitive` trait along with its > corresponding derive macro. > > A few enhancements were made to the custom `quote!` macro to write the > derive macro. These include support for additional punctuation

[PATCH] gpu: nova-core: replace `Duration` with `Delta`

2025-06-24 Thread Alexandre Courbot
The kernel's `Delta` type was not available when the `wait_on` function was introduced. Now that it is, switch to it as it is more compact than `Duration` and cannot panic. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/falcon.rs | 12 ++-- drivers/gpu/nova

Re: [PATCH 1/2] gpu: nova-core: impl From for u32 for enums used from register!

2025-06-24 Thread Alexandre Courbot
On Tue Jun 24, 2025 at 10:23 PM JST, Danilo Krummrich wrote: > Implement From for u32 for all enum types used within the register!() > macro. > > This avoids a conflict with [1] as reported in [2]. > > Cc: Alexandre Courbot > Cc: Miguel Ojeda > Link: > https://lore.k

Re: [PATCH v6 00/24] nova-core: run FWSEC-FRTS to perform first stage of GSP initialization

2025-06-24 Thread Alexandre Courbot
On Tue Jun 24, 2025 at 6:01 AM JST, Danilo Krummrich wrote: > There's one thing that would be nice to fix subsequently, which is properly > resetting the GPU. Currently, it needs a power cycle to be able to probe > successfully after unbinding the driver. Yes, what I usually do is the following af

Re: [PATCH] MAINTAINERS: Add Alexandre Courbot as co-maintainer to nova-core

2025-06-24 Thread Alexandre Courbot
> upstream solution for NVIDIA GPUs in the Linux kernel. > > Cc: Alexandre Courbot > Signed-off-by: Danilo Krummrich Acked-by: Alexandre Courbot Thanks Danilo for your trust and for guiding us to this point! It is still a long road ahead, but I am happy and excited to be involved in this effort with you and the community.

Re: [PATCH 2/2] gpu: nova-core: consider `clippy::cast_lossless`

2025-06-24 Thread Alexandre Courbot
On Tue Jun 24, 2025 at 10:23 PM JST, Danilo Krummrich wrote: > Fix all warnings caused by `clippy::cast_lossless`, which is going to be > enabled by [1]. > > Cc: Alexandre Courbot > Cc: Miguel Ojeda > Link: > https://lore.kernel.org/r/20250615-ptr-as-ptr-v12-5-f43b

[PATCH 2/3] rust: num: add the `last_set_bit` operation

2025-06-20 Thread Alexandre Courbot
Add an equivalent to the `fls` (Find Last Set bit) C function to Rust unsigned types. It is to be first used by the nova-core driver. Signed-off-by: Alexandre Courbot --- rust/kernel/num.rs | 38 ++ 1 file changed, 38 insertions(+) diff --git a/rust/kernel

[PATCH 1/3] rust: add `num` module with `PowerOfTwo` type

2025-06-20 Thread Alexandre Courbot
create masks. These operations are provided by this type. It is introduced to be first used by the nova-core driver. Signed-off-by: Alexandre Courbot --- rust/kernel/lib.rs | 1 + rust/kernel/num.rs | 163 + 2 files changed, 164 insertions

Re: [PATCH 1/3] rust: add `num` module with `PowerOfTwo` type

2025-06-20 Thread Alexandre Courbot
On Fri Jun 20, 2025 at 10:35 PM JST, Miguel Ojeda wrote: > On Fri, Jun 20, 2025 at 3:15 PM Alexandre Courbot wrote: >> >> Introduce the `num` module, featuring the `PowerOfTwo` unsigned wrapper >> that guarantees (at build-time or runtime) that a value is a power of >>

[PATCH 0/3] rust: add `num` module

2025-06-20 Thread Alexandre Courbot
` methods since it implements `Copy`, - Use #[derive] where possible instead of implementing traits manually, - Remove `Deref` and `Borrow` implementations. Signed-off-by: Alexandre Courbot --- Alexandre Courbot (3): rust: add `num` module with `PowerOfTwo` type rust: num: add the

  1   2   3   4   5   6   7   8   9   10   >