mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Fernandes <joelagnelf@nvidia.com>
To: linux-kernel@vger.kernel.org, Danilo Krummrich <dakr@kernel.org>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	Alexandre Courbot <acourbot@nvidia.com>,
	John Hubbard <jhubbard@nvidia.com>,
	Shirish Baskaran <sbaskaran@nvidia.com>,
	Alistair Popple <apopple@nvidia.com>,
	Timur Tabi <ttabi@nvidia.com>, Ben Skeggs <bskeggs@nvidia.com>,
	Joel Fernandes <joelagnelf@nvidia.com>
Subject: [PATCH 5/6] gpu: nova-core: Clarify fields in FalconAppifHdrV1
Date: Wed, 23 Apr 2025 18:54:01 -0400	[thread overview]
Message-ID: <20250423225405.139613-6-joelagnelf@nvidia.com> (raw)
In-Reply-To: <20250423225405.139613-1-joelagnelf@nvidia.com>

Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
---
 drivers/gpu/nova-core/firmware/fwsec.rs | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/nova-core/firmware/fwsec.rs b/drivers/gpu/nova-core/firmware/fwsec.rs
index 664319d1d31c..79c21db9d89d 100644
--- a/drivers/gpu/nova-core/firmware/fwsec.rs
+++ b/drivers/gpu/nova-core/firmware/fwsec.rs
@@ -29,11 +29,14 @@
 
 #[repr(C)]
 #[derive(Debug)]
+
+/// The header of the Application Interface table, used
+/// to locate the DMEMMAPPER section in the DMEM (see fwsec.rst).
 struct FalconAppifHdrV1 {
-    ver: u8,
-    hdr: u8,
-    len: u8,
-    cnt: u8,
+    version: u8,
+    header_size: u8,
+    entry_size: u8,
+    entry_count: u8,
 }
 // SAFETY: any byte sequence is valid for this struct.
 unsafe impl FromBytes for FalconAppifHdrV1 {}
@@ -169,14 +172,14 @@ fn patch_command(fw: &mut DmaObject, v3_desc: &FalconUCodeDescV3, cmd: FwsecComm
     let hdr_offset = (v3_desc.imem_load_size + v3_desc.interface_offset) as usize;
     let hdr: &FalconAppifHdrV1 = unsafe { transmute(fw, hdr_offset) }?;
 
-    if hdr.ver != 1 {
+    if hdr.version != 1 {
         return Err(EINVAL);
     }
 
     // Find the DMEM mapper section in the firmware.
-    for i in 0..hdr.cnt as usize {
+    for i in 0..hdr.entry_count as usize {
         let app: &FalconAppifV1 =
-            unsafe { transmute(fw, hdr_offset + hdr.hdr as usize + i * hdr.len as usize) }?;
+            unsafe { transmute(fw, hdr_offset + hdr.header_size as usize + i * hdr.entry_size as usize) }?;
 
         if app.id != NVFW_FALCON_APPIF_ID_DMEMMAPPER {
             continue;
-- 
2.43.0


  parent reply	other threads:[~2025-04-23 22:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 22:53 [PATCH 0/6] Additional documentation for nova-core Joel Fernandes
2025-04-23 22:53 ` [PATCH 1/6] nova-core: doc: Add code comments related to devinit Joel Fernandes
2025-04-23 22:53 ` [PATCH 2/6] nova-core: doc: Clarify sysmembar operations Joel Fernandes
2025-04-23 22:53 ` [PATCH 3/6] nova-core: docs: Document vbios layout Joel Fernandes
2025-04-23 23:12   ` Timur Tabi
2025-04-23 23:30     ` Joel Fernandes
2025-04-23 22:54 ` [PATCH 4/6] nova-core: docs: Document fwsec operation and layout Joel Fernandes
2025-04-23 22:54 ` Joel Fernandes [this message]
2025-04-24  1:18   ` [PATCH 5/6] gpu: nova-core: Clarify fields in FalconAppifHdrV1 Alexandre Courbot
     [not found]     ` <174546399398.876.3516508778193165894@patchwork.local>
2025-04-24  7:45       ` [5/6] " Alexandre Courbot
2025-04-24 13:03         ` Joel Fernandes
2025-04-23 22:54 ` [PATCH 6/6] nova-core: docs: Document devinit process Joel Fernandes
2025-04-24  1:25 ` [PATCH 0/6] Additional documentation for nova-core Alexandre Courbot
2025-04-24  8:10   ` Danilo Krummrich

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=20250423225405.139613-6-joelagnelf@nvidia.com \
    --to=joelagnelf@nvidia.com \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=apopple@nvidia.com \
    --cc=bskeggs@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=sbaskaran@nvidia.com \
    --cc=simona@ffwll.ch \
    --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

all inboxes | Powered by JetHome®