From: Deepak Pandey <deepak.os.system@gmail.com>
To: Danilo Krummrich <dakr@kernel.org>,
Alexandre Courbot <acourbot@nvidia.com>
Cc: nova-gpu@lists.linux.dev, rust-for-linux@vger.kernel.org,
Deepak Pandey <deepak.os.system@gmail.com>
Subject: [PATCH] gpu: nova-core: falcon: make pfalcon field private
Date: Wed, 18 Nov 2026 16:25:57 +0530 [thread overview]
Message-ID: <20261118105557.140069-1-deepak.os.system@gmail.com> (raw)
Currently, `Falcon::pfalcon` is marked as `pub(crate)` with a `TODO: make
private` comment. The only use of `pfalcon` outside of the `falcon`
module hierarchy is in `fwsec::bootloader`, which updates the FBIF
transaction configuration register (`NV_PFALCON_FBIF_TRANSCFG`) during
firmware DMA setup.
Introduce a dedicated helper method `Falcon::set_fbif_transcfg()` to
encapsulate configuring FBIF transaction parameters for a DMA context,
use it in `Falcon::dma_load()` and `fwsec::bootloader`, and make `pfalcon`
private. In addition, clean up unused register and I/O imports in
`bootloader.rs`.
Signed-off-by: Deepak Pandey <deepak.os.system@gmail.com>
---
drivers/gpu/nova-core/falcon.rs | 27 ++++++++++++++-----
.../nova-core/firmware/fwsec/bootloader.rs | 18 ++++---------
2 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/nova-core/falcon.rs b/drivers/gpu/nova-core/falcon.rs
index 9015de965a53..507f638e8936 100644
--- a/drivers/gpu/nova-core/falcon.rs
+++ b/drivers/gpu/nova-core/falcon.rs
@@ -364,8 +364,7 @@ pub(crate) struct Falcon<'a, E: FalconEngine> {
hal: KBox<dyn FalconHal<E>>,
dev: &'a device::Device<device::Bound>,
bar: Bar0<'a>,
- // TODO: make private
- pub(crate) pfalcon: Mmio<'a, PFalconRegisters>,
+ pfalcon: Mmio<'a, PFalconRegisters>,
pfalcon2: Mmio<'a, PFalcon2Registers>,
}
@@ -395,6 +394,24 @@ pub(crate) fn dma_reset(&self) {
.write_reg(regs::NV_PFALCON_FALCON_DMACTL::zeroed());
}
+ /// Configures FBIF transaction parameters for a DMA context.
+ pub(crate) fn set_fbif_transcfg(
+ &self,
+ ctx_dma: usize,
+ target: FalconFbifTarget,
+ mem_type: FalconFbifMemType,
+ ) -> Result {
+ self.pfalcon.update(
+ regs::NV_PFALCON_FBIF_TRANSCFG::try_at(ctx_dma).ok_or(EINVAL)?,
+ |v| {
+ v.with_target(target)
+ .with_mem_type(mem_type)
+ },
+ );
+
+ Ok(())
+ }
+
/// Reset the controller, select the falcon core, and wait for memory scrubbing to complete.
pub(crate) fn reset(&self) -> Result {
self.hal.reset_eng(self)?;
@@ -614,11 +631,7 @@ fn dma_load<F: FalconFirmware<Target = E> + FalconDmaLoadable>(&self, fw: &F) ->
};
self.dma_reset();
- self.pfalcon
- .update(regs::NV_PFALCON_FBIF_TRANSCFG::at(0), |v| {
- v.with_target(FalconFbifTarget::CoherentSysmem)
- .with_mem_type(FalconFbifMemType::Physical)
- });
+ self.set_fbif_transcfg(0, FalconFbifTarget::CoherentSysmem, FalconFbifMemType::Physical)?;
self.dma_wr(&dma_obj, FalconMem::ImemSecure, fw.imem_sec_load_params())?;
self.dma_wr(&dma_obj, FalconMem::Dmem, fw.dmem_load_params())?;
diff --git a/drivers/gpu/nova-core/firmware/fwsec/bootloader.rs b/drivers/gpu/nova-core/firmware/fwsec/bootloader.rs
index a87878fe2aec..db1cb4498acd 100644
--- a/drivers/gpu/nova-core/firmware/fwsec/bootloader.rs
+++ b/drivers/gpu/nova-core/firmware/fwsec/bootloader.rs
@@ -12,10 +12,6 @@
Device, //
},
dma::Coherent,
- io::{
- register::Array,
- Io, //
- },
prelude::*,
ptr::{
Alignable,
@@ -48,7 +44,6 @@
},
gpu::Chipset,
num::FromSafeCast, //
- regs,
};
/// Structure used by the boot-loader to load the rest of the code.
@@ -247,14 +242,11 @@ pub(crate) fn run(&self, dev: &Device<device::Bound>, falcon: &Falcon<'_, Gsp>)
.inspect_err(|e| dev_err!(dev, "Failed to load FWSEC firmware: {:?}\n", e))?;
// Configure DMA index for the bootloader to fetch the FWSEC firmware from system memory.
- falcon.pfalcon.update(
- regs::NV_PFALCON_FBIF_TRANSCFG::try_at(usize::from_safe_cast(self.dmem_desc.ctx_dma))
- .ok_or(EINVAL)?,
- |v| {
- v.with_target(FalconFbifTarget::CoherentSysmem)
- .with_mem_type(FalconFbifMemType::Physical)
- },
- );
+ falcon.set_fbif_transcfg(
+ usize::from_safe_cast(self.dmem_desc.ctx_dma),
+ FalconFbifTarget::CoherentSysmem,
+ FalconFbifMemType::Physical,
+ )?;
let (mbox0, _) = falcon
.boot(Some(0), None)
--
2.56.1
reply other threads:[~2026-11-18 10:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261118105557.140069-1-deepak.os.system@gmail.com \
--to=deepak.os.system@gmail.com \
--cc=acourbot@nvidia.com \
--cc=dakr@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=rust-for-linux@vger.kernel.org \
/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.