diff options
author | J-Alves <joao.alves@arm.com> | 2022-04-04 12:34:16 +0100 |
---|---|---|
committer | J-Alves <joao.alves@arm.com> | 2022-04-22 12:21:59 +0100 |
commit | 31d8795f4e7e4f577085040ff9deddc85cf111bc (patch) | |
tree | 6486e447ba04a78caa27c5ab01f2555c7d5546db /spm | |
parent | da3e6d4bc2a1d275e7a2c4cfa9de353fb3e81f53 (diff) |
feat(ff-a): receive boot information
Prepare secure partitions to receive boot information:
- In the partition's manifest, the GP register to receive the address in,
and the list of boot information.
- Implemented function to dump boot information.
- Update generation of SP Layout file to include offsets for image and
partition manifest.
- Change partition manifest offsets to match the information in the
SP layout.
Signed-off-by: J-Alves <joao.alves@arm.com>
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: I87d2b135379d535ccaa1a3a0a822e964cca47185
Diffstat (limited to 'spm')
-rw-r--r-- | spm/cactus/aarch64/cactus_entrypoint.S | 26 | ||||
-rw-r--r-- | spm/cactus/cactus_main.c | 57 | ||||
-rw-r--r-- | spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts | 5 | ||||
-rw-r--r-- | spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts | 5 | ||||
-rw-r--r-- | spm/cactus/plat/arm/fvp/fdts/cactus.dts | 10 | ||||
-rw-r--r-- | spm/cactus/plat/arm/tc0/fdts/cactus-secondary.dts | 5 | ||||
-rw-r--r-- | spm/cactus/plat/arm/tc0/fdts/cactus-tertiary.dts | 5 | ||||
-rw-r--r-- | spm/cactus/plat/arm/tc0/fdts/cactus.dts | 10 | ||||
-rw-r--r-- | spm/ivy/app/plat/arm/fvp/fdts/ivy.dts | 2 | ||||
-rw-r--r-- | spm/ivy/app/plat/arm/tc0/fdts/ivy.dts | 2 |
10 files changed, 92 insertions, 35 deletions
diff --git a/spm/cactus/aarch64/cactus_entrypoint.S b/spm/cactus/aarch64/cactus_entrypoint.S index 5d9f9f0..6ca342a 100644 --- a/spm/cactus/aarch64/cactus_entrypoint.S +++ b/spm/cactus/aarch64/cactus_entrypoint.S @@ -22,11 +22,15 @@ func cactus_entrypoint /* Entry reason is primary EC cold boot */ mov x19, #1 secondary_cold_entry: - /* Saving parameter registers to temporary registers. */ - mov x10, x1 - mov x11, x2 - mov x12, x3 - mov x13, x4 + /* + * x0 holds a pointer to the Boot Information Blob. + * Save it for later usage. + */ + mov x20, x0 + + /* Get the vMPIDR. The SPMC passes the vCPU linear id in lower bits. */ + mrs x0, mpidr_el1 + bic x0, x0, #0x80000000 /* Entry reason is secondary EC cold boot */ mrs x0, mpidr_el1 @@ -81,14 +85,12 @@ pie_fixup: add x1, x1, x0 bl fixup_gdt_reloc - /* Jump to the C entrypoint (it does not return) */ + /* + * Jump to the C entrypoint (it does not return). + * Pass the cold boot reason and BIB address. + */ 0: mov x0, x19 - - /* Restoring parameter registers before jumping to cactus_main. */ - mov x1, x10 - mov x2, x11 - mov x3, x12 - mov x4, x13 + mov x1, x20 /* And jump to the C entrypoint. */ b cactus_main diff --git a/spm/cactus/cactus_main.c b/spm/cactus/cactus_main.c index dd15d97..8138565 100644 --- a/spm/cactus/cactus_main.c +++ b/spm/cactus/cactus_main.c @@ -138,6 +138,45 @@ static void cactus_print_memory_layout(unsigned int vm_id) (void *)get_sp_tx_end(vm_id)); } +static void cactus_print_boot_info(struct ffa_boot_info_header *boot_info_header) +{ + struct ffa_boot_info_desc *boot_info_desc; + + if (boot_info_header == NULL) { + NOTICE("SP doesn't have boot information!\n"); + return; + } + + VERBOSE("SP boot info:\n"); + VERBOSE(" Signature: %x\n", boot_info_header->signature); + VERBOSE(" Version: %x\n", boot_info_header->version); + VERBOSE(" Blob Size: %u\n", boot_info_header->info_blob_size); + VERBOSE(" Descriptor Size: %u\n", boot_info_header->desc_size); + VERBOSE(" Descriptor Count: %u\n", boot_info_header->desc_count); + + boot_info_desc = boot_info_header->boot_info; + + if (boot_info_desc == NULL) { + ERROR("Boot data arguments error...\n"); + return; + } + + for (uint32_t i = 0; i < boot_info_header->desc_count; i++) { + VERBOSE(" Boot Data:\n"); + VERBOSE(" Type: %u\n", + ffa_boot_info_type(&boot_info_desc[i])); + VERBOSE(" Type ID: %u\n", + ffa_boot_info_type_id(&boot_info_desc[i])); + VERBOSE(" Flags:\n"); + VERBOSE(" Name Format: %x\n", + ffa_boot_info_name_format(&boot_info_desc[i])); + VERBOSE(" Content Format: %x\n", + ffa_boot_info_content_format(&boot_info_desc[i])); + VERBOSE(" Size: %u\n", boot_info_desc[i].size); + VERBOSE(" Value: %llx\n", boot_info_desc[i].content); + } +} + static void cactus_plat_configure_mmu(unsigned int vm_id) { mmap_add_region(CACTUS_TEXT_START, @@ -181,7 +220,8 @@ static void register_secondary_entrypoint(void) tftf_smc(&args); } -void __dead2 cactus_main(bool primary_cold_boot) +void __dead2 cactus_main(bool primary_cold_boot, + struct ffa_boot_info_header *boot_info_header) { assert(IS_IN_EL1() != 0); @@ -209,6 +249,20 @@ void __dead2 cactus_main(bool primary_cold_boot) /* Initialize locks for tail end interrupt handler */ sp_handler_spin_lock_init(); + + if (boot_info_header != NULL) { + /* + * TODO: Currently just validating that cactus can + * access the boot info descriptors. In case we want to + * use the boot info contents, we should check the + * blob and remap if the size is bigger than one page. + * Only then access the contents. + */ + mmap_add_dynamic_region( + (unsigned long long)boot_info_header, + (uintptr_t)boot_info_header, + PAGE_SIZE, MT_RO_DATA); + } } /* @@ -234,6 +288,7 @@ void __dead2 cactus_main(bool primary_cold_boot) set_putc_impl(PL011_AS_STDOUT); + cactus_print_boot_info(boot_info_header); } else { set_putc_impl(HVC_CALL_AS_STDOUT); } diff --git a/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts b/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts index f377c83..12d2175 100644 --- a/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts +++ b/spm/cactus/plat/arm/fvp/fdts/cactus-secondary.dts @@ -24,16 +24,13 @@ exception-level = <2>; /* S-EL1 */ execution-state = <0>; /* AARCH64 */ load-address = <0x7100000>; - entrypoint-offset = <0x00001000>; + entrypoint-offset = <0x00004000>; xlat-granule = <0>; /* 4KiB */ boot-order = <0>; messaging-method = <3>; /* Direct messaging only */ notification-support; /* Support receipt of notifications. */ run-time-model = <0>; /* Run to completion */ - /* Boot protocol */ - gp-register-num = <0x0>; - rx_tx-info { compatible = "arm,ffa-manifest-rx_tx-buffer"; rx-buffer = <&rxbuffer>; diff --git a/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts b/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts index 772c3d4..9251763 100644 --- a/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts +++ b/spm/cactus/plat/arm/fvp/fdts/cactus-tertiary.dts @@ -24,16 +24,13 @@ exception-level = <2>; /* S-EL1 */ execution-state = <0>; /* AARCH64 */ load-address = <0x7200000>; - entrypoint-offset = <0x00001000>; + entrypoint-offset = <0x00004000>; xlat-granule = <0>; /* 4KiB */ boot-order = <0>; notification-support; messaging-method = <3>; /* Direct messaging only */ run-time-model = <0>; /* Run to completion */ - /* Boot protocol */ - gp-register-num = <0x0>; - memory-regions { compatible = "arm,ffa-manifest-memory-regions"; diff --git a/spm/cactus/plat/arm/fvp/fdts/cactus.dts b/spm/cactus/plat/arm/fvp/fdts/cactus.dts index 34e59fa..3c011c9 100644 --- a/spm/cactus/plat/arm/fvp/fdts/cactus.dts +++ b/spm/cactus/plat/arm/fvp/fdts/cactus.dts @@ -24,7 +24,7 @@ exception-level = <2>; /* S-EL1 */ execution-state = <0>; /* AARCH64 */ load-address = <0x7000000>; - entrypoint-offset = <0x00001000>; + entrypoint-offset = <0x00002000>; xlat-granule = <0>; /* 4KiB */ boot-order = <0>; messaging-method = <3>; /* Direct messaging only */ @@ -33,7 +33,13 @@ run-time-model = <0>; /* Run to completion */ /* Boot protocol */ - gp-register-num = <0x0>; + gp-register-num = <0>; + + /* Boot Info */ + boot-info { + compatible = "arm,ffa-manifest-boot-info"; + ffa_manifest; + }; rx_tx-info { compatible = "arm,ffa-manifest-rx_tx-buffer"; diff --git a/spm/cactus/plat/arm/tc0/fdts/cactus-secondary.dts b/spm/cactus/plat/arm/tc0/fdts/cactus-secondary.dts index 2baa8b9..13d489c 100644 --- a/spm/cactus/plat/arm/tc0/fdts/cactus-secondary.dts +++ b/spm/cactus/plat/arm/tc0/fdts/cactus-secondary.dts @@ -22,16 +22,13 @@ exception-level = <2>; /* S-EL1 */ execution-state = <0>; /* AARCH64 */ load-address = <0xfe100000>; - entrypoint-offset = <0x00001000>; + entrypoint-offset = <0x00004000>; xlat-granule = <0>; /* 4KiB */ boot-order = <0>; messaging-method = <3>; /* Direct messaging only */ notification-support; /* Support receipt of notifications. */ run-time-model = <1>; /* Run to completion */ - /* Boot protocol */ - gp-register-num = <0x0>; - rx_tx-info { compatible = "arm,ffa-manifest-rx_tx-buffer"; rx-buffer = <&rxbuffer>; diff --git a/spm/cactus/plat/arm/tc0/fdts/cactus-tertiary.dts b/spm/cactus/plat/arm/tc0/fdts/cactus-tertiary.dts index da62d3b..807d1dd 100644 --- a/spm/cactus/plat/arm/tc0/fdts/cactus-tertiary.dts +++ b/spm/cactus/plat/arm/tc0/fdts/cactus-tertiary.dts @@ -22,16 +22,13 @@ exception-level = <2>; /* S-EL1 */ execution-state = <0>; /* AARCH64 */ load-address = <0xfe200000>; - entrypoint-offset = <0x00001000>; + entrypoint-offset = <0x00004000>; xlat-granule = <0>; /* 4KiB */ boot-order = <0>; messaging-method = <3>; /* Direct messaging only */ notification-support; /* Support receipt of notifications. */ run-time-model = <1>; /* Run to completion */ - /* Boot protocol */ - gp-register-num = <0x0>; - memory-regions { compatible = "arm,ffa-manifest-memory-regions"; diff --git a/spm/cactus/plat/arm/tc0/fdts/cactus.dts b/spm/cactus/plat/arm/tc0/fdts/cactus.dts index 64daa3d..99d3ae8 100644 --- a/spm/cactus/plat/arm/tc0/fdts/cactus.dts +++ b/spm/cactus/plat/arm/tc0/fdts/cactus.dts @@ -22,7 +22,7 @@ exception-level = <2>; /* S-EL1 */ execution-state = <0>; /* AARCH64 */ load-address = <0xfe000000>; - entrypoint-offset = <0x00001000>; + entrypoint-offset = <0x00002000>; xlat-granule = <0>; /* 4KiB */ boot-order = <0>; messaging-method = <3>; /* Direct messaging only */ @@ -31,7 +31,13 @@ run-time-model = <1>; /* Run to completion */ /* Boot protocol */ - gp-register-num = <0x0>; + gp-register-num = <0>; + + /* Boot Info */ + boot-info { + compatible = "arm,ffa-manifest-boot-info"; + ffa_manifest; + }; rx_tx-info { compatible = "arm,ffa-manifest-rx_tx-buffer"; diff --git a/spm/ivy/app/plat/arm/fvp/fdts/ivy.dts b/spm/ivy/app/plat/arm/fvp/fdts/ivy.dts index 461abe4..d368076 100644 --- a/spm/ivy/app/plat/arm/fvp/fdts/ivy.dts +++ b/spm/ivy/app/plat/arm/fvp/fdts/ivy.dts @@ -21,7 +21,7 @@ exception-level = <2>; /* S-EL1 */ execution-state = <0>; /* AARCH64 */ load-address = <0x7600000>; - entrypoint-offset = <0x00001000>; + entrypoint-offset = <0x00004000>; xlat-granule = <0>; /* 4KiB */ boot-order = <0>; messaging-method = <3>; /* Direct messaging only */ diff --git a/spm/ivy/app/plat/arm/tc0/fdts/ivy.dts b/spm/ivy/app/plat/arm/tc0/fdts/ivy.dts index 0f74358..405dca7 100644 --- a/spm/ivy/app/plat/arm/tc0/fdts/ivy.dts +++ b/spm/ivy/app/plat/arm/tc0/fdts/ivy.dts @@ -24,7 +24,7 @@ exception-level = <2>; /* S-EL1 */ execution-state = <0>; /* AARCH64 */ load-address = <0xfe600000>; - entrypoint-offset = <0x00001000>; + entrypoint-offset = <0x00004000>; xlat-granule = <0>; /* 4KiB */ boot-order = <0>; messaging-method = <3>; /* Direct messaging only */ |