diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2026-11-21 17:22:21 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-11-21 17:22:21 -0800 |
| commit | 4843f6873f7c4835e62f2c73ba0fd538e57a2f22 (patch) | |
| tree | ee620501a1ffbad9a83141e3a70154e1fe641040 /drivers/gpu/nova-core/nova_core.rs | |
| download | linux-master.tar.gz linux-master.zip | |
Merge tag 'sysctl-7.04-fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctlgraftedHEADmaster
Pull sysctl fix from Joel Granados:
"Fix sysctl jiffy / milliseconds conversion:
- Writing a previously read value "X" shall keep the same "X" value
- Remove truncation that was causing incorrect saturation of valid
timeouts"
* tag 'sysctl-7.04-fixes-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl:
sysctl: Do jiffy / ms conversion in ulong space
Diffstat (limited to 'drivers/gpu/nova-core/nova_core.rs')
| -rw-r--r-- | drivers/gpu/nova-core/nova_core.rs | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/drivers/gpu/nova-core/nova_core.rs b/drivers/gpu/nova-core/nova_core.rs new file mode 100644 index 000000000..a8f6dc220 --- /dev/null +++ b/drivers/gpu/nova-core/nova_core.rs @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0 + +//! Nova Core GPU Driver + +use kernel::{ + debugfs, + driver::Registration, + pci, + prelude::*, + InPlaceModule, // +}; + +pub mod api; +mod driver; +mod falcon; +mod fb; +mod firmware; +mod fsp; +mod gpu; +mod gsp; +mod irq; +mod mctp; +mod mm; +#[macro_use] +mod num; +mod regs; +mod sbuffer; +#[cfg(CONFIG_NOVA_CORE_SELFTESTS)] +mod selftest; +mod vbios; +mod vgpu; + +pub(crate) const MODULE_NAME: &core::ffi::CStr = <LocalModule as kernel::ModuleMetadata>::NAME; + +// TODO: Move this into per-module data once that exists. +static mut DEBUGFS_ROOT: Option<debugfs::Dir> = None; + +/// Guard that clears `DEBUGFS_ROOT` when dropped. +struct DebugfsRootGuard; + +impl Drop for DebugfsRootGuard { + fn drop(&mut self) { + // SAFETY: This guard is dropped after `_driver` (due to field order), + // so the driver is unregistered and no probe() can be running. + unsafe { DEBUGFS_ROOT = None }; + } +} + +#[pin_data] +struct NovaCoreModule { + // Fields are dropped in declaration order, so `_driver` is dropped first, + // then `_debugfs_guard` clears `DEBUGFS_ROOT`. + #[pin] + _driver: Registration<pci::Adapter<driver::NovaCoreDriver>>, + _debugfs_guard: DebugfsRootGuard, +} + +impl InPlaceModule for NovaCoreModule { + fn init(module: &'static kernel::ThisModule) -> impl PinInit<Self, Error> { + let dir = debugfs::Dir::new(c"nova-core"); + + // SAFETY: We are the only driver code running during init, so there + // cannot be any concurrent access to `DEBUGFS_ROOT`. + unsafe { DEBUGFS_ROOT = Some(dir) }; + + try_pin_init!(Self { + _driver <- Registration::new(MODULE_NAME, module), + _debugfs_guard: DebugfsRootGuard, + }) + } +} + +module! { + type: NovaCoreModule, + name: "nova-core", + authors: ["Danilo Krummrich"], + description: "Nova Core GPU driver", + license: "GPL v2", + firmware: [], +} + +kernel::module_firmware!(firmware::ModInfoBuilder); |
