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

Alexandre Courbot posted 16 patches 9 months, 3 weeks ago
There is a newer version of this series
Documentation/gpu/nova/core/todo.rst      |    6 +
drivers/gpu/nova-core/devinit.rs          |   40 ++
drivers/gpu/nova-core/dma.rs              |   54 ++
drivers/gpu/nova-core/driver.rs           |    2 +-
drivers/gpu/nova-core/falcon.rs           |  466 ++++++++++++
drivers/gpu/nova-core/falcon/gsp.rs       |   27 +
drivers/gpu/nova-core/falcon/hal.rs       |   54 ++
drivers/gpu/nova-core/falcon/hal/ga102.rs |  111 +++
drivers/gpu/nova-core/falcon/sec2.rs      |    9 +
drivers/gpu/nova-core/firmware.rs         |   90 ++-
drivers/gpu/nova-core/firmware/fwsec.rs   |  340 +++++++++
drivers/gpu/nova-core/gpu.rs              |  211 ++++--
drivers/gpu/nova-core/gsp.rs              |    3 +
drivers/gpu/nova-core/gsp/fb.rs           |  109 +++
drivers/gpu/nova-core/nova_core.rs        |   24 +
drivers/gpu/nova-core/regs.rs             |  304 ++++++--
drivers/gpu/nova-core/regs/macros.rs      |  297 ++++++++
drivers/gpu/nova-core/timer.rs            |  130 ++++
drivers/gpu/nova-core/vbios.rs            | 1100 +++++++++++++++++++++++++++++
rust/kernel/error.rs                      |    1 +
rust/kernel/lib.rs                        |    1 +
rust/kernel/num.rs                        |   52 ++
22 files changed, 3347 insertions(+), 84 deletions(-)
[PATCH 00/16] nova-core: run FWSEC-FRTS to perform first stage of GSP initialization
Posted by Alexandre Courbot 9 months, 3 weeks ago
Hi everyone,

This series is a continuation of my previous RFCs [1] to complete the
first step of GSP booting (running the FWSEC-FRTS firmware extracted
from the BIOS) on Ampere devices. While it is still far from bringing
the GPU into a state where it can do anything useful, it sets up the
basic layout of the driver upon which we can build in order to continue
with the next steps of GSP booting, as well as supporting more chipsets.

Upon successful probe, the driver will display the range of the WPR2
region constructed by FWSEC-FRTS:

  [   95.436000] NovaCore 0000:01:00.0: WPR2: 0xffc00000-0xffce0000
  [   95.436002] NovaCore 0000:01:00.0: GPU instance built

This code is based on nova-next with the try_access_with patch [2].

There is still a bit of unsafe code where it is not desired, notably to
transmute byte slices into types that implement FromBytes - this is
because support for doing such transmute operations safely are not in
the kernel crate yet.

[1] https://lore.kernel.org/rust-for-linux/20250320-nova_timer-v3-0-79aa2ad25a79@nvidia.com/
[2] https://lore.kernel.org/rust-for-linux/20250411-try_with-v4-0-f470ac79e2e2@nvidia.com/

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
Alexandre Courbot (15):
      rust: add useful ops for u64
      rust: make ETIMEDOUT error available
      gpu: nova-core: derive useful traits for Chipset
      gpu: nova-core: add missing GA100 definition
      gpu: nova-core: take bound device in Gpu::new
      gpu: nova-core: define registers layout using helper macro
      gpu: nova-core: move Firmware to firmware module
      gpu: nova-core: wait for GFW_BOOT completion
      gpu: nova-core: register sysmem flush page
      gpu: nova-core: add basic timer device
      gpu: nova-core: add falcon register definitions and base code
      gpu: nova-core: firmware: add ucode descriptor used by FWSEC-FRTS
      gpu: nova-core: compute layout of the FRTS region
      gpu: nova-core: extract FWSEC from BIOS and patch it to run FWSEC-FRTS
      gpu: nova-core: load and run FWSEC-FRTS

Joel Fernandes (1):
      gpu: nova-core: Add support for VBIOS ucode extraction for boot

 Documentation/gpu/nova/core/todo.rst      |    6 +
 drivers/gpu/nova-core/devinit.rs          |   40 ++
 drivers/gpu/nova-core/dma.rs              |   54 ++
 drivers/gpu/nova-core/driver.rs           |    2 +-
 drivers/gpu/nova-core/falcon.rs           |  466 ++++++++++++
 drivers/gpu/nova-core/falcon/gsp.rs       |   27 +
 drivers/gpu/nova-core/falcon/hal.rs       |   54 ++
 drivers/gpu/nova-core/falcon/hal/ga102.rs |  111 +++
 drivers/gpu/nova-core/falcon/sec2.rs      |    9 +
 drivers/gpu/nova-core/firmware.rs         |   90 ++-
 drivers/gpu/nova-core/firmware/fwsec.rs   |  340 +++++++++
 drivers/gpu/nova-core/gpu.rs              |  211 ++++--
 drivers/gpu/nova-core/gsp.rs              |    3 +
 drivers/gpu/nova-core/gsp/fb.rs           |  109 +++
 drivers/gpu/nova-core/nova_core.rs        |   24 +
 drivers/gpu/nova-core/regs.rs             |  304 ++++++--
 drivers/gpu/nova-core/regs/macros.rs      |  297 ++++++++
 drivers/gpu/nova-core/timer.rs            |  130 ++++
 drivers/gpu/nova-core/vbios.rs            | 1100 +++++++++++++++++++++++++++++
 rust/kernel/error.rs                      |    1 +
 rust/kernel/lib.rs                        |    1 +
 rust/kernel/num.rs                        |   52 ++
 22 files changed, 3347 insertions(+), 84 deletions(-)
---
base-commit: 96609a1969f4ade45351ec368c65580c77592e8b
change-id: 20250417-nova-frts-96ef299abe2c
prerequisite-change-id: 20250313-try_with-cc9f91dd3b60:v4
prerequisite-patch-id: b0c2d08bdea8193307c43c04aa9ff96baf6b00e1
prerequisite-patch-id: b6d1232c2dfef24e4d3f8753a198eb6c427c3486

Best regards,
-- 
Alexandre Courbot <acourbot@nvidia.com>
Re: [PATCH 00/16] nova-core: run FWSEC-FRTS to perform first stage of GSP initialization
Posted by Danilo Krummrich 9 months, 3 weeks ago
On Sun, Apr 20, 2025 at 09:19:32PM +0900, Alexandre Courbot wrote:
> Hi everyone,
> 
> This series is a continuation of my previous RFCs [1] to complete the
> first step of GSP booting (running the FWSEC-FRTS firmware extracted
> from the BIOS) on Ampere devices. While it is still far from bringing
> the GPU into a state where it can do anything useful, it sets up the
> basic layout of the driver upon which we can build in order to continue
> with the next steps of GSP booting, as well as supporting more chipsets.
> 
> Upon successful probe, the driver will display the range of the WPR2
> region constructed by FWSEC-FRTS:
> 
>   [   95.436000] NovaCore 0000:01:00.0: WPR2: 0xffc00000-0xffce0000
>   [   95.436002] NovaCore 0000:01:00.0: GPU instance built
> 
> This code is based on nova-next with the try_access_with patch [2].

Please make sure to compile with CLIPPY=1, the series has quite some clippy
warnings.

I also noticed that there are a lot of compiler warnings about unreachable pub
fields with rustc 1.78, whereas with the latest stable compiler there are none.

I'm not exactly sure why that is (and I haven't looked further), but the
corresponding fields indeed seem to have unnecessary pub visibility.

> There is still a bit of unsafe code where it is not desired, notably to
> transmute byte slices into types that implement FromBytes - this is
> because support for doing such transmute operations safely are not in
> the kernel crate yet.

I assume you refer to [3]? As long as we put a TODO and follow up once the
series lands, that's fine for me.

> 
> [1] https://lore.kernel.org/rust-for-linux/20250320-nova_timer-v3-0-79aa2ad25a79@nvidia.com/
> [2] https://lore.kernel.org/rust-for-linux/20250411-try_with-v4-0-f470ac79e2e2@nvidia.com/
[3] https://lore.kernel.org/lkml/20250330234039.29814-1-christiansantoslima21@gmail.com/
Re: [PATCH 00/16] nova-core: run FWSEC-FRTS to perform first stage of GSP initialization
Posted by Alexandre Courbot 9 months, 3 weeks ago
Hi Danilo,

On Tue Apr 22, 2025 at 5:40 PM JST, Danilo Krummrich wrote:
> On Sun, Apr 20, 2025 at 09:19:32PM +0900, Alexandre Courbot wrote:
>> Hi everyone,
>> 
>> This series is a continuation of my previous RFCs [1] to complete the
>> first step of GSP booting (running the FWSEC-FRTS firmware extracted
>> from the BIOS) on Ampere devices. While it is still far from bringing
>> the GPU into a state where it can do anything useful, it sets up the
>> basic layout of the driver upon which we can build in order to continue
>> with the next steps of GSP booting, as well as supporting more chipsets.
>> 
>> Upon successful probe, the driver will display the range of the WPR2
>> region constructed by FWSEC-FRTS:
>> 
>>   [   95.436000] NovaCore 0000:01:00.0: WPR2: 0xffc00000-0xffce0000
>>   [   95.436002] NovaCore 0000:01:00.0: GPU instance built
>> 
>> This code is based on nova-next with the try_access_with patch [2].
>
> Please make sure to compile with CLIPPY=1, the series has quite some clippy
> warnings.

Indeed, I just tried and it wasn't pretty - sorry for the omission.

>
> I also noticed that there are a lot of compiler warnings about unreachable pub
> fields with rustc 1.78, whereas with the latest stable compiler there are none.
>
> I'm not exactly sure why that is (and I haven't looked further), but the
> corresponding fields indeed seem to have unnecessary pub visibility.

I'll try building with 1.78 and fix that.

>
>> There is still a bit of unsafe code where it is not desired, notably to
>> transmute byte slices into types that implement FromBytes - this is
>> because support for doing such transmute operations safely are not in
>> the kernel crate yet.
>
> I assume you refer to [3]? As long as we put a TODO and follow up once the
> series lands, that's fine for me.

Yes, that's the idea. Will do.

>
>> 
>> [1] https://lore.kernel.org/rust-for-linux/20250320-nova_timer-v3-0-79aa2ad25a79@nvidia.com/
>> [2] https://lore.kernel.org/rust-for-linux/20250411-try_with-v4-0-f470ac79e2e2@nvidia.com/
> [3] https://lore.kernel.org/lkml/20250330234039.29814-1-christiansantoslima21@gmail.com/