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 1/2] gpu: nova-core: vbios: split out PmuLookupTableHeader from PmuLookupTable
Date: Tue, 29 Jul 2025 13:34:08 +0900 [thread overview]
Message-ID: <DBO9BTJ5Q8IM.2AY6DJQ9X9EIY@nvidia.com> (raw)
In-Reply-To: <20250727094903.20483-1-krakow20@gmail.com>
On Sun Jul 27, 2025 at 6:48 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 5b5d9f38cbb3..a77d7a4c8595 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 {
> + fn new(data: &[u8]) -> Result<Self> {
> + if data.len() < core::mem::size_of::<Self>() {
We cannot rely on `size_of::<Self>` to be 4 if `Self` is not
`#[repr(C)]`. Since this is done in the second patch, I'd merge these
two into a single one for simplicity.
prev parent reply other threads:[~2025-07-29 4:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-27 9:48 Rhys Lloyd
2025-07-27 9:49 ` [PATCH 2/2] gpu: nova-core: vbios: use offset_of in PmuLookupTableHeader::new Rhys Lloyd
2025-07-29 4:34 ` Alexandre Courbot [this message]
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=DBO9BTJ5Q8IM.2AY6DJQ9X9EIY@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 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®