summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_phys_booter.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/gsp_phys_booter.h')
-rw-r--r--kernel/gsp_phys_booter.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/kernel/gsp_phys_booter.h b/kernel/gsp_phys_booter.h
index d76439d..a669bf3 100644
--- a/kernel/gsp_phys_booter.h
+++ b/kernel/gsp_phys_booter.h
@@ -71,6 +71,11 @@ void gsp_phys_boot_rmwait(struct gsp_phys_boot *boot, void __iomem *bar0,
/*
* Release sequence, in this order (gsp_phys_gpu_release):
+ * 0. gsp_phys_boot_rm_unload(): if stage 3d ran and the
+ * UNLOADING_GUEST_DRIVER RPC has not been submitted yet, submit it once
+ * (bounded) and wait for the GSP-RM processor suspend so the scratch14
+ * handoff bit the Booter Unload gate needs can be set; a no-op when
+ * stage 3d did not run or the RPC was already sent in this boot;
* 1. gsp_phys_boot_quiesce(): if a Booter Load kick was issued, reset the
* GSP falcon (stops RISC-V/GSP-RM) BEFORE the FWSEC teardown runs; no
* device access when bar0 is NULL (unresponsive-board abort);
@@ -82,4 +87,39 @@ void gsp_phys_boot_rmwait(struct gsp_phys_boot *boot, void __iomem *bar0,
void gsp_phys_boot_quiesce(void __iomem *bar0);
void gsp_phys_boot_staging_free(struct pci_dev *pdev);
+/*
+ * Command-queue TX: build a single-element msgq record with the 570.144
+ * element/rpc header layout, compute the XOR-fold checksum, copy it into the
+ * next command-queue slot, publish the new writePtr with a DMA barrier and
+ * ring the GSP queue-head doorbell. Requires the stage-3d command-queue
+ * staging; bounded and refuses (with a log) when the TX header does not match
+ * what was staged. Does not touch WPR2 or the falcons.
+ */
+int gsp_phys_queue_tx_submit(void __iomem *bar0, u32 function,
+ const void *payload, u32 payload_len);
+
+/*
+ * Send NV_VGPU_MSG_FUNCTION_UNLOADING_GUEST_DRIVER (function 47) with a normal
+ * unload payload (bInPMTransition=0, bGc6Entering=0, newLevel=0), then wait
+ * (bounded, 10 s) for the GSP-RM processor to suspend the way
+ * kgspWaitForProcessorSuspend_TU102 does: GSP falcon MAILBOX0 == 0x80000000.
+ * Sends at most once per boot (tracked across release and the debugfs
+ * trigger). Returns 0 only when the suspend was observed and all four
+ * scratch14 handoff bits (24..27) read DONE, -EALREADY if already sent,
+ * -EINVAL when stage 3d did not run, -ETIMEDOUT on the suspend bound and
+ * -EIO when the handoff bits are not all DONE after the suspend. Never writes
+ * WPR2.
+ */
+int gsp_phys_boot_rm_unload(void __iomem *bar0);
+
+/*
+ * Module-owned debugfs trigger (dir "open-iov-vfio", file
+ * "gsp-phys-unload-rpc", write-only). Writing "1" runs
+ * gsp_phys_boot_rm_unload() on a live claim; every other value or state
+ * (parameter off, GPU unclaimed, stage 3d not run, already submitted) is a
+ * logged no-op. Registered by nv_vgpu_init() and removed by nv_vgpu_exit().
+ */
+int gsp_phys_boot_debugfs_init(void);
+void gsp_phys_boot_debugfs_fini(void);
+
#endif /* GSP_PHYS_BOOTER_H */