summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_phys_boot.c
diff options
context:
space:
mode:
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;
+}