From 5f372957a5fd0dd7ca7d4b5f06e959cce92dd49e Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Thu, 1 Oct 2026 10:07:14 -0400 Subject: 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. --- kernel/gsp_phys_boot.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'kernel/gsp_phys_boot.c') 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 #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; +} -- cgit v1.2.3