NVIDIA GPU driver infrastructure
 help / color / mirror / Atom feed
From: "Eliot Courtney" <ecourtney@nvidia.com>
To: "Timur Tabi" <ttabi@nvidia.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Eliot Courtney" <ecourtney@nvidia.com>,
	<nova-gpu@lists.linux.dev>
Subject: Re: [PATCH 1/5] gpu: nova-core: add Tlv.get_u64
Date: Wed, 11 Nov 2026 14:27:27 +0900	[thread overview]
Message-ID: <DMS4SP3IZR1Q.161SA3OVYSZNJ@nvidia.com> (raw)
In-Reply-To: <20261110231053.1352163-2-ttabi@nvidia.com>

On Wed Nov 11, 2026 at 8:10 AM JST, Timur Tabi wrote:
> Introduce get_u64() to support variable-sized TLV integers.  If the driver
> expects that a particular tag might be a 64-bit value, it should use this
> method read it.
>
> TLVs can store unsigned integers in either 32-bit or 64-bit little-endian
> format.  The script that generates TLV files is written in Python, and
> Python integers are arbitrarily sized.  For any given integer, the script
> will store it as a 32-bit integer if its value is less than 0x100000000,
> without any regard to its purpose.  This means that the driver may not
> know until runtime whether a given TLV integer is encoded as four bytes
> or eight.
>
> Signed-off-by: Timur Tabi <ttabi@nvidia.com>
> ---
>  drivers/gpu/nova-core/firmware/tlv.rs | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/drivers/gpu/nova-core/firmware/tlv.rs b/drivers/gpu/nova-core/firmware/tlv.rs
> index 7f278903dc8b..75d8f907421b 100644
> --- a/drivers/gpu/nova-core/firmware/tlv.rs
> +++ b/drivers/gpu/nova-core/firmware/tlv.rs
> @@ -257,6 +257,23 @@ pub(crate) fn load_file(
>              .ok_or(EINVAL)
>      }
>  
> +    /// Return a u64, from either a 32-bit or 64-bit little-endian tag.
> +    #[expect(unused)]
> +    pub(crate) fn get_u64(&self, tag: &[u8; 4]) -> Result<u64> {
> +        let value = self.get_bytes(tag)?;

`get_u32` is using `self.find`, but this is using `self.get_bytes`.
Probably they should use the same one, particularly since when the TODO
to use ENODATA is done the error behaviour would differ between these
two functions.

  parent reply	other threads:[~2026-11-11  5:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 23:10 [PATCH 0/5] Transition nova-core to use TLV variables for heap sizes Timur Tabi
2026-11-10 23:10 ` [PATCH 1/5] gpu: nova-core: add Tlv.get_u64 Timur Tabi
2026-11-11  0:20   ` John Hubbard
2026-11-11  2:59     ` Timur Tabi
2026-11-11  3:45       ` John Hubbard
2026-11-11  5:21         ` Eliot Courtney
2026-11-11  5:27   ` Eliot Courtney [this message]
2026-11-10 23:10 ` [PATCH 2/5] gpu: nova-core: merge LibosParams into GspFwHeapParams Timur Tabi
2026-11-11  6:30   ` Eliot Courtney
2026-11-10 23:10 ` [PATCH 3/5] gpu: nova-core: read GSP heap variables from TLV Timur Tabi
2026-11-10 23:10 ` [PATCH 4/5] gpu: nova-core: use the TLV heap sizes Timur Tabi
2026-11-10 23:10 ` [PATCH 5/5] gpu: nova-core: remove heap size related HAL functions Timur Tabi
2026-11-10 23:21 ` [PATCH 0/5] Transition nova-core to use TLV variables for heap sizes Timur Tabi

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=DMS4SP3IZR1Q.161SA3OVYSZNJ@nvidia.com \
    --to=ecourtney@nvidia.com \
    --cc=acourbot@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=jhubbard@nvidia.com \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ttabi@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