feat(fvp): enable kernel dt convention
Enable USE_KERNEL_DT_CONVENTION for the FVP platform to pass the DT blob
(DTB) in x0 to BL33. This aligns with the Linux boot protocol as
described in Documentation/arm64/booting.rst.
In addition:
- Clean up legacy ARM_LINUX_KERNEL_AS_BL33 handling since
USE_KERNEL_DT_CONVENTION now implies this mode for DT handoff.
- Override args.arg0 for BL33 to point to ARM_PRELOADED_DTB_BASE in
RESET_TO_BL31.
- Skip setting the primary MPID in x0 when using this convention.
Change-Id: Ieea8cfe68104b82038b9311613abf13afe7b48f1
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
diff --git a/plat/arm/common/arm_bl2_setup.c b/plat/arm/common/arm_bl2_setup.c
index 668e34d..946af3b 100644
--- a/plat/arm/common/arm_bl2_setup.c
+++ b/plat/arm/common/arm_bl2_setup.c
@@ -271,8 +271,10 @@
#endif
case BL33_IMAGE_ID:
+#if !USE_KERNEL_DT_CONVENTION
/* BL33 expects to receive the primary CPU MPID (through r0) */
bl_mem_params->ep_info.args.arg0 = 0xffff & read_mpidr();
+#endif /* !USE_KERNEL_DT_CONVENTION */
bl_mem_params->ep_info.spsr = arm_get_spsr_for_bl33_entry();
break;
diff --git a/plat/arm/common/arm_bl31_setup.c b/plat/arm/common/arm_bl31_setup.c
index ce6b21e..f44be5c 100644
--- a/plat/arm/common/arm_bl31_setup.c
+++ b/plat/arm/common/arm_bl31_setup.c
@@ -246,6 +246,13 @@
*/
bl33_image_ep_info.pc = plat_get_ns_image_entrypoint();
+#if ARM_LINUX_KERNEL_AS_BL33
+ bl33_image_ep_info.args.arg0 = ARM_PRELOADED_DTB_BASE;
+ bl33_image_ep_info.args.arg1 = 0U;
+ bl33_image_ep_info.args.arg2 = 0U;
+ bl33_image_ep_info.args.arg3 = 0U;
+#endif /* ARM_LINUX_KERNEL_AS_BL33 */
+
bl33_image_ep_info.spsr = arm_get_spsr_for_bl33_entry();
SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE);
@@ -321,27 +328,6 @@
panic();
#endif
#endif /* RESET_TO_BL31 */
-
-#if ARM_LINUX_KERNEL_AS_BL33
- /*
- * According to the file ``Documentation/arm64/booting.txt`` of the
- * Linux kernel tree, Linux expects the physical address of the device
- * tree blob (DTB) in x0, while x1-x3 are reserved for future use and
- * must be 0.
- * Repurpose the option to load Hafnium hypervisor in the normal world.
- * It expects its manifest address in x0. This is essentially the linux
- * dts (passed to the primary VM) by adding 'hypervisor' and chosen
- * nodes specifying the Hypervisor configuration.
- */
-#if RESET_TO_BL31
- bl33_image_ep_info.args.arg0 = (u_register_t)ARM_PRELOADED_DTB_BASE;
-#else
- bl33_image_ep_info.args.arg0 = arg2;
-#endif /* RESET_TO_BL31 */
- bl33_image_ep_info.args.arg1 = 0U;
- bl33_image_ep_info.args.arg2 = 0U;
- bl33_image_ep_info.args.arg3 = 0U;
-#endif /* ARM_LINUX_KERNEL_AS_BL33 */
#endif /* TRANSFER_LIST */
}