summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJoel Fernandes <joelagnelf@nvidia.com>2026-08-27 17:51:44 +0900
committerAlexandre Courbot <acourbot@nvidia.com>2026-09-07 11:54:11 +0900
commitd3bd73dcf51d88ae116a574ce2f49209c7b48944 (patch)
treed02ca3c8e843facdcaa7747ce397b31f073d3e95 /drivers
parent8e43629439b7bbdbe4336300aa33727bae9792ca (diff)
gpu: nova-core: mm: Add PRAMIN window registers
PRAMIN apertures are a crucial mechanism for direct CPU read/write to VRAM. Add the BAR0 window registers that position the PRAMIN aperture on all supported GPU architectures: Turing, Ampere, Ada (via `NV_PBUS_BAR0_WINDOW`), Hopper (via `gh100::NV_XAL_EP_BAR0_WINDOW`), and Blackwell (via `gb100::NV_XAL_EP_BAR0_WINDOW`). Hopper/Blackwell window-base registers are based on Eliot Courtney's offlist reference patch. Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com> [ecourtney: split the registers out of the PRAMIN patch into mm/regs.rs] [ecourtney: drop the register read path] [ecourtney: reword the message for the split, narrow visibility to mm] [ecourtney: plain base fields, as the bitfield cast+shift patch is dropped] [ecourtney: rename the target to VidMem, fix derives, redo the target docs] [ecourtney: annotate the register base types] Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Acked-by: Danilo Krummrich <dakr@kernel.org> Link: https://patch.msgid.link/20260827-pramin-split-v3-3-24b24d7afc52@nvidia.com Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nova-core/mm.rs2
-rw-r--r--drivers/gpu/nova-core/mm/regs.rs70
2 files changed, 72 insertions, 0 deletions
diff --git a/drivers/gpu/nova-core/mm.rs b/drivers/gpu/nova-core/mm.rs
index f9d80ffbe01d..7d24ad790310 100644
--- a/drivers/gpu/nova-core/mm.rs
+++ b/drivers/gpu/nova-core/mm.rs
@@ -19,6 +19,8 @@ use kernel::{
},
};
+mod regs;
+
/// Physical VRAM address in GPU video memory.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
#[repr(transparent)]
diff --git a/drivers/gpu/nova-core/mm/regs.rs b/drivers/gpu/nova-core/mm/regs.rs
new file mode 100644
index 000000000000..82de6dfa4e8b
--- /dev/null
+++ b/drivers/gpu/nova-core/mm/regs.rs
@@ -0,0 +1,70 @@
+// SPDX-License-Identifier: GPL-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+
+//! Registers used by the memory management subsystems: the BAR0 PRAMIN window.
+
+use kernel::io::register;
+
+use crate::{
+ bounded_enum,
+ driver::NovaRegisters, //
+};
+
+// PRAMIN window
+
+bounded_enum! {
+ /// Target memory type for the BAR0 window register.
+ ///
+ /// Only VRAM is needed by the driver. Pre-Hopper window registers also define
+ /// system-memory targets that are unused here; Hopper+ uses a separate register
+ /// without a target field.
+ #[derive(Debug, Copy, Clone)]
+ pub(super) enum Bar0WindowTarget with TryFrom<Bounded<u32, 2>> {
+ /// Video memory (GPU framebuffer memory).
+ VidMem = 0,
+ }
+}
+
+register! {
+ base: NovaRegisters;
+
+ /// BAR0 window control for PRAMIN access.
+ pub(super) NV_PBUS_BAR0_WINDOW(u32) @ 0x00001700 {
+ /// Target memory aperture for the window.
+ 25:24 target ?=> Bar0WindowTarget;
+ /// PRAMIN window base bits 39:16.
+ 23:0 base;
+ }
+}
+
+pub(super) mod gh100 {
+ use kernel::io::register;
+
+ use crate::driver::NovaRegisters;
+
+ register! {
+ base: NovaRegisters;
+
+ /// Hopper register for PRAMIN window.
+ pub(crate) NV_XAL_EP_BAR0_WINDOW(u32) @ 0x0010fd40 {
+ /// PRAMIN window base bits 37:16.
+ 21:0 base;
+ }
+ }
+}
+
+pub(super) mod gb100 {
+ use kernel::io::register;
+
+ use crate::driver::NovaRegisters;
+
+ register! {
+ base: NovaRegisters;
+
+ /// Blackwell GB10x/GB20x register for PRAMIN window.
+ pub(crate) NV_XAL_EP_BAR0_WINDOW(u32) @ 0x0010fd40 {
+ /// PRAMIN window base bits 38:16.
+ 22:0 base;
+ }
+ }
+}