diff mbox series

[1/3] core/platform: Add finalise_dt() callback

Message ID 20190711074144.25824-1-oohall@gmail.com
State Accepted
Headers show
Series [1/3] core/platform: Add finalise_dt() callback | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (4db38a36b31045f0a116d388ddeac850b38c8680)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Oliver O'Halloran July 11, 2019, 7:41 a.m. UTC
Previously the platform.exit() callback was called before we created the
flattened device tree blob for Linux. Some platforms used this to add
various DT properties and this was broken in commit Fixes: 9fc0c1287ada
("Move FSP specific op-panel calls to platform.exit()") which moved the
exit callback to after the DTB had been created.

The logic for moving the time of the exit call makes some sense since we
want to terminate the IPMI watchdog timer as late as possible, but we
still need a way for the platform modify the DTB as late as possible.

This patch adds another platform callback (yay!) called finalise_dt()
which can be used to graft stuff into the DT.

Suggested-by: Vaidyanathan Srinivasan <svaidy@linux.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 core/init.c        | 3 +++
 include/platform.h | 6 ++++++
 2 files changed, 9 insertions(+)

Comments

Vaidyanathan Srinivasan July 11, 2019, 5:10 p.m. UTC | #1
* Oliver O'Halloran <oohall@gmail.com> [2019-07-11 17:41:42]:

> Previously the platform.exit() callback was called before we created the
> flattened device tree blob for Linux. Some platforms used this to add
> various DT properties and this was broken in commit Fixes: 9fc0c1287ada
> ("Move FSP specific op-panel calls to platform.exit()") which moved the
> exit callback to after the DTB had been created.
> 
> The logic for moving the time of the exit call makes some sense since we
> want to terminate the IPMI watchdog timer as late as possible, but we
> still need a way for the platform modify the DTB as late as possible.
> 
> This patch adds another platform callback (yay!) called finalise_dt()
> which can be used to graft stuff into the DT.
> 
> Suggested-by: Vaidyanathan Srinivasan <svaidy@linux.ibm.com>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
>  core/init.c        | 3 +++
>  include/platform.h | 6 ++++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/core/init.c b/core/init.c
> index d0f28f26d400..271736be8325 100644
> --- a/core/init.c
> +++ b/core/init.c
> @@ -579,6 +579,9 @@ void __noreturn load_and_boot_kernel(bool is_reboot)
>  
>  	add_fast_reboot_dt_entries();
>  
> +	if (platform.finalise_dt)
> +		platform.finalise_dt(is_reboot);
> +
>  	/* Create the device tree blob to boot OS. */
>  	fdt = create_dtb(dt_root, false);
>  	if (!fdt) {
> diff --git a/include/platform.h b/include/platform.h
> index 0326e1a247e4..da27c03ac363 100644
> --- a/include/platform.h
> +++ b/include/platform.h
> @@ -252,8 +252,14 @@ struct platform {
>  	 */
>  	int		(*resource_loaded)(enum resource_id id, uint32_t idx);
>  
> +	/*
> +	 * Executed just prior to creating the dtb for the kernel.
> +	 */
> +	void		(*finalise_dt)(bool is_reboot);
> +
>  	/*
>  	 * Executed just prior to handing control over to the payload.
> +	 * Used to terminate watchdogs, etc.
>  	 */
>  	void		(*exit)(void);
>  

Thanks Oliver, This is a good idea and cleaner to add more stuff into
the DT callbacks.

Reviewed-by: Vaidyanathan Srinivasan <svaidy@linux.ibm.com>

--Vaidy
diff mbox series

Patch

diff --git a/core/init.c b/core/init.c
index d0f28f26d400..271736be8325 100644
--- a/core/init.c
+++ b/core/init.c
@@ -579,6 +579,9 @@  void __noreturn load_and_boot_kernel(bool is_reboot)
 
 	add_fast_reboot_dt_entries();
 
+	if (platform.finalise_dt)
+		platform.finalise_dt(is_reboot);
+
 	/* Create the device tree blob to boot OS. */
 	fdt = create_dtb(dt_root, false);
 	if (!fdt) {
diff --git a/include/platform.h b/include/platform.h
index 0326e1a247e4..da27c03ac363 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -252,8 +252,14 @@  struct platform {
 	 */
 	int		(*resource_loaded)(enum resource_id id, uint32_t idx);
 
+	/*
+	 * Executed just prior to creating the dtb for the kernel.
+	 */
+	void		(*finalise_dt)(bool is_reboot);
+
 	/*
 	 * Executed just prior to handing control over to the payload.
+	 * Used to terminate watchdogs, etc.
 	 */
 	void		(*exit)(void);