diff mbox

[1/2] Add opal_boot_complete to debug descriptor

Message ID 1442286607-15755-1-git-send-email-joel@jms.id.au
State Accepted
Headers show

Commit Message

Joel Stanley Sept. 15, 2015, 3:10 a.m. UTC
This tells us when we've entered the host. First use case is knowing if
we can can rely on host communication working, such as receiving and
acting on an opal_msg.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 core/init.c       | 3 +++
 include/skiboot.h | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Vasant Hegde Sept. 15, 2015, 4:57 a.m. UTC | #1
On 09/15/2015 08:40 AM, Joel Stanley wrote:
> This tells us when we've entered the host. First use case is knowing if
> we can can rely on host communication working, such as receiving and
> acting on an opal_msg.

Good one.. May be we can use this for FSP based system for EPOW/DPO events..

Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>

-Vasant

> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  core/init.c       | 3 +++
>  include/skiboot.h | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/core/init.c b/core/init.c
> index 7baca0d..d5c1779 100644
> --- a/core/init.c
> +++ b/core/init.c
> @@ -60,6 +60,7 @@ struct debug_descriptor debug_descriptor = {
>  	.memcons_phys	= (uint64_t)&memcons,
>  	.trace_mask	= 0, /* All traces disabled by default */
>  	.console_log_levels = (PR_DEBUG << 4) | PR_NOTICE,
> +	.opal_boot_complete = false,
>  };
>  
>  static bool try_load_elf64_le(struct elf_hdr *header)
> @@ -454,6 +455,8 @@ void __noreturn load_and_boot_kernel(bool is_reboot)
>  	printf("INIT: Starting kernel at 0x%llx, fdt at %p (size 0x%x)\n",
>  	       kernel_entry, fdt, fdt_totalsize(fdt));
>  
> +	debug_descriptor.opal_boot_complete = true;
> +
>  	fdt_set_boot_cpuid_phys(fdt, this_cpu()->pir);
>  	if (kernel_32bit)
>  		start_kernel32(kernel_entry, fdt, mem_top);
> diff --git a/include/skiboot.h b/include/skiboot.h
> index 4b58597..c12fa67 100644
> --- a/include/skiboot.h
> +++ b/include/skiboot.h
> @@ -65,7 +65,7 @@ struct debug_descriptor {
>  	u32	version;
>  	u8	console_log_levels;	/* high 4 bits in memory,
>  					 * low 4 bits driver (e.g. uart). */
> -	u8	reserved1;
> +	bool	opal_boot_complete : 1;	/* True as we jump to host OS */
>  	u16	reserved2;
>  	u32	reserved[2];
>  
>
Stewart Smith Sept. 16, 2015, 3:57 a.m. UTC | #2
Joel Stanley <joel@jms.id.au> writes:
> This tells us when we've entered the host. First use case is knowing if
> we can can rely on host communication working, such as receiving and
> acting on an opal_msg.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  core/init.c       | 3 +++
>  include/skiboot.h | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/core/init.c b/core/init.c
> index 7baca0d..d5c1779 100644
> --- a/core/init.c
> +++ b/core/init.c
> @@ -60,6 +60,7 @@ struct debug_descriptor debug_descriptor = {
>  	.memcons_phys	= (uint64_t)&memcons,
>  	.trace_mask	= 0, /* All traces disabled by default */
>  	.console_log_levels = (PR_DEBUG << 4) | PR_NOTICE,
> +	.opal_boot_complete = false,
>  };
>  
>  static bool try_load_elf64_le(struct elf_hdr *header)
> @@ -454,6 +455,8 @@ void __noreturn load_and_boot_kernel(bool is_reboot)
>  	printf("INIT: Starting kernel at 0x%llx, fdt at %p (size 0x%x)\n",
>  	       kernel_entry, fdt, fdt_totalsize(fdt));
>  
> +	debug_descriptor.opal_boot_complete = true;
> +
>  	fdt_set_boot_cpuid_phys(fdt, this_cpu()->pir);
>  	if (kernel_32bit)
>  		start_kernel32(kernel_entry, fdt, mem_top);
> diff --git a/include/skiboot.h b/include/skiboot.h
> index 4b58597..c12fa67 100644
> --- a/include/skiboot.h
> +++ b/include/skiboot.h
> @@ -65,7 +65,7 @@ struct debug_descriptor {
>  	u32	version;
>  	u8	console_log_levels;	/* high 4 bits in memory,
>  					 * low 4 bits driver (e.g. uart). */
> -	u8	reserved1;
> +	bool	opal_boot_complete : 1;	/* True as we jump to host OS */
>  	u16	reserved2;
>  	u32	reserved[2];

I think this is my fault for not saying on IRC properly - using
bitflag=win, C bitfields not so much. Mainly because compiler can do
basically whatever it wants with them, which is fine everywhere probably
except debug_descriptor.

Maybe grab the 8 bits as opal_state and we can use a bit for
boot_complete, maybe another for assert etc?
Stewart Smith Sept. 30, 2015, 11:05 a.m. UTC | #3
Joel Stanley <joel@jms.id.au> writes:
> This tells us when we've entered the host. First use case is knowing if
> we can can rely on host communication working, such as receiving and
> acting on an opal_msg.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>

Thanks! Switched to a bit thingy rather than a c bitfield and merged.

This merge brought to you by: Sixpoint 4Beans.
Joel Stanley Sept. 30, 2015, 1:49 p.m. UTC | #4
On Wed, Sep 30, 2015 at 8:35 PM, Stewart Smith
<stewart@linux.vnet.ibm.com> wrote:
> Joel Stanley <joel@jms.id.au> writes:
>> This tells us when we've entered the host. First use case is knowing if
>> we can can rely on host communication working, such as receiving and
>> acting on an opal_msg.
>>
>> Signed-off-by: Joel Stanley <joel@jms.id.au>
>
> Thanks! Switched to a bit thingy rather than a c bitfield and merged.

Thanks for fixing that one up for me.

> This merge brought to you by: Sixpoint 4Beans.

Yum!
diff mbox

Patch

diff --git a/core/init.c b/core/init.c
index 7baca0d..d5c1779 100644
--- a/core/init.c
+++ b/core/init.c
@@ -60,6 +60,7 @@  struct debug_descriptor debug_descriptor = {
 	.memcons_phys	= (uint64_t)&memcons,
 	.trace_mask	= 0, /* All traces disabled by default */
 	.console_log_levels = (PR_DEBUG << 4) | PR_NOTICE,
+	.opal_boot_complete = false,
 };
 
 static bool try_load_elf64_le(struct elf_hdr *header)
@@ -454,6 +455,8 @@  void __noreturn load_and_boot_kernel(bool is_reboot)
 	printf("INIT: Starting kernel at 0x%llx, fdt at %p (size 0x%x)\n",
 	       kernel_entry, fdt, fdt_totalsize(fdt));
 
+	debug_descriptor.opal_boot_complete = true;
+
 	fdt_set_boot_cpuid_phys(fdt, this_cpu()->pir);
 	if (kernel_32bit)
 		start_kernel32(kernel_entry, fdt, mem_top);
diff --git a/include/skiboot.h b/include/skiboot.h
index 4b58597..c12fa67 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -65,7 +65,7 @@  struct debug_descriptor {
 	u32	version;
 	u8	console_log_levels;	/* high 4 bits in memory,
 					 * low 4 bits driver (e.g. uart). */
-	u8	reserved1;
+	bool	opal_boot_complete : 1;	/* True as we jump to host OS */
 	u16	reserved2;
 	u32	reserved[2];