mirror of https://lore.kernel.org/lkml/
 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 2/7] gpu: nova-core: place the generic bootloader at the top of IMEM
Date: Fri, 06 Nov 2026 19:57:00 +0900	[thread overview]
Message-ID: <DMO2OAFX8PB7.3ECEC1L3JIDMN@nvidia.com> (raw)
In-Reply-To: <DMNAN7KX22SC.QQ5HURCU332A@nvidia.com>

On Thu Nov 5, 2026 at 9:59 PM JST, Eliot Courtney wrote:
<...>
>> -    pub(crate) fn new(dev: &device::Device<device::Bound>, chipset: Chipset) -> Result<Self> {
>> +    pub(crate) fn new(
>> +        dev: &device::Device<device::Bound>,
>> +        chipset: Chipset,
>> +        falcon: &Falcon<'_, Gsp>,
>> +    ) -> Result<Self> {
>>          let fw = request_tlv(dev, chipset, "gen_bootloader")?;
>>          let tlv = Tlv::new(fw.data())?;
>>          dev_dbg!(
>> @@ -68,9 +73,9 @@ pub(crate) fn new(dev: &device::Device<device::Bound>, chipset: Chipset) -> Resu
>>              ucode
>>          };
>>  
>> -        // The bootloader's code must be loaded in the area right below the first 64K of IMEM.
>> -        const BOOTLOADER_LOAD_CEILING: usize = sizes::SZ_64K;
>> -        let imem_dst_start = BOOTLOADER_LOAD_CEILING
>> +        // The top of IMEM, above the blocks that the bootloader loads the image into.
>> +        let imem_dst_start = falcon
>> +            .imem_size()
>>              .checked_sub(ucode.len())
>>              .ok_or(EOVERFLOW)?;
>
> `imem_size` is 8:0 (so 9 bits), and multiplied by 256. So it can be max
> ~2^17. Then we subtract off ucode.len() and do u16::try_from, so that
> could fail. I don't know if any real hardware actually hits this though.
> This value (`imem_dst_start`) eventually gets written into
> NV_PFALCON_FALCON_IMEMC::offs which is 15:0 in nova. According to openrm
> though, it's 15:0 for turing, and after that it's 23:0. So maybe worth
> checking (then we'd widen `imem_dst_start` etc to u32). I think it
> probably 'just works' fine to switch to u32 and change
> NV_PFALCON_FALCON_IMEMC::offs to 23:0, even for turing, and would be the
> same behaviour as nouveau afaict.

Oh, nice catch. The bootloader only runs on Turing and GA100, and as you
pointed out on Turing `IMEMC::offs` is 16 bits, but on GA100 it will be 24
bits and if GA100 signals more than 64KB of IMEM then this will fail.

Widening the `IMEMC::offs` definition for all GPUs should just work
indeed, so let's do that. On Turing we are basically guaranteed that the
upper 8 bits will never be set. I'll use a `Bounded` to keep things
within the acceptable range as early as possible.

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

Thread overview: 18+ 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 [this message]
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
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-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=DMO2OAFX8PB7.3ECEC1L3JIDMN@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®