Rust for Linux List
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Eliot Courtney" <ecourtney@nvidia.com>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Timur Tabi" <ttabi@nvidia.com>, "Zhi Wang" <zhiw@nvidia.com>,
	<nova-gpu@lists.linux.dev>, <rust-for-linux@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/7] gpu: nova-core: falcon: allow DMEM DMA transfers to request tagging
Date: Fri, 06 Nov 2026 22:26:38 +0900	[thread overview]
Message-ID: <DMO5UV7AN2DT.2POBRMO308S2@nvidia.com> (raw)
In-Reply-To: <DMNBQYC8KTD1.31I6CHXMYL2NS@nvidia.com>

On Thu Nov 5, 2026 at 10:50 PM JST, Eliot Courtney wrote:
> On Tue Nov 3, 2026 at 7:22 PM JST, Alexandre Courbot wrote:
>> Add a tag flag to FalconMem::Dmem and set DMATRFCMD's DMTAG bit from it.
>>
>> This is needed for the r000 load-and-execute event which specifies
>> whether DMEM should be tagged or not.
>>
>> No functional change intended.
>>
>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>
> It would be nice if this explained what the tagging was.
>
>> ---
>>  drivers/gpu/nova-core/falcon.rs | 20 +++++++++++++-------
>>  drivers/gpu/nova-core/regs.rs   |  2 +-
>>  2 files changed, 14 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/gpu/nova-core/falcon.rs b/drivers/gpu/nova-core/falcon.rs
>> index 1bceb38c33c6..f48f2eabab0f 100644
>> --- a/drivers/gpu/nova-core/falcon.rs
>> +++ b/drivers/gpu/nova-core/falcon.rs
>> @@ -131,8 +131,9 @@ pub(crate) enum FalconMem {
>>      /// Non-Secure Instruction Memory.
>>      #[expect(unused)]
>>      ImemNonSecure,
>> -    /// Data Memory.
>> -    Dmem,
>> +    /// Data Memory. If `tag` is set, a transfer into DMEM also tags each block with its source
>> +    /// offset, which is then the DMEM virtual address of the image.
>> +    Dmem { tag: bool },
>>  }
>>  
>>  bounded_enum! {
>> @@ -529,9 +530,9 @@ fn dma_wr(
>>          // code addresses in the firmware (and the boot vector) are virtual.
>>          //
>>          // For DMEM, the start offset is folded into the DMA address.
>> -        let (src_start, dma_start) = match target_mem {
>> -            FalconMem::ImemSecure | FalconMem::ImemNonSecure => (load_offsets.src_start, 0),
>> -            FalconMem::Dmem => (0, usize::from_safe_cast(load_offsets.src_start)),
>> +        let (src_start, dma_start, tag_dmem) = match target_mem {
>> +            FalconMem::ImemSecure | FalconMem::ImemNonSecure => (load_offsets.src_start, 0, false),
>> +            FalconMem::Dmem { tag } => (0, usize::from_safe_cast(load_offsets.src_start), tag),
>
> I am not sure, but is it correct to have `src_start` as zero for
> tag==true here? Surely something should change based on the value of tag
> w.r.t. the addressing.

Yes, there is indeed a problem, tagged DMEM should behave like IMEM
(which is always tagged) here. I'll fix it.

The poor variable names are in great part responsible for the confusion,
so I'll also introduce a patch renaming them.

>
>>          };
>>  
>>          let dma_address = {
>> @@ -568,7 +569,8 @@ fn dma_wr(
>>  
>>          let cmd = regs::NV_PFALCON_FALCON_DMATRFCMD::zeroed()
>>              .with_size(DmaTrfCmdSize::Size256B)
>> -            .with_falcon_mem(target_mem);
>> +            .with_falcon_mem(target_mem)
>> +            .with_set_dmtag(tag_dmem);
>
> Instead of taking tag_dmem out of FalconMem and using
> .with_set_dmtag(tag_dmem), let `with_falcon_mem` set it? It looks like
> it's always just passed through.

Good idea!

  reply	other threads:[~2026-11-06 13:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 10:22 [PATCH 0/7] gpu: nova-core: generic bootloader and falcon DMA changes for r000 Alexandre Courbot
2026-11-03 10:22 ` [PATCH 1/7] gpu: nova-core: separate the generic falcon bootloader from FWSEC Alexandre Courbot
2026-11-05 12:17   ` Eliot Courtney
2026-11-03 10:22 ` [PATCH 2/7] gpu: nova-core: place the generic bootloader at the top of IMEM Alexandre Courbot
2026-11-05 12:59   ` Eliot Courtney
2026-11-06 10:57     ` Alexandre Courbot
2026-11-03 10:22 ` [PATCH 3/7] gpu: nova-core: move the bootloader DMEM descriptor out of FWSEC Alexandre Courbot
2026-11-05 12:47   ` Eliot Courtney
2026-11-03 10:22 ` [PATCH 4/7] gpu: nova-core: run the generic bootloader from its own type Alexandre Courbot
2026-11-05 12:50   ` Eliot Courtney
2026-11-06 12:32     ` Alexandre Courbot
2026-11-03 10:22 ` [PATCH 5/7] gpu: nova-core: falcon: allow DMEM DMA transfers to request tagging Alexandre Courbot
2026-11-05 13:50   ` Eliot Courtney
2026-11-06 13:26     ` Alexandre Courbot [this message]
2026-11-03 10:22 ` [PATCH 6/7] gpu: nova-core: falcon: allow DMA transfers to read from a framebuffer address Alexandre Courbot
2026-11-06  6:14   ` Eliot Courtney
2026-11-07  9:35     ` Alexandre Courbot
2026-11-03 10:22 ` [PATCH 7/7] gpu: nova-core: falcon: check the per-block DMA offsets for overflow Alexandre Courbot
2026-11-05 13:02   ` Eliot Courtney

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=DMO5UV7AN2DT.2POBRMO308S2@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