summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_phys_boot.c
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-01 10:07:14 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-10-01 10:07:14 -0400
commitc295a1b785efd01547f7d86dc30270360edf817a (patch)
tree56e7c4e061536bdaee2319aad08dd4e80faa15b2 /kernel/gsp_phys_boot.c
parent4b39627e2bed5d2dfe8b4b909516f8fa3094cb5a (diff)
downloadopen-iov-c295a1b785efd01547f7d86dc30270360edf817a.tar.gz
open-iov-c295a1b785efd01547f7d86dc30270360edf817a.zip
gsp-phys: real GSP boot stages 3d/3e and the GSP-RM run-sequencer event
Stage 3d stages the GSP-RM boot from host sysmem (FMC, radix3 over the GSP-RM ELF, signature, message queues, libos LOGINIT/LOGRM/RMARGS and GSP arguments) and runs Booter Load on SEC2: GSP RISC-V reset, libos mailbox, IMEM/DMEM direct load, BOOTVEC=0, M0==0, FALCON_OS, RISC-V active. Stage 3e links the status queue and polls for GSP-RM events; it now also executes the inline run-sequencer command buffer (event 0x1002) against BAR0 (REG_WRITE/MODIFY/POLL, DELAY, STORE, CORE_* including CORE_RESUME) and then waits for GSP_INIT_DONE 0x1001. Gated by gsp_phys_boot / gsp_phys_boot_dryrun (default off; the normal load path writes nothing). gsp_phys_fwsec=1 without gsp_phys_boot=1 is refused: a FWSEC-only carve cannot pass the booter-unload handoff gate. Release quiesces the GSP, runs the existing FWSEC-SB/booter-unload teardown and frees all staging. tools/gen_gsp_bindata.py decodes the public generated archives into the Booter Load image (prod signature patched at 0x8700) and the GSP-RM boot (FMC) image; both are self-checked at build time.
Diffstat (limited to 'kernel/gsp_phys_boot.c')
-rw-r--r--kernel/gsp_phys_boot.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/kernel/gsp_phys_boot.c b/kernel/gsp_phys_boot.c
index 0322c70..59e7966 100644
--- a/kernel/gsp_phys_boot.c
+++ b/kernel/gsp_phys_boot.c
@@ -22,6 +22,7 @@
#include <linux/io.h>
#include "gsp_phys_boot.h"
+#include "gsp_phys_booter.h"
static bool gsp_phys_layout_param;
module_param_named(gsp_phys_layout, gsp_phys_layout_param, bool, 0644);
@@ -301,7 +302,13 @@ int gsp_phys_boot_layout_init(struct gsp_phys_boot *boot, struct pci_dev *pdev,
u64 pre_wpr_heap, post_wpr_heap, wpr_heap_size;
int ret;
- if (!gsp_phys_layout_enabled() || boot->initialized)
+ /*
+ * gsp_phys_boot/gsp_phys_boot_dryrun force the layout stage (the boot
+ * path cannot stage the boot images without the argument pages and the
+ * computed WPR layout); gsp_phys_layout keeps its standalone meaning.
+ */
+ if ((!gsp_phys_layout_enabled() && !gsp_phys_boot_requested()) ||
+ boot->initialized)
return 0;
if (!pdev || !bar0 || !fw_image_size)
return -EINVAL;
@@ -492,3 +499,46 @@ void gsp_phys_boot_layout_fini(struct gsp_phys_boot *boot, struct pci_dev *pdev)
boot->initialized = false;
pr_info("gsp-phys-boot: boot-argument pages freed\n");
}
+
+int gsp_phys_boot_meta_set_sysmem(struct gsp_phys_boot *boot,
+ u64 radix3_dma, u64 radix3_size,
+ u64 fmc_dma, u64 fmc_size,
+ u64 sig_dma, u64 sig_size)
+{
+ struct gsp_phys_wpr_meta *meta;
+
+ if (!boot || !boot->initialized || !boot->wpr_meta_va)
+ return -EINVAL;
+ if (!radix3_dma || !radix3_size || !fmc_dma || !fmc_size || !sig_dma ||
+ !sig_size) {
+ pr_err("gsp-phys-boot: refusing to write zero sysmem addresses into the WPR meta (radix3=0x%llx fmc=0x%llx sig=0x%llx)\n",
+ radix3_dma, fmc_dma, sig_dma);
+ return -EINVAL;
+ }
+
+ meta = boot->wpr_meta_va;
+ meta->sysmem_addr_of_radix3_elf = radix3_dma;
+ meta->size_of_radix3_elf = radix3_size;
+ meta->sysmem_addr_of_bootloader = fmc_dma;
+ meta->size_of_bootloader = fmc_size;
+ meta->bootloader_code_offset = 0;
+ meta->bootloader_data_offset = 0;
+ meta->bootloader_manifest_offset = 0;
+ meta->sysmem_addr_of_signature = sig_dma;
+ meta->size_of_signature = sig_size;
+ meta->sysmem_addr_of_crash_report_queue = 0;
+ meta->size_of_crash_report_queue = 0;
+
+ if (meta->sysmem_addr_of_radix3_elf != radix3_dma ||
+ meta->sysmem_addr_of_bootloader != fmc_dma ||
+ meta->sysmem_addr_of_signature != sig_dma ||
+ meta->size_of_bootloader != fmc_size ||
+ meta->size_of_signature != sig_size) {
+ pr_err("gsp-phys-boot: WPR meta sysmem readback mismatch\n");
+ return -EIO;
+ }
+
+ pr_info("gsp-phys-boot: WPR meta sysmem addrs: radix3=0x%llx (0x%llx), bootloader=0x%llx (0x%llx), signature=0x%llx (0x%llx), crashReportQueue=0/0, bootloader offsets=0\n",
+ radix3_dma, radix3_size, fmc_dma, fmc_size, sig_dma, sig_size);
+ return 0;
+}