From: Danilo Krummrich <dakr@kernel.org>
To: dakr@kernel.org, acourbot@nvidia.com, aliceryhl@google.com,
airlied@gmail.com, simona@ffwll.ch, lossin@kernel.org,
gary@garyguo.net, ecourtney@nvidia.com, jhubbard@nvidia.com
Cc: nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] gpu: nova-core: mm: initialize GpuMm in place
Date: Thu, 26 Nov 2026 22:36:04 +0100 [thread overview]
Message-ID: <20261126213652.3716162-4-dakr@kernel.org> (raw)
In-Reply-To: <20261126213652.3716162-1-dakr@kernel.org>
The PRAMIN and TLB managers require stable addresses for their mutexes.
Pin-initialize GpuMm so they can be embedded directly instead of
allocating each separately.
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
---
drivers/gpu/nova-core/gpu.rs | 5 +++--
drivers/gpu/nova-core/mm.rs | 20 ++++++++++----------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 39e57e724a71..2f0399100885 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -399,6 +399,7 @@ pub(crate) struct Gpu<'gpu> {
///
/// Must be kept declared *before* `gsp_resources`, so that its components are dropped while
/// the GSP is still operational.
+ #[pin]
mm: GpuMm<'gpu>,
/// BAR1 user interface for CPU access to GPU virtual memory.
#[pin]
@@ -562,7 +563,7 @@ pub(crate) fn new<'a>(
},
// Create GPU memory manager owning memory management resources.
- mm: {
+ mm <- {
let usable_vram = gsp_static_info.usable_fb_regions.first().ok_or(ENODEV)?;
let buddy_params = GpuBuddyParams {
base_offset: usable_vram.start,
@@ -575,7 +576,7 @@ pub(crate) fn new<'a>(
gsp_resources.spec.chipset,
buddy_params,
VramAddress::from_raw(gsp_static_info.total_fb_end),
- )?
+ )
},
// Create BAR1 user interface for CPU access to GPU virtual memory.
diff --git a/drivers/gpu/nova-core/mm.rs b/drivers/gpu/nova-core/mm.rs
index 30a394424e12..94c6f425c867 100644
--- a/drivers/gpu/nova-core/mm.rs
+++ b/drivers/gpu/nova-core/mm.rs
@@ -74,10 +74,13 @@ macro_rules! impl_pfn_bounded {
/// - [`GpuBuddy`] allocator for VRAM page table allocation.
/// - [`pramin::SharedPramin`] for direct VRAM access.
/// - [`Tlb`] manager for translation buffer flush operations.
+#[pin_data]
pub(crate) struct GpuMm<'gpu> {
buddy: GpuBuddy,
- pramin: Pin<KBox<pramin::SharedPramin<'gpu>>>,
- tlb: Pin<KBox<Tlb<'gpu>>>,
+ #[pin]
+ pramin: pramin::SharedPramin<'gpu>,
+ #[pin]
+ tlb: Tlb<'gpu>,
}
impl<'gpu> GpuMm<'gpu> {
@@ -87,18 +90,15 @@ pub(crate) fn new(
chipset: Chipset,
buddy_params: GpuBuddyParams,
total_fb_end: VramAddress,
- ) -> Result<Self> {
+ ) -> impl PinInit<Self, Error> {
// PRAMIN covers all physical VRAM (including GSP-reserved areas
// above the usable region, e.g. the BAR1 page directory).
let vram_region = VramAddress::ZERO..total_fb_end;
- Ok(Self {
+ try_pin_init!(Self {
buddy: GpuBuddy::new(buddy_params)?,
- pramin: KBox::pin_init(
- pramin::SharedPramin::new(bar, chipset, vram_region),
- GFP_KERNEL,
- )?,
- tlb: KBox::pin_init(Tlb::new(bar), GFP_KERNEL)?,
+ pramin <- pramin::SharedPramin::new(bar, chipset, vram_region),
+ tlb <- Tlb::new(bar),
})
}
@@ -116,7 +116,7 @@ fn with_pramin_locked<R>(&self, f: impl FnOnce(&mut pramin::Pramin<'_>) -> R) ->
/// Access the [`Tlb`] manager.
pub(crate) fn tlb(&self) -> &Tlb<'gpu> {
- self.tlb.as_ref().get_ref()
+ &self.tlb
}
}
--
2.56.1
next prev parent reply other threads:[~2026-11-26 21:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 21:36 [PATCH 0/4] gpu: nova-core: prepare GpuMm for shared access Danilo Krummrich
2026-11-26 21:36 ` [PATCH 1/4] gpu: nova-core: mm: serialize PRAMIN access Danilo Krummrich
2026-11-28 2:01 ` Alexandre Courbot
2026-11-26 21:36 ` [PATCH 2/4] gpu: nova-core: mm: use shared references to GpuMm Danilo Krummrich
2026-11-26 21:36 ` Danilo Krummrich [this message]
2026-11-26 21:36 ` [PATCH 4/4] gpu: nova-core: mm: remove SharedPramin Danilo Krummrich
2026-11-28 2:04 ` [PATCH 0/4] gpu: nova-core: prepare GpuMm for shared access Alexandre Courbot
2026-12-01 19:19 ` Danilo Krummrich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126213652.3716162-4-dakr@kernel.org \
--to=dakr@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=simona@ffwll.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.