From: Danilo Krummrich <dakr@kernel.org>
To: dakr@kernel.org, acourbot@nvidia.com
Cc: nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org
Subject: [PATCH 2/4] gpu: nova-core: remove unnecessary Arc around BarUser
Date: Sat, 26 Sep 2026 14:43:25 +0200 [thread overview]
Message-ID: <20260926124405.604707-3-dakr@kernel.org> (raw)
In-Reply-To: <20260926124405.604707-1-dakr@kernel.org>
Remove the unnecessary Arc around BarUser and get rid of
Result<impl PinInit<T>> in favor of impl PinInit<T, Error>.
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
---
drivers/gpu/nova-core/gpu.rs | 24 +++++++++++-------------
drivers/gpu/nova-core/mm.rs | 5 ++---
drivers/gpu/nova-core/mm/bar_user.rs | 16 +++++++++-------
3 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 1ae287c9e776..123e605fa2c2 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -16,7 +16,6 @@
SizeConstants,
SZ_4K, //
},
- sync::Arc,
};
use crate::{
@@ -309,7 +308,8 @@ pub(crate) struct Gpu<'gpu> {
/// the GSP is still operational.
mm: GpuMm<'gpu>,
/// BAR1 user interface for CPU access to GPU virtual memory.
- bar_user: Arc<BarUser<'gpu>>,
+ #[pin]
+ bar_user: BarUser<'gpu>,
/// GSP and its resources.
#[pin]
gsp_resources: GspResources<'gpu>,
@@ -465,19 +465,17 @@ pub(crate) fn new<'a>(
},
// Create BAR1 user interface for CPU access to GPU virtual memory.
- bar_user: {
+ bar_user <- {
let pdb_addr = VramAddress::from_raw(gsp_static_info.bar1_pde_base);
let bar1_idx = crate::driver::bar1_resource_index(pdev)?;
let bar1_size = pdev.resource_len(bar1_idx)?;
- Arc::pin_init(
- BarUser::new(
- pdb_addr,
- gsp_resources.spec.chipset,
- bar1_size,
- bar1,
- )?,
- GFP_KERNEL,
- )?
+
+ BarUser::new(
+ pdb_addr,
+ gsp_resources.spec.chipset,
+ bar1_size,
+ bar1,
+ )
},
})
}
@@ -493,7 +491,7 @@ pub(crate) fn run_selftests(self: Pin<&mut Self>, pdev: &pci::Device<device::Bou
dev,
this.mm,
regions,
- this.bar_user,
+ &this.bar_user,
this.gsp_static_info.bar1_pde_base,
this.spec.chipset,
) {
diff --git a/drivers/gpu/nova-core/mm.rs b/drivers/gpu/nova-core/mm.rs
index a5bc4042577b..8a934c55169f 100644
--- a/drivers/gpu/nova-core/mm.rs
+++ b/drivers/gpu/nova-core/mm.rs
@@ -298,8 +298,7 @@ pub(crate) mod selftest {
use kernel::{
device,
- sizes::SizeConstants,
- sync::Arc, //
+ sizes::SizeConstants, //
};
use super::*;
@@ -309,7 +308,7 @@ pub(crate) fn run(
dev: &device::Device<device::Bound>,
mm: &mut GpuMm<'_>,
usable_fb_regions: &[Range<u64>],
- bar_user: &Arc<bar_user::BarUser<'_>>,
+ bar_user: &bar_user::BarUser<'_>,
bar1_pdb: u64,
chipset: Chipset,
) -> Result {
diff --git a/drivers/gpu/nova-core/mm/bar_user.rs b/drivers/gpu/nova-core/mm/bar_user.rs
index 86b5d302188e..6c8fa06d9f4b 100644
--- a/drivers/gpu/nova-core/mm/bar_user.rs
+++ b/drivers/gpu/nova-core/mm/bar_user.rs
@@ -51,12 +51,14 @@ pub(crate) fn new(
chipset: Chipset,
va_size: u64,
bar1: Bar1<'gpu>,
- ) -> Result<impl PinInit<Self> + 'gpu> {
- let vmm = Vmm::new(pdb_addr, chipset.mmu_version(), va_size)?;
- Ok(pin_init!(Self {
- vmm <- new_mutex!(vmm, "bar_user_vmm"),
+ ) -> impl PinInit<Self, Error> + 'gpu {
+ try_pin_init!(Self {
+ vmm <- new_mutex!(
+ Vmm::new(pdb_addr, chipset.mmu_version(), va_size)?,
+ "bar_user_vmm",
+ ),
bar1,
- }))
+ })
}
/// Map physical pages to a contiguous BAR1 virtual range.
@@ -183,7 +185,7 @@ fn drop(&mut self) {
pub(crate) fn run_self_test(
dev: &device::Device<device::Bound>,
mm: &mut GpuMm<'_>,
- bar_user: &Arc<BarUser<'_>>,
+ bar_user: &BarUser<'_>,
bar1_pdb: u64,
chipset: Chipset,
) -> Result {
@@ -389,7 +391,7 @@ pub(crate) fn run_self_test(
// Test 4: Exercise `BarUser::map()` end-to-end.
let bar_user = Arc::pin_init(
- BarUser::new(pdb_addr, chipset, SZ_64K.into_safe_cast(), bar1)?,
+ BarUser::new(pdb_addr, chipset, SZ_64K.into_safe_cast(), bar1),
GFP_KERNEL,
)?;
let access = bar_user.map(mm, &[test_pfn], true)?;
--
2.55.0
next prev parent reply other threads:[~2026-09-26 12:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 12:43 [PATCH 0/4] nova-core: align Bar0/Bar1 and remvove unnecessary Arc Danilo Krummrich
2026-09-26 12:43 ` [PATCH 1/4] gpu: nova-core: align Bar1 alias with Bar0 Danilo Krummrich
2026-09-28 5:39 ` Eliot Courtney
2026-09-26 12:43 ` Danilo Krummrich [this message]
2026-09-28 5:39 ` [PATCH 2/4] gpu: nova-core: remove unnecessary Arc around BarUser Eliot Courtney
2026-09-26 12:43 ` [PATCH 3/4] gpu: nova-core: mm: get rid of Arc<BarUser> in BarUserAccess Danilo Krummrich
2026-09-26 12:58 ` sashiko-bot
2026-09-28 5:40 ` Eliot Courtney
2026-09-26 12:43 ` [PATCH 4/4] gpu: nova-core: mm: fix lifetime name in BarUser Danilo Krummrich
2026-09-28 5:40 ` Eliot Courtney
2026-09-26 15:34 ` [PATCH 0/4] nova-core: align Bar0/Bar1 and remvove unnecessary Arc Alexandre Courbot
2026-09-27 12:15 ` 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=20260926124405.604707-3-dakr@kernel.org \
--to=dakr@kernel.org \
--cc=acourbot@nvidia.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=nova-gpu@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox