Re: [PATCH 11/16] gpu: nova-core: add falcon register definitions and base code

2025-04-30 Thread Alexandre Courbot
t; On Sun, Apr 20, 2025 at 09:19:43PM +0900, Alexandre Courbot wrote: >> >> +#[repr(u8)] >> +#[derive(Debug, Default, Copy, Clone)] >> +pub(crate) enum FalconSecurityModel { >> +#[default] >> +None = 0, >> +Light = 2, >> +Heavy = 3, >&

Re: [PATCH 11/16] gpu: nova-core: add falcon register definitions and base code

2025-04-30 Thread Alexandre Courbot
On Thu May 1, 2025 at 3:16 AM JST, Danilo Krummrich wrote: > On Wed, Apr 30, 2025 at 10:38:11AM -0400, Joel Fernandes wrote: >> On 4/30/2025 9:25 AM, Alexandre Courbot wrote: >> > On Tue Apr 22, 2025 at 11:44 PM JST, Danilo Krummrich wrote: >> >> >>> +///

[PATCH v2 02/21] rust: dma: expose the count and size of CoherentAllocation

2025-05-01 Thread Alexandre Courbot
These properties are very useful to have and should be accessible. Signed-off-by: Alexandre Courbot --- rust/kernel/dma.rs | 14 ++ 1 file changed, 14 insertions(+) diff --git a/rust/kernel/dma.rs b/rust/kernel/dma.rs index 605e01e35715667f93297fd9ec49d8e7032e0910

[PATCH v2 09/21] gpu: nova-core: move Firmware to firmware module

2025-05-01 Thread Alexandre Courbot
We will extend the firmware methods, so move it to its own module instead to keep gpu.rs focused. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/firmware.rs | 46 +-- drivers/gpu/nova-core/gpu.rs | 35 +++-- 2 files

[PATCH v2 05/21] gpu: nova-core: take bound device in Gpu::new

2025-05-01 Thread Alexandre Courbot
We will need to perform things like allocating DMA memory during device creation, so make sure to take the device context that will allow us to perform these actions. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/gpu.rs | 5 - 1 file changed, 4 insertions(+), 1 deletion

[PATCH v2 08/21] gpu: nova-core: introduce helper macro for register access

2025-05-01 Thread Alexandre Courbot
proper error as needed. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/gpu.rs | 3 +-- drivers/gpu/nova-core/nova_core.rs | 18 ++ drivers/gpu/nova-core/regs/macros.rs | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nova-core

[PATCH v2 01/21] rust: devres: allow to borrow a reference to the resource's Device

2025-05-01 Thread Alexandre Courbot
Functions that take a &Devres as argument might need to print error messages related on behalf the device. Providing the reference here removes the need for drivers to store their own for that sole purpose. Signed-off-by: Alexandre Courbot --- rust/kernel/devres.rs | 6 ++ 1 file change

[PATCH v2 20/21] gpu: nova-core: extract FWSEC from BIOS and patch it to run FWSEC-FRTS

2025-05-01 Thread Alexandre Courbot
x27;s fields] Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/dma.rs| 3 - drivers/gpu/nova-core/firmware.rs | 18 ++ drivers/gpu/nova-core/firmware/fwsec.rs | 360 drivers/gpu/nova-core/gpu.rs| 20 +- drivers/gpu/nova

[PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-01 Thread Alexandre Courbot
From: Joel Fernandes This will be used in the nova-core driver where we need to upward-align the image size to get to the next image in the VBIOS ROM. [acour...@nvidia.com: handled conflicts due to removal of patch creating num.rs] Signed-off-by: Joel Fernandes Signed-off-by: Alexandre

Re: [PATCH 11/16] gpu: nova-core: add falcon register definitions and base code

2025-05-01 Thread Alexandre Courbot
On Thu May 1, 2025 at 9:22 AM JST, Joel Fernandes wrote: > Hi Alex, > > On 4/30/2025 8:09 PM, Alexandre Courbot wrote: >>>> I am just not seeing the benefits of not using dyn for >>>> this use case and only drawbacks. IMHO, we should try to not be doing the >>

Re: [PATCH v2 15/21] gpu: nova-core: add falcon register definitions and base code

2025-05-01 Thread Alexandre Courbot
On Thu May 1, 2025 at 10:52 PM JST, Joel Fernandes wrote: > Hello Alex, > > On Thu, May 01, 2025 at 09:58:33PM +0900, Alexandre Courbot wrote: >> Add the common Falcon code and HAL for Ampere GPUs, and instantiate the >> GSP and SEC2 Falcons that will be required to boot the G

[PATCH v2 13/21] gpu: nova-core: register sysmem flush page

2025-05-01 Thread Alexandre Courbot
A page of system memory is reserved so sysmembar can perform a read on it if a system write occurred since the last flush. Do this early as it can be required to e.g. reset the GPU falcons. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/gpu.rs | 51

[PATCH v2 14/21] gpu: nova-core: add helper function to wait on condition

2025-05-01 Thread Alexandre Courbot
`read_poll_timeout` [1] once it is available. [1] https://lore.kernel.org/lkml/20250220070611.214262-8-fujita.tomon...@gmail.com/ Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/util.rs | 30 ++ 1 file changed, 30 insertions(+) diff --git a/drivers/gpu/nova

[PATCH v2 06/21] gpu: nova-core: define registers layout using helper macro

2025-05-01 Thread Alexandre Courbot
accessors. Suggested-by: Danilo Krummrich Signed-off-by: Alexandre Courbot --- Documentation/gpu/nova/core/todo.rst | 6 + drivers/gpu/nova-core/gpu.rs | 10 +- drivers/gpu/nova-core/regs.rs| 61 ++ drivers/gpu/nova-core/regs/macros.rs | 379

[PATCH v2 04/21] gpu: nova-core: add missing GA100 definition

2025-05-01 Thread Alexandre Courbot
linux-firmware contains a directory for GA100, and it is a defined chipset in Nouveau. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/gpu.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs index

[PATCH v2 07/21] gpu: nova-core: fix layout of NV_PMC_BOOT_0

2025-05-01 Thread Alexandre Courbot
at a different location than the rest of its bits. Redefine the register layout to match its actual definition as provided by OpenRM and expose the fully-constructed "architecture" field through our own "Architecture" type. The "chipset" pseudo-field is also u

[PATCH v2 00/21] nova-core: run FWSEC-FRTS to perform first stage of GSP initialization

2025-05-01 Thread Alexandre Courbot
7.199712-1-fujita.tomon...@gmail.com/ Signed-off-by: Alexandre Courbot --- Changes in v2: - Rebased on latest nova-next. - Fixed all clippy warnings. - Added `count` and `size` methods to `CoherentAllocation`. - Added method to obtain a reference to the `Device` from a `Devres` (this is super convenient

[PATCH v2 03/21] gpu: nova-core: derive useful traits for Chipset

2025-05-01 Thread Alexandre Courbot
We will commonly need to compare chipset versions, so derive the ordering traits to make that possible. Also derive Copy and Clone since passing Chipset by value will be more efficient than by reference. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/gpu.rs | 2 +- 1 file changed, 1

[PATCH v2 10/21] rust: make ETIMEDOUT error available

2025-05-01 Thread Alexandre Courbot
We will use this error in the nova-core driver. Signed-off-by: Alexandre Courbot --- rust/kernel/error.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index 3dee3139fcd4379b94748c0ba1965f4e1865b633..083c7b068cf4e185100de96e520c54437898ee72

[PATCH v2 19/21] gpu: nova-core: compute layout of the FRTS region

2025-05-01 Thread Alexandre Courbot
FWSEC-FRTS is run with the desired address of the FRTS region as parameter, which we need to compute depending on some hardware parameters. Do this in a `FbLayout` structure, that will be later extended to describe more memory regions used to boot the GSP. Signed-off-by: Alexandre Courbot

[PATCH v2 18/21] nova-core: Add support for VBIOS ucode extraction for boot

2025-05-01 Thread Alexandre Courbot
] [applied changes related to code reorg, prints etc from Danilo Krummrich] [acour...@nvidia.com: fix clippy warnings] Cc: Alexandre Courbot Cc: John Hubbard Cc: Shirish Baskaran Cc: Alistair Popple Cc: Timur Tabi Cc: Ben Skeggs Signed-off-by: Joel Fernandes Signed-off-by: Alexandre Courbot

[PATCH v2 15/21] gpu: nova-core: add falcon register definitions and base code

2025-05-01 Thread Alexandre Courbot
Add the common Falcon code and HAL for Ampere GPUs, and instantiate the GSP and SEC2 Falcons that will be required to boot the GSP. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/falcon.rs | 546 ++ drivers/gpu/nova-core/falcon/gsp.rs

[PATCH v2 16/21] gpu: nova-core: firmware: add ucode descriptor used by FWSEC-FRTS

2025-05-01 Thread Alexandre Courbot
FWSEC-FRTS is the first firmware we need to run on the GSP falcon in order to initiate the GSP boot process. Introduce the structure that describes it. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/firmware.rs | 43 +++ 1 file changed, 43

[PATCH v2 12/21] gpu: nova-core: add DMA object struct

2025-05-01 Thread Alexandre Courbot
Since we will need to allocate lots of distinct memory chunks to be shared between GPU and CPU, introduce a type dedicated to that. It is a light wrapper around CoherentAllocation. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/dma.rs | 60

[PATCH v2 11/21] gpu: nova-core: wait for GFW_BOOT completion

2025-05-01 Thread Alexandre Courbot
Upon reset, the GPU executes the GFW_BOOT firmware in order to initialize its base parameters such as clocks. The driver must ensure that this step is completed before using the hardware. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/devinit.rs | 43

[PATCH v2 21/21] gpu: nova-core: load and run FWSEC-FRTS

2025-05-01 Thread Alexandre Courbot
With all the required pieces in place, load FWSEC-FRTS onto the GSP falcon, run it, and check that it completed successfully by carving out the WPR2 region out of framebuffer memory. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/falcon.rs | 3 --- drivers/gpu/nova-core/gpu.rs

Re: [5/6] gpu: nova-core: Clarify fields in FalconAppifHdrV1

2025-04-24 Thread Alexandre Courbot
On Thu Apr 24, 2025 at 12:06 PM JST, Joel Fernandes wrote: > On April 24, 2025, 1:18 a.m. UTC > Alexandre Courbot wrote: >> Since this just renames fields, would you be ok if I squashed this one >> into the relevant patch of my series, alongside a >> >> [joelagn...

Re: [PATCH 03/16] gpu: nova-core: derive useful traits for Chipset

2025-04-24 Thread Alexandre Courbot
On Wed Apr 23, 2025 at 1:23 AM JST, Joel Fernandes wrote: > > > On 4/20/2025 8:19 AM, Alexandre Courbot wrote: >> We will commonly need to compare chipset versions, so derive the >> ordering traits to make that possible. Also derive Copy and Clone since >> passing Ch

Re: [PATCH 5/6] gpu: nova-core: Clarify fields in FalconAppifHdrV1

2025-04-23 Thread Alexandre Courbot
Since this just renames fields, would you be ok if I squashed this one into the relevant patch of my series, alongside a [joelagn...@nvidia.com: give better names to FalconAppifHdrV1's fields] ? On Thu Apr 24, 2025 at 7:54 AM JST, Joel Fernandes wrote: > Signed-off-by: Joel Fernandes > --- > d

Re: [PATCH 06/16] gpu: nova-core: define registers layout using helper macro

2025-04-28 Thread Alexandre Courbot
Hi Danilo, On Tue Apr 22, 2025 at 7:29 PM JST, Danilo Krummrich wrote: > On Sun, Apr 20, 2025 at 09:19:38PM +0900, Alexandre Courbot wrote: >> Add the register!() macro, which defines a given register's layout and >> provide bit-field accessors with a way to convert them to a

Re: [PATCH 08/16] gpu: nova-core: wait for GFW_BOOT completion

2025-04-29 Thread Alexandre Courbot
On Tue Apr 22, 2025 at 8:36 PM JST, Danilo Krummrich wrote: > On Sun, Apr 20, 2025 at 09:19:40PM +0900, Alexandre Courbot wrote: >> Upon reset, the GPU executes the GFW_BOOT firmware in order to >> initialize its base parameters such as clocks. The driver must ensure >> that t

Re: [PATCH 10/16] gpu: nova-core: add basic timer device

2025-04-29 Thread Alexandre Courbot
On Tue Apr 22, 2025 at 9:07 PM JST, Danilo Krummrich wrote: > On Sun, Apr 20, 2025 at 09:19:42PM +0900, Alexandre Courbot wrote: >> Add a timer that works with GPU time and provides the ability to wait on >> a condition with a specific timeout. > > What can this timer do for

Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-02 Thread Alexandre Courbot
On Sat May 3, 2025 at 4:59 AM JST, Joel Fernandes wrote: > Hello, Alex, > > On 5/2/2025 12:57 AM, Alexandre Courbot wrote: >> On Thu May 1, 2025 at 9:58 PM JST, Alexandre Courbot wrote: >>> From: Joel Fernandes >>> >>> This will be used in the nova

Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-03 Thread Alexandre Courbot
On Sat May 3, 2025 at 12:02 PM JST, Joel Fernandes wrote: > > > On 5/2/2025 9:59 PM, Alexandre Courbot wrote: >>> pub trait AlignUp { >>> fn align_up(self, alignment: Self) -> Self; >>> } >>> >>> macro_rules! align_up_impl { >>>

Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-01 Thread Alexandre Courbot
On Fri May 2, 2025 at 12:19 AM JST, Timur Tabi wrote: > On Thu, 2025-05-01 at 21:58 +0900, Alexandre Courbot wrote: > > >> +impl UsizeAlign for usize { >> +    fn align_up(mut self, align: usize) -> usize { >> +    self = (self + align - 1) &a

Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-01 Thread Alexandre Courbot
On Thu May 1, 2025 at 9:58 PM JST, Alexandre Courbot wrote: > From: Joel Fernandes > > This will be used in the nova-core driver where we need to upward-align > the image size to get to the next image in the VBIOS ROM. > > [acour...@nvidia.com: handled conflicts due to removal

Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-03 Thread Alexandre Courbot
On Sat May 3, 2025 at 12:02 PM JST, Joel Fernandes wrote: > > > On 5/2/2025 9:59 PM, Alexandre Courbot wrote: >>> pub trait AlignUp { >>> fn align_up(self, alignment: Self) -> Self; >>> } >>> >>> macro_rules! align_up_impl { >>>

[PATCH v3 10/19] gpu: nova-core: add DMA object struct

2025-05-07 Thread Alexandre Courbot
Since we will need to allocate lots of distinct memory chunks to be shared between GPU and CPU, introduce a type dedicated to that. It is a light wrapper around CoherentAllocation. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/dma.rs | 60

Re: [PATCH v2 17/21] rust: num: Add an upward alignment helper for usize

2025-05-07 Thread Alexandre Courbot
On Tue May 6, 2025 at 12:25 AM JST, Joel Fernandes wrote: >> Actually it may be a good idea to move this into its own patch/series so >> it gets more attention as this is starting to look like the `num` or >> `num_integer` crates and we might be well-advised to take more >> inspiration from them in

Re: [PATCH v2 09/21] gpu: nova-core: move Firmware to firmware module

2025-05-07 Thread Alexandre Courbot
On Sat May 3, 2025 at 6:14 AM JST, Timur Tabi wrote: > On Thu, 2025-05-01 at 21:58 +0900, Alexandre Courbot wrote: >> +pub(crate) const FIRMWARE_VERSION: &str = "535.113.01"; > > This needs to change to 570.144. You can find images to use here: > > https://githu

[PATCH v3 01/19] rust: dma: expose the count and size of CoherentAllocation

2025-05-07 Thread Alexandre Courbot
These properties are very useful to have and should be accessible. Signed-off-by: Alexandre Courbot --- rust/kernel/dma.rs | 14 ++ 1 file changed, 14 insertions(+) diff --git a/rust/kernel/dma.rs b/rust/kernel/dma.rs index 605e01e35715667f93297fd9ec49d8e7032e0910

[PATCH v3 02/19] gpu: nova-core: derive useful traits for Chipset

2025-05-07 Thread Alexandre Courbot
We will commonly need to compare chipset versions, so derive the ordering traits to make that possible. Also derive Copy and Clone since passing Chipset by value will be more efficient than by reference. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/gpu.rs | 2 +- 1 file changed, 1

[PATCH v3 00/19] nova-core: run FWSEC-FRTS to perform first stage of GSP initialization

2025-05-07 Thread Alexandre Courbot
order for a smooth review. [1] https://lore.kernel.org/rust-for-linux/20250503040802.1411285-1-joelagn...@nvidia.com/ Signed-off-by: Alexandre Courbot --- Changes in v3: - Rebased on top of latest nova-next. - Use the new Devres::access() and remove the now unneeded with_bar!() macro. - Dro

[PATCH v3 04/19] gpu: nova-core: take bound device in Gpu::new

2025-05-07 Thread Alexandre Courbot
We will need to perform things like allocating DMA memory during device creation, so make sure to take the device context that will allow us to perform these actions. This also allows us to use Devres::access to obtain the BAR without holding a RCU lock. Signed-off-by: Alexandre Courbot

[PATCH v3 17/19] gpu: nova-core: compute layout of the FRTS region

2025-05-07 Thread Alexandre Courbot
FWSEC-FRTS is run with the desired address of the FRTS region as parameter, which we need to compute depending on some hardware parameters. Do this in a `FbLayout` structure, that will be later extended to describe more memory regions used to boot the GSP. Signed-off-by: Alexandre Courbot

[PATCH v3 13/19] gpu: nova-core: add falcon register definitions and base code

2025-05-07 Thread Alexandre Courbot
Add the common Falcon code and HAL for Ampere GPUs, and instantiate the GSP and SEC2 Falcons that will be required to boot the GSP. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/falcon.rs | 540 ++ drivers/gpu/nova-core/falcon/gsp.rs

[PATCH v3 19/19] gpu: nova-core: load and run FWSEC-FRTS

2025-05-07 Thread Alexandre Courbot
With all the required pieces in place, load FWSEC-FRTS onto the GSP falcon, run it, and check that it successfully carved out the WPR2 region out of framebuffer memory. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/falcon.rs | 3 --- drivers/gpu/nova-core/gpu.rs| 57

[PATCH v3 15/19] rust: num: Add an upward alignment helper for usize

2025-05-07 Thread Alexandre Courbot
From: Joel Fernandes This will be used in the nova-core driver where we need to upward-align the image size to get to the next image in the VBIOS ROM. [acour...@nvidia.com: handled conflicts due to removal of patch creating num.rs] Signed-off-by: Joel Fernandes Signed-off-by: Alexandre

[PATCH v3 08/19] rust: make ETIMEDOUT error available

2025-05-07 Thread Alexandre Courbot
We will use this error in the nova-core driver. Signed-off-by: Alexandre Courbot --- rust/kernel/error.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index 3dee3139fcd4379b94748c0ba1965f4e1865b633..083c7b068cf4e185100de96e520c54437898ee72

[PATCH v3 18/19] gpu: nova-core: extract FWSEC from BIOS and patch it to run FWSEC-FRTS

2025-05-07 Thread Alexandre Courbot
x27;s fields] Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/dma.rs| 3 - drivers/gpu/nova-core/firmware.rs | 18 ++ drivers/gpu/nova-core/firmware/fwsec.rs | 359 drivers/gpu/nova-core/gpu.rs| 20 +- drivers/gpu/nova

[PATCH v3 05/19] gpu: nova-core: define registers layout using helper macro

2025-05-07 Thread Alexandre Courbot
accessors. Suggested-by: Danilo Krummrich Signed-off-by: Alexandre Courbot --- Documentation/gpu/nova/core/todo.rst | 6 + drivers/gpu/nova-core/gpu.rs | 10 +- drivers/gpu/nova-core/regs.rs| 61 ++ drivers/gpu/nova-core/regs/macros.rs | 380

[PATCH v3 07/19] gpu: nova-core: move Firmware to firmware module

2025-05-07 Thread Alexandre Courbot
We will extend the firmware methods, so move it to its own module instead to keep gpu.rs focused. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/firmware.rs | 46 +-- drivers/gpu/nova-core/gpu.rs | 35 +++-- 2 files

[PATCH v3 09/19] gpu: nova-core: wait for GFW_BOOT completion

2025-05-07 Thread Alexandre Courbot
Upon reset, the GPU executes the GFW_BOOT firmware in order to initialize its base parameters such as clocks. The driver must ensure that this step is completed before using the hardware. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/devinit.rs | 38

[PATCH v3 11/19] gpu: nova-core: register sysmem flush page

2025-05-07 Thread Alexandre Courbot
A page of system memory is reserved so sysmembar can perform a read on it if a system write occurred since the last flush. Do this early as it can be required to e.g. reset the GPU falcons. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/gpu.rs | 45

[PATCH v3 12/19] gpu: nova-core: add helper function to wait on condition

2025-05-07 Thread Alexandre Courbot
`read_poll_timeout` [1] once it is available. [1] https://lore.kernel.org/lkml/20250220070611.214262-8-fujita.tomon...@gmail.com/ Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/util.rs | 30 ++ 1 file changed, 30 insertions(+) diff --git a/drivers/gpu/nova

[PATCH v3 06/19] gpu: nova-core: fix layout of NV_PMC_BOOT_0

2025-05-07 Thread Alexandre Courbot
at a different location than the rest of its bits. Redefine the register layout to match its actual definition as provided by OpenRM and expose the fully-constructed "architecture" field through our own "Architecture" type. The "chipset" pseudo-field is also u

[PATCH v3 14/19] gpu: nova-core: firmware: add ucode descriptor used by FWSEC-FRTS

2025-05-07 Thread Alexandre Courbot
FWSEC-FRTS is the first firmware we need to run on the GSP falcon in order to initiate the GSP boot process. Introduce the structure that describes it. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/firmware.rs | 43 +++ 1 file changed, 43

[PATCH RFC 1/3] rust: add useful ops for u64

2025-02-17 Thread Alexandre Courbot
will be extended with other useful operations, and similar extension traits implemented for other types. Signed-off-by: Alexandre Courbot --- rust/kernel/lib.rs | 1 + rust/kernel/num.rs | 32 2 files changed, 33 insertions(+) diff --git a/rust/kernel/lib.rs b

[PATCH RFC 3/3] gpu: nova-core: add basic timer device

2025-02-17 Thread Alexandre Courbot
in the current code), but they seem to be monomorphized as well. Calling extra functions could work better, but looks also less elegant to me, so I am really open to suggestions here. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/driver.rs| 4 +- drivers/gpu/nova-core/gp

[PATCH RFC 2/3] rust: make ETIMEDOUT error available

2025-02-17 Thread Alexandre Courbot
Signed-off-by: Alexandre Courbot --- rust/kernel/error.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index f6ecf09cb65f4ebe9b88da68b3830ae79aa4f182..8858eb13b3df674b54572d2a371b8ec1303492dd 100644 --- a/rust/kernel/error.rs +++ b/rust/kernel

[RFC PATCH 0/3] gpu: nova-core: add basic timer subdevice implementation

2025-02-17 Thread Alexandre Courbot
eful for other drivers as well. The last patch is the naive implementation of the timer device. I don't expect it to stay this way at all, so please point out all the deficiencies in this very early code! :) [1] https://lore.kernel.org/nouveau/20250209173048.17398-1-d...@kernel.org/ Si

Re: [PATCH RFC 1/3] rust: add useful ops for u64

2025-02-18 Thread Alexandre Courbot
On Wed Feb 19, 2025 at 5:51 AM JST, Timur Tabi wrote: > On Tue, 2025-02-18 at 22:16 +0900, Alexandre Courbot wrote: >> > A proper struct with `high` and `low` might be more verbose, but >> > it rules out this issue. >> >> Mmm indeed, so we would have clien

Re: [PATCH RFC 1/3] rust: add useful ops for u64

2025-02-18 Thread Alexandre Courbot
Hi Daniel! On Tue Feb 18, 2025 at 6:10 AM JST, Daniel Almeida wrote: > Hi Alex, > >> On 17 Feb 2025, at 11:04, Alexandre Courbot wrote: >> >> It is common to build a u64 from its high and low parts obtained from >> two 32-bit registers. Conversely, it is also com

Re: [RFC PATCH 0/3] gpu: nova-core: add basic timer subdevice implementation

2025-02-18 Thread Alexandre Courbot
On Tue Feb 18, 2025 at 5:07 PM JST, Greg KH wrote: > On Mon, Feb 17, 2025 at 04:48:13PM +0100, Simona Vetter wrote: >> On Mon, Feb 17, 2025 at 11:04:45PM +0900, Alexandre Courbot wrote: >> > Hi everyone, >> > >> > This short RFC is based on top of Danilo'

Re: [RFC PATCH 0/3] gpu: nova-core: add basic timer subdevice implementation

2025-02-18 Thread Alexandre Courbot
Hi Danilo, On Tue Feb 18, 2025 at 6:33 AM JST, Danilo Krummrich wrote: > Hi Alex, > > On Mon, Feb 17, 2025 at 11:04:45PM +0900, Alexandre Courbot wrote: >> Hi everyone, >> >> This short RFC is based on top of Danilo's initial driver stub series >> [1] and ha

Re: [PATCH RFC 1/3] rust: add useful ops for u64

2025-02-18 Thread Alexandre Courbot
On Tue Feb 18, 2025 at 7:07 PM JST, Dirk Behme wrote: > On 17/02/2025 15:04, Alexandre Courbot wrote: >> It is common to build a u64 from its high and low parts obtained from >> two 32-bit registers. Conversely, it is also common to split a u64 into >> two u32s to write them i

Re: [RFC PATCH 0/3] gpu: nova-core: add basic timer subdevice implementation

2025-02-18 Thread Alexandre Courbot
Hi Dave, On Tue Feb 18, 2025 at 10:42 AM JST, Dave Airlie wrote: > On Tue, 18 Feb 2025 at 00:04, Alexandre Courbot wrote: >> >> Hi everyone, >> >> This short RFC is based on top of Danilo's initial driver stub series >> [1] and has for goal to initiate

Re: [PATCH RFC 1/3] rust: add useful ops for u64

2025-02-19 Thread Alexandre Courbot
On Wed Feb 19, 2025 at 12:24 PM JST, John Hubbard wrote: > On 2/18/25 5:21 PM, Alexandre Courbot wrote: >> On Wed Feb 19, 2025 at 5:51 AM JST, Timur Tabi wrote: >>> On Tue, 2025-02-18 at 22:16 +0900, Alexandre Courbot wrote: > ... >> More likely this would be something l

[PATCH RFC v2 2/5] rust: make ETIMEDOUT error available

2025-03-04 Thread Alexandre Courbot
Signed-off-by: Alexandre Courbot --- rust/kernel/error.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index 1e510181432cceae46219f7ed3597a88b85ebe0a..475d14a4830774aa7717d3b5e70c7ff9de203dc2 100644 --- a/rust/kernel/error.rs +++ b/rust/kernel

[PATCH RFC v2 1/5] rust: add useful ops for u64

2025-03-04 Thread Alexandre Courbot
will be extended with other useful operations, and similar extension traits implemented for other types. Signed-off-by: Alexandre Courbot --- rust/kernel/lib.rs | 1 + rust/kernel/num.rs | 43 +++ 2 files changed, 44 insertions(+) diff --git a/rust/kernel

[PATCH RFC v2 3/5] gpu: nova-core: add register definition macro

2025-03-04 Thread Alexandre Courbot
cause of an invalid value. The ending string at the end of each line is optional, and expands to doc comments for the type itself, or each of the field accessors. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/gpu.rs | 2 +- drivers/gpu/nova-core/regs.rs | 195 +++

[PATCH RFC v2 4/5] gpu: nova-core: add basic timer device

2025-03-04 Thread Alexandre Courbot
in the current code), but they seem to be monomorphized as well. Calling extra functions could work better, but looks also less elegant to me, so I am really open to suggestions here. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/driver.rs| 4 +- drivers/gpu/nova-core/gpu

[PATCH RFC v2 5/5] gpu: nova-core: add falcon register definitions and probe code

2025-03-04 Thread Alexandre Courbot
This is still very preliminary work, and is mostly designed to show how register fields can be turned into safe types that force us to handle invalid values. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/driver.rs| 2 +- drivers/gpu/nova-core/falcon.rs| 124

Re: [PATCH v4 5/6] gpu: nova-core: add initial driver stub

2025-03-04 Thread Alexandre Courbot
Hi Danilo, On Thu Feb 27, 2025 at 2:55 AM JST, Danilo Krummrich wrote: > Add the initial nova-core driver stub. > > nova-core is intended to serve as a common base for nova-drm (the > corresponding DRM driver) and the vGPU manager VFIO driver, serving as a > hard- and firmware abstraction layer fo

[RFC PATCH v2 0/5] gpu: nova-core: register definitions and basic timer and falcon devices

2025-03-04 Thread Alexandre Courbot
ation to define more registers and exercise the register definition macro. - Link to v1: https://lore.kernel.org/r/20250217-nova_timer-v1-0-78c5ace2d...@nvidia.com --- Alexandre Courbot (5): rust: add useful ops for u64 rust: make ETIMEDOUT error available gpu: nova-core: add regis

Re: [PATCH v5 5/5] gpu: nova-core: add initial documentation

2025-03-06 Thread Alexandre Courbot
rastructure. > > Signed-off-by: Danilo Krummrich Reviewed-by: Alexandre Courbot Thanks for this - the todo list in particular is super helpful to understand which components outside of the driver we need to include or drive to completion.

Re: [PATCH v5 4/5] gpu: nova-core: add initial driver stub

2025-03-06 Thread Alexandre Courbot
gmx28B3BQ?si=sBdSEer4tAPKGpOs [3] > Signed-off-by: Danilo Krummrich A couple of nits inline below, but feel free to add my Reviewed-by: Alexandre Courbot > --- > MAINTAINERS| 10 ++ > drivers/gpu/Makefile | 1 + > drivers/gpu/nova-core/K

Re: [PATCH RFC 1/3] rust: add useful ops for u64

2025-02-21 Thread Alexandre Courbot
On Thu Feb 20, 2025 at 9:14 AM JST, John Hubbard wrote: > On 2/19/25 3:13 PM, Daniel Almeida wrote: >>> On 19 Feb 2025, at 17:23, Dave Airlie wrote: >>> On Thu, 20 Feb 2025 at 06:22, John Hubbard wrote: >>>> On 2/19/25 4:51 AM, Alexandre Courbot wrote: >>&

Re: [RFC PATCH 0/3] gpu: nova-core: add basic timer subdevice implementation

2025-02-23 Thread Alexandre Courbot
On Tue Feb 18, 2025 at 10:46 AM JST, Dave Airlie wrote: >> 1. How to avoid unnecessary calls to try_access(). >> >> This is why I made Boot0.read() take a &RevocableGuard<'_, Bar0> as >> argument. I >> think we can just call try_access() once and then propage the guard through >> the >> callchain

Re: [RFC PATCH 0/3] gpu: nova-core: add basic timer subdevice implementation

2025-02-25 Thread Alexandre Courbot
On Mon Feb 24, 2025 at 9:07 PM JST, Danilo Krummrich wrote: > CC: Gary > > On Mon, Feb 24, 2025 at 10:40:00AM +0900, Alexandre Courbot wrote: >> This inability to sleep while we are accessing registers seems very >> constraining to me, if not dangerous. It is pretty common

Re: [RFC PATCH 0/3] gpu: nova-core: add basic timer subdevice implementation

2025-02-25 Thread Alexandre Courbot
On Wed Feb 26, 2025 at 12:06 AM JST, Danilo Krummrich wrote: > On Tue, Feb 25, 2025 at 11:11:07PM +0900, Alexandre Courbot wrote: >> On Mon Feb 24, 2025 at 9:07 PM JST, Danilo Krummrich wrote: >> > CC: Gary >> > >> > On Mon, Feb 24, 2025 at 10:40:00AM +0900,

[PATCH RFC v3 5/7] gpu: nova-core: use register!() to define register layout

2025-03-20 Thread Alexandre Courbot
Use the register!() macro to define the layout for the Boot0 register and use its accessors through the use of the convenience with_bar!() macro, which uses Revocable::try_access() and converts its returned Option into the proper error as needed. Signed-off-by: Alexandre Courbot --- drivers/gpu

Re: [PATCH RFC v3 6/7] gpu: nova-core: add basic timer device

2025-03-23 Thread Alexandre Courbot
On Sat Mar 22, 2025 at 1:20 AM JST, Daniel Brooks wrote: > "Alexandre Courbot" writes: > >> Hi Boqun, >> >> On Fri Mar 21, 2025 at 3:17 AM JST, Boqun Feng wrote: >>> Also an Instant type has been proposed and reviewed for a while: >>>

[PATCH v3 03/19] gpu: nova-core: add missing GA100 definition

2025-05-07 Thread Alexandre Courbot
linux-firmware contains a directory for GA100, and it is a defined chipset in Nouveau. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/gpu.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs index

[PATCH v3 16/19] nova-core: Add support for VBIOS ucode extraction for boot

2025-05-07 Thread Alexandre Courbot
] [applied changes related to code reorg, prints etc from Danilo Krummrich] [acour...@nvidia.com: fix clippy warnings] [acour...@nvidia.com: remove now-unneeded Devres acquisition] [acour...@nvidia.com: fix read_more to read `len` bytes, not u32s] Cc: Alexandre Courbot Cc: John Hubbard Cc: Shirish

Re: [PATCH v3 09/19] gpu: nova-core: wait for GFW_BOOT completion

2025-05-16 Thread Alexandre Courbot
On Tue May 13, 2025 at 11:07 PM JST, Danilo Krummrich wrote: > On Wed, May 07, 2025 at 10:52:36PM +0900, Alexandre Courbot wrote: >> Upon reset, the GPU executes the GFW_BOOT firmware in order to >> initialize its base parameters such as clocks. The driver must ensure >&

Re: [PATCH v3 13/19] gpu: nova-core: add falcon register definitions and base code

2025-05-16 Thread Alexandre Courbot
On Wed May 14, 2025 at 1:19 AM JST, Danilo Krummrich wrote: >> +util::wait_on(Duration::from_millis(20), || { >> +let r = regs::NV_PFALCON_FALCON_HWCFG2::read(bar, E::BASE); >> +if r.mem_scrubbing() { >> +Some(()) >> +} else { >> +

Re: [PATCH v3 17/19] gpu: nova-core: compute layout of the FRTS region

2025-05-17 Thread Alexandre Courbot
On Wed May 14, 2025 at 1:41 AM JST, Danilo Krummrich wrote: >> diff --git a/drivers/gpu/nova-core/gsp/fb.rs >> b/drivers/gpu/nova-core/gsp/fb.rs >> new file mode 100644 >> index >> ..f28ded59469d52daf39e5d19c09efd7bf08fee92 >> --- /dev/null >> +++ b/driver

[PATCH v4 09/20] gpu: nova-core: increase BAR0 size to 16MB

2025-05-21 Thread Alexandre Courbot
The Turing+ register address space spans over that range, so increase it as future patches will access more registers. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/driver.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/nova-core/driver.rs b

[PATCH v4 12/20] gpu: nova-core: add DMA object struct

2025-05-21 Thread Alexandre Courbot
Since we will need to allocate lots of distinct memory chunks to be shared between GPU and CPU, introduce a type dedicated to that. It is a light wrapper around CoherentAllocation. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/dma.rs | 61

[PATCH v4 11/20] gpu: nova-core: wait for GFW_BOOT completion

2025-05-21 Thread Alexandre Courbot
Upon reset, the GPU executes the GFW (GPU Firmware) in order to initialize its base parameters such as clocks. The driver must ensure that this step is completed before using the hardware. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/gfw.rs | 37

[PATCH v4 06/20] gpu: nova-core: add delimiter for helper rules in register!() macro

2025-05-21 Thread Alexandre Courbot
This macro is pretty complex, and most rules are just helper, so add a delimiter to indicate when users only interested in using it can stop reading. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/nova

[PATCH v4 05/20] gpu: nova-core: use absolute paths in register!() macro

2025-05-20 Thread Alexandre Courbot
Fix the paths that were not absolute to prevent a potential local module from being picked up. 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

[PATCH v4 08/20] gpu: nova-core: allow register aliases

2025-05-20 Thread Alexandre Courbot
, and with different fields and documentation. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/regs/macros.rs | 40 ++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nova-core/regs/macros.rs b/drivers/gpu/nova-core/regs/macr

[PATCH v4 00/20] nova-core: run FWSEC-FRTS to perform first stage of GSP initialization

2025-05-20 Thread Alexandre Courbot
a.com/ Signed-off-by: Alexandre Courbot --- Changes in v4: - Improve documentation of falcon security modes (thanks Joel!) - Add the definition of the size of CoherentAllocation as one of its invariants. - Better document GFW boot progress, registers and use wait_on() helper, and move it to `gfw` m

[PATCH v4 07/20] gpu: nova-core: expose the offset of each register as a type constant

2025-05-20 Thread Alexandre Courbot
Although we want to access registers using the provided methods, it is sometimes needed to use their raw offset, for instance when working with a register array. Expose the offset of each register using a type constant to avoid resorting to hardcoded values. Signed-off-by: Alexandre Courbot

[PATCH v4 03/20] rust: sizes: add constants up to SZ_2G

2025-05-20 Thread Alexandre Courbot
nova-core will need to use SZ_1M, so make the remaining constants available. Signed-off-by: Alexandre Courbot --- rust/kernel/sizes.rs | 24 1 file changed, 24 insertions(+) diff --git a/rust/kernel/sizes.rs b/rust/kernel/sizes.rs index

[PATCH v4 02/20] rust: make ETIMEDOUT error available

2025-05-20 Thread Alexandre Courbot
We will use this error in the nova-core driver. Signed-off-by: Alexandre Courbot --- rust/kernel/error.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index 3dee3139fcd4379b94748c0ba1965f4e1865b633..083c7b068cf4e185100de96e520c54437898ee72

[PATCH v4 14/20] gpu: nova-core: add falcon register definitions and base code

2025-05-20 Thread Alexandre Courbot
Add the common Falcon code and HAL for Ampere GPUs, and instantiate the GSP and SEC2 Falcons that will be required to boot the GSP. Signed-off-by: Alexandre Courbot --- drivers/gpu/nova-core/falcon.rs | 560 ++ drivers/gpu/nova-core/falcon/gsp.rs

[PATCH v4 04/20] rust: add new `num` module with useful integer operations

2025-05-20 Thread Alexandre Courbot
dropped as we need to use wrapping operations, which are not provided by any trait. Co-developed-by: Joel Fernandes Signed-off-by: Joel Fernandes Signed-off-by: Alexandre Courbot --- rust/kernel/lib.rs | 1 + rust/kernel/num.rs | 82 ++ 2 files

<    1   2   3   4   5   6   7   >