Skip to content

Commit 4d3e891

Browse files
Joel FernandesDanilo Krummrich
authored andcommitted
gpu: nova-core: Clarify sysmembar operations
sysmembar is a critical operation that the GSP falcon needs to perform in the reset sequence. Add some code comments to clarify. [[email protected]: move relevant documentation to SysmemFlush type] Signed-off-by: Joel Fernandes <[email protected]> Signed-off-by: Alexandre Courbot <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Minor grammar fix in the PFB register documentation. - Danilo ] Signed-off-by: Danilo Krummrich <[email protected]>
1 parent 4a4d4e3 commit 4d3e891

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

drivers/gpu/nova-core/fb.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ mod hal;
1717
/// Type holding the sysmem flush memory page, a page of memory to be written into the
1818
/// `NV_PFB_NISO_FLUSH_SYSMEM_ADDR*` registers and used to maintain memory coherency.
1919
///
20+
/// A system memory page is required for `sysmembar`, which is a GPU-initiated hardware
21+
/// memory-barrier operation that flushes all pending GPU-side memory writes that were done through
22+
/// PCIE to system memory. It is required for falcons to be reset as the reset operation involves a
23+
/// reset handshake. When the falcon acknowledges a reset, it writes into system memory. To ensure
24+
/// this write is visible to the host and prevent driver timeouts, the falcon must perform a
25+
/// sysmembar operation to flush its writes.
26+
///
27+
/// Because of this, the sysmem flush memory page must be registered as early as possible during
28+
/// driver initialization, and before any falcon is reset.
29+
///
2030
/// Users are responsible for manually calling [`Self::unregister`] before dropping this object,
2131
/// otherwise the GPU might still use it even after it has been freed.
2232
pub(crate) struct SysmemFlush {

drivers/gpu/nova-core/gpu.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ pub(crate) struct Gpu {
170170
bar: Devres<Bar0>,
171171
fw: Firmware,
172172
/// System memory page required for flushing all pending GPU-side memory writes done through
173-
/// PCIE into system memory.
173+
/// PCIE into system memory, via sysmembar (A GPU-initiated HW memory-barrier operation).
174174
sysmem_flush: SysmemFlush,
175175
}
176176

@@ -283,7 +283,6 @@ impl Gpu {
283283
gfw::wait_gfw_boot_completion(bar)
284284
.inspect_err(|_| dev_err!(pdev.as_ref(), "GFW boot did not complete"))?;
285285

286-
// System memory page required for sysmembar to properly flush into system memory.
287286
let sysmem_flush = SysmemFlush::register(pdev.as_ref(), bar, spec.chipset)?;
288287

289288
let gsp_falcon = Falcon::<Gsp>::new(

drivers/gpu/nova-core/regs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ register!(NV_PBUS_SW_SCRATCH_0E@0x00001438 {
5151

5252
/* PFB */
5353

54+
// The following two registers together hold the physical system memory address that is used by the
55+
// GPU to perform sysmembar operations (see `fb::SysmemFlush`).
56+
5457
register!(NV_PFB_NISO_FLUSH_SYSMEM_ADDR @ 0x00100c10 {
5558
31:0 adr_39_08 as u32;
5659
});

0 commit comments

Comments
 (0)