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>,
	rust-for-linux@vger.kernel.org,
	Joel Fernandes <joelagnelf@nvidia.com>
Subject: [PATCH v2 2/7] nova-core: doc: Clarify sysmembar operations
Date: Sat,  3 May 2025 00:07:54 -0400	[thread overview]
Message-ID: <20250503040802.1411285-3-joelagnelf@nvidia.com> (raw)
In-Reply-To: <20250503040802.1411285-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  | 12 +++++++++---
 drivers/gpu/nova-core/regs.rs |  2 ++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index a46768d18ac3..9bd73755c466 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -169,8 +169,8 @@ pub(crate) struct Gpu {
     /// MMIO mapping of PCI BAR 0
     bar: Devres<Bar0>,
     fw: Firmware,
-    // System memory page required for flushing all pending GPU-side memory writes done through
-    // PCIE into system memory.
+    /// System memory page required for flushing all pending GPU-side memory writes done through
+    /// PCIE into system memory, via sysmembar (A GPU-initiated HW memory-barrier operation).
     sysmem_flush: DmaObject,
 }
 
@@ -215,7 +215,13 @@ pub(crate) fn new(
         devinit::wait_gfw_boot_completion(&bar)
             .inspect_err(|_| dev_err!(pdev.as_ref(), "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(), kernel::bindings::PAGE_SIZE)?;
 
diff --git a/drivers/gpu/nova-core/regs.rs b/drivers/gpu/nova-core/regs.rs
index a2b506883654..dcac7ab4619f 100644
--- a/drivers/gpu/nova-core/regs.rs
+++ b/drivers/gpu/nova-core/regs.rs
@@ -52,6 +52,8 @@ pub(crate) fn chipset(self) -> Result<Chipset, Error> {
 
 /* PFB */
 
+// These two registers together hold the physical system memory address
+// that is used by the GPU for perform sysmembar operation (see [`crate::gpu`]).
 register!(NV_PFB_NISO_FLUSH_SYSMEM_ADDR @ 0x00100c10 {
     31:0    adr_39_08 as u32;
 });
-- 
2.43.0


  parent reply	other threads:[~2025-05-03  4:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-03  4:07 [PATCH v2 0/7] Documentation for nova-core Joel Fernandes
2025-05-03  4:07 ` [PATCH v2 1/7] nova-core: doc: Add code comments related to devinit Joel Fernandes
2025-05-03  4:07 ` Joel Fernandes [this message]
2025-05-03  4:07 ` [PATCH v2 3/7] nova-core: docs: Document vbios layout Joel Fernandes
2025-05-05  3:00   ` Bagas Sanjaya
2025-05-05  3:12     ` Bagas Sanjaya
2025-05-03  4:07 ` [PATCH v2 4/7] nova-core: docs: Document fwsec operation and layout Joel Fernandes
2025-05-05  3:52   ` Bagas Sanjaya
2025-05-06 16:26   ` Zhi Wang
2025-05-09 20:56     ` Joel Fernandes
2025-05-03  4:07 ` [PATCH v2 5/7] docs: nova-core: Document devinit process Joel Fernandes
2025-05-05  4:04   ` Bagas Sanjaya
2025-05-05 22:15     ` Joel Fernandes
2025-05-03  4:07 ` [PATCH v2 6/7] docs: nova-core: Document basics of the Falcon Joel Fernandes
2025-05-05  4:14   ` Bagas Sanjaya
2025-05-05 21:37     ` Joel Fernandes
2025-05-03  4:07 ` [PATCH v2 7/7] gpu: nova-core: Clarify falcon code Joel Fernandes
2025-05-06 16:21   ` Zhi Wang
2025-05-09 20:59     ` Joel Fernandes
2025-06-30 10:37 ` [PATCH v2 0/7] Documentation for nova-core Danilo Krummrich
2025-06-30 11:33   ` Alexandre Courbot

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=20250503040802.1411285-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=rust-for-linux@vger.kernel.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®