public inbox for linux-kernel@vger.kernel.org
 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 2/6] nova-core: doc: Clarify sysmembar operations
Date: Wed, 23 Apr 2025 18:53:58 -0400	[thread overview]
Message-ID: <20250423225405.139613-3-joelagnelf@nvidia.com> (raw)
In-Reply-To: <20250423225405.139613-1-joelagnelf@nvidia.com>

sysmembar is a critical operation that the GSP falcon needs to perform
in the reset sequence. Add some code comments to clarify.

Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>
---
 drivers/gpu/nova-core/gpu.rs  | 11 ++++++++++-
 drivers/gpu/nova-core/regs.rs |  2 ++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 4d03a0b11b64..61031bccb7d3 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -158,6 +158,9 @@ pub(crate) struct Gpu {
     /// MMIO mapping of PCI BAR 0
     bar: Devres<Bar0>,
     fw: Firmware,
+    /// A system memory page for sysmembar (A GPU-initiated hardware memory-barrier
+    /// operation that flushes all pending GPU-side memory writes that were done
+    /// through PCIE, to system memory).
     sysmem_flush: DmaObject,
     timer: Timer,
     bios: Vbios,
@@ -204,7 +207,13 @@ pub(crate) fn new(
         devinit::wait_gfw_boot_completion(&bar)
             .inspect_err(|_| pr_err!("GFW boot did not complete"))?;
 
-        // System memory page required for sysmembar to properly flush into system memory.
+        // System memory page required for sysmembar which is a GPU-initiated hardware
+        // memory-barrier operation that flushes all pending GPU-side memory writes that
+        // were done through PCIE, to system memory. It is required for Falcon to be reset
+        // as the reset operation involves a reset handshake. When the falcon acks the
+        // reset, it writes its acknowledgement into system memory, but for this write to
+        // be visible to the host, the falcon needs to do sysmembar to flush
+        // its writes and prevent the driver from timing out.
         let sysmem_flush = {
             let page = DmaObject::new(
                 pdev.as_ref(),
diff --git a/drivers/gpu/nova-core/regs.rs b/drivers/gpu/nova-core/regs.rs
index f4a6a382e83f..22906ab1a43a 100644
--- a/drivers/gpu/nova-core/regs.rs
+++ b/drivers/gpu/nova-core/regs.rs
@@ -37,6 +37,8 @@
 
 /* PFB */
 
+/// These two registers together hold the physical system memory address
+/// that is used by the GPU for perform sysmembar operation (see gpu.rs).
 register!(PfbNisoFlushSysmemAddr@0x00100c10;
     31:0    adr_39_08 => as u32
 );
-- 
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 ` Joel Fernandes [this message]
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 ` [PATCH 5/6] gpu: nova-core: Clarify fields in FalconAppifHdrV1 Joel Fernandes
2025-04-24  1:18   ` 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-3-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