From: Alexandre Courbot <acourbot@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>,
Alice Ryhl <aliceryhl@google.com>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>
Cc: John Hubbard <jhubbard@nvidia.com>,
Alistair Popple <apopple@nvidia.com>,
Timur Tabi <ttabi@nvidia.com>,
Eliot Courtney <ecourtney@nvidia.com>,
Zhi Wang <zhiw@nvidia.com>,
nova-gpu@lists.linux.dev, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org,
Alexandre Courbot <acourbot@nvidia.com>
Subject: [PATCH v3 11/13] gpu: nova-core: falcon: use src_start as FB offset for all DMA transfers
Date: Tue, 10 Nov 2026 19:21:00 +0900 [thread overview]
Message-ID: <20261110-r000-fw-v3-11-20d79ebb646f@nvidia.com> (raw)
In-Reply-To: <20261110-r000-fw-v3-0-20d79ebb646f@nvidia.com>
dma_wr() splits the source offset of a transfer between DMATRFBASE and
DMATRFFBOFFS differently depending on the target memory. This separation
adds branching to the code, and is not strictly needed as DMATRFFBOFFS
supports 32-bit offsets.
Remove that distinction by programming the start of the source into
DMATRFBASE and `src_start` into DMATRFFBOFFS for all transfers, which
also removes the `fb_offset` and `base_offset` local variables.
This changes the register values programmed for untagged DMEM
transfers, but not the addresses they read from. No change of behavior
has been observed on either r570 or r615.
Suggested-by: Eliot Courtney <ecourtney@nvidia.com>
Link: https://lore.kernel.org/all/DMQI0G2K6Z3B.1YEH6D2ZILRBI@nvidia.com/
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
drivers/gpu/nova-core/falcon.rs | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/nova-core/falcon.rs b/drivers/gpu/nova-core/falcon.rs
index facf65a17c0f..a7e41e282ec2 100644
--- a/drivers/gpu/nova-core/falcon.rs
+++ b/drivers/gpu/nova-core/falcon.rs
@@ -566,17 +566,6 @@ fn dma_wr(
// need to perform.
let num_transfers = load_offsets.len.div_ceil(DMA_LEN);
- // For IMEM and tagged DMEM, we want to use the start offset as a virtual address tag for
- // each page, since addresses in the firmware (and the boot vector) are virtual.
- //
- // For untagged DMEM, the start offset is folded into the DMA base.
- let (fb_offset, base_offset) = match target_mem {
- FalconMem::ImemSecure | FalconMem::ImemNonSecure | FalconMem::Dmem { tag: true } => {
- (load_offsets.src_start, 0)
- }
- FalconMem::Dmem { tag: false } => (0, usize::from_safe_cast(load_offsets.src_start)),
- };
-
let dma_base = match src {
FalconDmaSource::Sysmem(dma_obj) => {
// Upper limit of transfer is `(num_transfers * DMA_LEN) + load_offsets.src_start`.
@@ -586,11 +575,9 @@ fn dma_wr(
.map(usize::from_safe_cast)
.ok_or(EOVERFLOW)?;
- io_project!(dma_obj, [try: base_offset..end_offset]).dma_address()
+ io_project!(dma_obj, [try: 0..end_offset]).dma_address()
}
- FalconDmaSource::Framebuffer { base } => base
- .checked_add(u64::from_safe_cast(base_offset))
- .ok_or(EOVERFLOW)?,
+ FalconDmaSource::Framebuffer { base } => base,
};
if dma_base % DmaAddress::from(DMA_LEN) > 0 {
@@ -624,8 +611,10 @@ fn dma_wr(
regs::NV_PFALCON_FALCON_DMATRFMOFFS::zeroed()
.try_with_offs(load_offsets.dst_start + pos)?,
);
+ // The source offset doubles as the virtual address tag for IMEM and tagged DMEM.
self.pfalcon.write_reg(
- regs::NV_PFALCON_FALCON_DMATRFFBOFFS::zeroed().with_offs(fb_offset + pos),
+ regs::NV_PFALCON_FALCON_DMATRFFBOFFS::zeroed()
+ .with_offs(load_offsets.src_start + pos),
);
self.pfalcon.write_reg(cmd);
--
2.56.0
next prev parent reply other threads:[~2026-11-10 10:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 10:20 [PATCH v3 00/13] gpu: nova-core: generic bootloader and falcon DMA changes for r000 Alexandre Courbot
2026-11-10 10:20 ` [PATCH v3 01/13] gpu: nova-core: separate the generic falcon bootloader from FWSEC Alexandre Courbot
2026-11-10 10:20 ` [PATCH v3 02/13] gpu: nova-core: falcon: widen the IMEM PIO offset to 24 bits Alexandre Courbot
2026-11-10 10:20 ` [PATCH v3 03/13] gpu: nova-core: move the bootloader DMEM descriptor out of FWSEC Alexandre Courbot
2026-11-10 10:20 ` [PATCH v3 04/13] gpu: nova-core: run the generic bootloader from its own type Alexandre Courbot
2026-11-10 10:20 ` [PATCH v3 05/13] gpu: nova-core: place the generic bootloader at the top of IMEM Alexandre Courbot
2026-11-10 10:20 ` [PATCH v3 06/13] rust: io: register: implement Copy and Clone for RegisterArrayLoc Alexandre Courbot
2026-11-10 10:20 ` [PATCH v3 07/13] gpu: nova-core: falcon: introduce and use with_fbif_transcfg Alexandre Courbot
2026-11-10 10:20 ` [PATCH v3 08/13] gpu: nova-core: falcon: rename the local variables of dma_wr() Alexandre Courbot
2026-11-10 10:20 ` [PATCH v3 09/13] gpu: nova-core: falcon: allow DMEM DMA transfers to request tagging Alexandre Courbot
2026-11-10 10:20 ` [PATCH v3 10/13] gpu: nova-core: falcon: allow DMA transfers to read from a framebuffer address Alexandre Courbot
2026-11-10 10:21 ` Alexandre Courbot [this message]
2026-11-10 10:21 ` [PATCH v3 12/13] gpu: nova-core: falcon: check the per-block DMA offsets for overflow Alexandre Courbot
2026-11-10 10:21 ` [PATCH v3 13/13] gpu: nova-core: falcon: program the FBIF_TRANSCFG register in dma_wr Alexandre Courbot
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=20261110-r000-fw-v3-11-20d79ebb646f@nvidia.com \
--to=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=dakr@kernel.org \
--cc=ecourtney@nvidia.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=ttabi@nvidia.com \
--cc=zhiw@nvidia.com \
/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
all inboxes | Powered by JetHome®