[PATCH 11/14] gpu: nova-core: falcon: select the BAR2 engine ID for framebuffer DMA
From: Eliot Courtney
Date: Mon Nov 30 2026 - 04:29:54 EST
From: John Hubbard <jhubbard@xxxxxxxxxx>
When Open RM loads a binary from the framebuffer into a falcon by DMA,
it selects BAR2 as the MMU engine ID of the transfer, in the falcon's
FBIF_TRANSCFG register. Nova-core's definition of the register has no
field for the engine ID, so the DMA transfer code has no way to select
one.
Add the field, and select the BAR2 engine ID for a DMA transfer whose
source is the framebuffer.
Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
[ecourtney: match on `FalconSegmentSource`, which replaced `FalconDmaSource`]
[ecourtney: set TRANSCFG target and engine ID together in one `match`]
Signed-off-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
---
drivers/gpu/nova-core/falcon.rs | 37 ++++++++++++++++++++++++++-----------
drivers/gpu/nova-core/regs.rs | 2 ++
2 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/nova-core/falcon.rs b/drivers/gpu/nova-core/falcon.rs
index 0a375394f71a..fe6a84509d09 100644
--- a/drivers/gpu/nova-core/falcon.rs
+++ b/drivers/gpu/nova-core/falcon.rs
@@ -160,6 +160,19 @@ pub(crate) enum FalconFbifMemType with From<Bounded<u32, 1>> {
}
}
+bounded_enum! {
+ /// MMU engine ID under which the falcon's FBIF issues a DMA transfer.
+ ///
+ /// A kernel driver should select `Bar2Fn0`. (Only GPU firmware selects `Own`.)
+ #[derive(Debug, Copy, Clone)]
+ pub(crate) enum FalconFbifEngineIdFlag with From<Bounded<u32, 1>> {
+ /// The engine ID of PCI function 0's BAR2.
+ Bar2Fn0 = 0,
+ /// The falcon's own engine ID.
+ Own = 1,
+ }
+}
+
const PFALCON_REGION_SIZE: usize = SZ_4K;
const PFALCON2_REGION_SIZE: usize = SZ_4K;
@@ -434,19 +447,13 @@ fn dma_wr(
// Declare `dma_obj` here so it lives long enough for transfers to
// complete.
let dma_obj;
- let (dma_base, fbif_target, len) = match src {
+ let (dma_base, len) = match src {
FalconSegmentSource::Sysmem(data) => {
dma_obj = self.dma_stage(data, src_offset)?;
- (
- dma_obj.dma_address(),
- FalconFbifTarget::CoherentSysmem,
- u32::try_from(data.len())?,
- )
- }
- FalconSegmentSource::Framebuffer { base, len } => {
- (base, FalconFbifTarget::LocalFb, len)
+ (dma_obj.dma_address(), u32::try_from(data.len())?)
}
+ FalconSegmentSource::Framebuffer { base, len } => (base, len),
};
// DMA transfers can only be done in units of 256 bytes. Compute how many such transfers we
@@ -480,8 +487,16 @@ fn dma_wr(
self.pfalcon
.update(regs::NV_PFALCON_FBIF_TRANSCFG::at(0), |v| {
- v.with_target(fbif_target)
- .with_mem_type(FalconFbifMemType::Physical)
+ let v = v.with_mem_type(FalconFbifMemType::Physical);
+
+ match src {
+ FalconSegmentSource::Sysmem(_) => {
+ v.with_target(FalconFbifTarget::CoherentSysmem)
+ }
+ FalconSegmentSource::Framebuffer { .. } => v
+ .with_target(FalconFbifTarget::LocalFb)
+ .with_engine_id_flag(FalconFbifEngineIdFlag::Bar2Fn0),
+ }
});
for pos in (0..num_transfers).map(|i| i * DMA_LEN) {
diff --git a/drivers/gpu/nova-core/regs.rs b/drivers/gpu/nova-core/regs.rs
index dfe7944cf1e7..050054a2b23d 100644
--- a/drivers/gpu/nova-core/regs.rs
+++ b/drivers/gpu/nova-core/regs.rs
@@ -18,6 +18,7 @@
DmaTrfCmdSize,
FalconCoreRev,
FalconCoreRevSubversion,
+ FalconFbifEngineIdFlag,
FalconFbifMemType,
FalconFbifTarget,
FalconMem,
@@ -291,6 +292,7 @@ pub(crate) fn usable_fb_size(self) -> u64 {
}
pub(crate) NV_PFALCON_FBIF_TRANSCFG(u32)[8] @ 0x00000600 {
+ 16:16 engine_id_flag => FalconFbifEngineIdFlag;
2:2 mem_type => FalconFbifMemType;
1:0 target ?=> FalconFbifTarget;
}
--
2.56.1