NVIDIA GPU driver infrastructure
 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>, <dri-devel@lists.freedesktop.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 11/14] gpu: nova-core: falcon: select the BAR2 engine ID for framebuffer DMA
Date: Tue, 01 Dec 2026 23:26:50 +0900	[thread overview]
Message-ID: <DN9GSKM18HPE.36D9QF5TUJHN2@nvidia.com> (raw)
In-Reply-To: <20261130-falcon-v1-11-cb94f87b5674@nvidia.com>

On Mon Nov 30, 2026 at 6:28 PM JST, Eliot Courtney wrote:
> From: John Hubbard <jhubbard@nvidia.com>
>
> 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@nvidia.com>
> [ecourtney: match on `FalconSegmentSource`, which replaced `FalconDmaSource`]
> [ecourtney: set TRANSCFG target and engine ID together in one `match`]
> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
> ---
>  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`.)

This says that the kernel driver should always select `Bar2Fn0`...

> +    #[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),

... and yet it only selects it for a framebuffer segment source.
Shouldn't this be unconditional? Or what justifies this difference?

  reply	other threads:[~2026-12-01 14:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  9:28 [PATCH 00/14] gpu: nova-core: merge `load` and `boot` for falcons, add load+exec handlers Eliot Courtney
2026-11-30  9:28 ` [PATCH 01/14] gpu: nova-core: falcon: program BROM and BOOTVEC in `boot` Eliot Courtney
2026-11-30  9:28 ` [PATCH 02/14] gpu: nova-core: use correct offset for imem in `BooterFirmware` Eliot Courtney
2026-11-30  9:28 ` [PATCH 03/14] gpu: nova-core: remove some dependencies on FalconDmaLoadTarget Eliot Courtney
2026-11-30  9:28 ` [PATCH 04/14] gpu: nova-core: falcon: separate staging data for DMA from its location Eliot Courtney
2026-11-30  9:28 ` [PATCH 05/14] gpu: nova-core: falcon: add `FalconImage` for `FalconFirmware` trait Eliot Courtney
2026-11-30  9:28 ` [PATCH 06/14] gpu: nova-core: falcon: load the firmware image in Falcon::boot Eliot Courtney
2026-11-30  9:28 ` [PATCH 07/14] gpu: nova-core: firmware: use `zerocopy` for `BootloaderDmemDescV2` Eliot Courtney
2026-12-01  8:38   ` Alexandre Courbot
2026-11-30  9:28 ` [PATCH 08/14] gpu: nova-core: falcon: factor out the wait for the GSP suspend Eliot Courtney
2026-12-01 14:29   ` Alexandre Courbot
2026-11-30  9:28 ` [PATCH 09/14] gpu: nova-core: gsp: factor out the core resume Eliot Courtney
2026-12-01 14:28   ` Alexandre Courbot
2026-11-30  9:28 ` [PATCH 10/14] gpu: nova-core: gsp: fix resume_gsp_rm()'s error messages Eliot Courtney
2026-11-30  9:28 ` [PATCH 11/14] gpu: nova-core: falcon: select the BAR2 engine ID for framebuffer DMA Eliot Courtney
2026-12-01 14:26   ` Alexandre Courbot [this message]
2026-11-30  9:28 ` [PATCH 12/14] gpu: nova-core: gsp: add the r000 load-and-execute HS binary handler Eliot Courtney
2026-12-01 14:41   ` Alexandre Courbot
2026-11-30  9:28 ` [PATCH 13/14] gpu: nova-core: gsp: add the r000 load-and-execute bootloader handler Eliot Courtney
2026-12-01 15:14   ` Alexandre Courbot
2026-11-30  9:28 ` [PATCH 14/14] gpu: nova-core: gsp: add the load-and-execute event dispatcher Eliot Courtney
2026-12-01 15:14   ` Alexandre Courbot
2026-12-01 14:23 ` [PATCH 00/14] gpu: nova-core: merge `load` and `boot` for falcons, add load+exec handlers 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=DN9GSKM18HPE.36D9QF5TUJHN2@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --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