Skip to content

Commit 299eb32

Browse files
apopple-nvidiaGnurou
authored andcommitted
gpu: nova-core: Add base files for r570.144 firmware bindings
Interacting with the GSP currently requires using definitions from C header files. Rust definitions for the types needed for Nova core will be generated using the Rust bindgen tool. This patch adds the base module to allow inclusion of the generated bindings. The generated bindings themselves are added by subsequent patches when they are first used. Currently we only intend to support a single firmware version, 570.144, with these bindings. Longer term we intend to move to a more stable GSP interface that isn't tied to specific firmware versions. Signed-off-by: Alistair Popple <[email protected]> Reviewed-by: John Hubbard <[email protected]> [[email protected]: adapt the bindings module comment a bit] Acked-by: Danilo Krummrich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Courbot <[email protected]>
1 parent cb05748 commit 299eb32

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

drivers/gpu/nova-core/gsp.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ mod boot;
44

55
use kernel::prelude::*;
66

7+
mod fw;
8+
79
pub(crate) const GSP_PAGE_SHIFT: usize = 12;
810
pub(crate) const GSP_PAGE_SIZE: usize = 1 << GSP_PAGE_SHIFT;
911

drivers/gpu/nova-core/gsp/fw.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
3+
mod r570_144;
4+
5+
// Alias to avoid repeating the version number with every use.
6+
#[expect(unused)]
7+
use r570_144 as bindings;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
3+
//! Firmware bindings.
4+
//!
5+
//! Imports the generated bindings by `bindgen`.
6+
//!
7+
//! This module may not be directly used. Please abstract or re-export the needed symbols in the
8+
//! parent module instead.
9+
10+
#![cfg_attr(test, allow(deref_nullptr))]
11+
#![cfg_attr(test, allow(unaligned_references))]
12+
#![cfg_attr(test, allow(unsafe_op_in_unsafe_fn))]
13+
#![allow(
14+
dead_code,
15+
unused_imports,
16+
clippy::all,
17+
clippy::undocumented_unsafe_blocks,
18+
clippy::ptr_as_ptr,
19+
clippy::ref_as_ptr,
20+
missing_docs,
21+
non_camel_case_types,
22+
non_upper_case_globals,
23+
non_snake_case,
24+
improper_ctypes,
25+
unreachable_pub,
26+
unsafe_op_in_unsafe_fn
27+
)]
28+
use kernel::ffi;
29+
include!("r570_144/bindings.rs");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// SPDX-License-Identifier: GPL-2.0

0 commit comments

Comments
 (0)