From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Rhys Lloyd" <krakow20@gmail.com>, <dakr@kernel.org>
Cc: <rust-for-linux@vger.kernel.org>, <airlied@gmail.com>,
<simona@ffwll.ch>, <nouveau@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] gpu: nova-core: vbios: split out PmuLookupTableHeader from PmuLookupTable
Date: Wed, 16 Jul 2025 10:40:47 +0900 [thread overview]
Message-ID: <DBD3I0RWQ39M.XA1Q0WSOJWSE@nvidia.com> (raw)
In-Reply-To: <20250714104322.100511-2-krakow20@gmail.com>
On Mon Jul 14, 2025 at 7:43 PM JST, Rhys Lloyd wrote:
> Separating the header allows the use of `size_of::<PmuLookupTableHeader>()`
> instead of the magic number 4.
>
> Signed-off-by: Rhys Lloyd <krakow20@gmail.com>
> ---
> drivers/gpu/nova-core/vbios.rs | 56 +++++++++++++++++++++-------------
> 1 file changed, 35 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
> index 663fc50e8b66..20011c5c9bbc 100644
> --- a/drivers/gpu/nova-core/vbios.rs
> +++ b/drivers/gpu/nova-core/vbios.rs
> @@ -889,6 +889,32 @@ fn try_from(base: BiosImageBase) -> Result<Self> {
> }
> }
>
> +/// The [`PmuLookupTableHeader`] structure is header information for [`PmuLookupTable`].
> +///
> +/// See the [`PmuLookupTable`] description for more information.
> +#[expect(dead_code)]
> +struct PmuLookupTableHeader {
> + version: u8,
> + header_len: u8,
> + entry_len: u8,
> + entry_count: u8,
> +}
> +
> +impl PmuLookupTableHeader {
Can you add a
// TODO[TRSM]: use FromBytes::from_bytes when it becomes available.
as ultimately that's what we want to do.
(we are using these markers to keep track of tasks to complete as Rust
features land, see Documentation/gpu/nova/core/todo.rst)
> + fn new(data: &[u8]) -> Result<Self> {
> + if data.len() < core::mem::size_of::<Self>() {
> + return Err(EINVAL);
> + }
> +
> + Ok(PmuLookupTableHeader {
> + version: data[0],
How about making `PmuLookupTableHeader` `#[repr(C)]` and using
`offset_of!`? This will also set the stage for the transition to using
`FromBytes::from_bytes`.
next prev parent reply other threads:[~2025-07-16 1:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-14 10:43 [PATCH] gpu: nova-core: vbios: change PmuLookupTableEntry to relax alignment Rhys Lloyd
2025-07-14 10:43 ` [PATCH] gpu: nova-core: vbios: split out PmuLookupTableHeader from PmuLookupTable Rhys Lloyd
2025-07-16 1:40 ` Alexandre Courbot [this message]
2025-07-14 10:43 ` [PATCH] gpu: nova-core: vbios: use size_of instead of magic number Rhys Lloyd
2025-07-16 1:43 ` Alexandre Courbot
2025-07-14 10:51 ` [PATCH] gpu: nova-core: vbios: change PmuLookupTableEntry to relax alignment Benno Lossin
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=DBD3I0RWQ39M.XA1Q0WSOJWSE@nvidia.com \
--to=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=krakow20@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.