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: use offset_of in PmuLookupTableHeader::new
Date: Fri, 25 Jul 2025 22:35:06 +0900 [thread overview]
Message-ID: <DBL6BUAHZ250.3UCFP2OB3UEIY@nvidia.com> (raw)
In-Reply-To: <20250718073633.194032-1-krakow20@gmail.com>
On Fri Jul 18, 2025 at 4:36 PM JST, Rhys Lloyd wrote:
> Use the offset_of macro for each struct field, annotate the
> `PmuLookupTableHeader` struct with `#[repr(C)]` attribute,
> and add a TODO message to use FromBytes when available.
>
> Signed-off-by: Rhys Lloyd <krakow20@gmail.com>
> ---
> drivers/gpu/nova-core/vbios.rs | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
> index a77d7a4c8595..cedfcf3476bb 100644
> --- a/drivers/gpu/nova-core/vbios.rs
> +++ b/drivers/gpu/nova-core/vbios.rs
> @@ -893,6 +893,7 @@ fn try_from(base: BiosImageBase) -> Result<Self> {
> ///
> /// See the [`PmuLookupTable`] description for more information.
> #[expect(dead_code)]
> +#[repr(C)]
> struct PmuLookupTableHeader {
> version: u8,
> header_len: u8,
> @@ -901,16 +902,17 @@ struct PmuLookupTableHeader {
> }
>
> impl PmuLookupTableHeader {
> + // TODO[TRSM]: use FromBytes::from_bytes when it becomes available.
> fn new(data: &[u8]) -> Result<Self> {
> if data.len() < core::mem::size_of::<Self>() {
> return Err(EINVAL);
> }
>
> Ok(PmuLookupTableHeader {
> - version: data[0],
> - header_len: data[1],
> - entry_len: data[2],
> - entry_count: data[3],
> + version: data[const { core::mem::offset_of!(PmuLookupTableHeader, version) }],
> + header_len: data[const { core::mem::offset_of!(PmuLookupTableHeader, header_len) }],
> + entry_len: data[const { core::mem::offset_of!(PmuLookupTableHeader, entry_len) }],
> + entry_count: data[const { core::mem::offset_of!(PmuLookupTableHeader, entry_count) }],
This chunk does not apply - on nova-next PmuLookupTableHeader does not
seem to exist. I think I remember you split PmuLookupTableHeader in
another patch, so can you send all the relevant patches as a series that
applies cleanly on top of nova-next?
next prev parent reply other threads:[~2025-07-25 13:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-18 7:36 Rhys Lloyd
2025-07-18 7:36 ` [PATCH v2] gpu: nova-core: vbios: use size_of instead of magic number Rhys Lloyd
2025-07-25 13:29 ` Alexandre Courbot
2025-07-18 7:36 ` [PATCH v3] gpu: nova-core: vbios: change PmuLookupTableEntry to use size_of Rhys Lloyd
2025-07-25 13:30 ` Alexandre Courbot
2025-07-25 13:35 ` Alexandre Courbot [this message]
2025-07-25 14:04 ` [PATCH] gpu: nova-core: vbios: use offset_of in PmuLookupTableHeader::new Danilo Krummrich
2025-07-27 9:51 ` Rhys Lloyd
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=DBL6BUAHZ250.3UCFP2OB3UEIY@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®