[3/3] fsp/console: Always establish OPAL console API backend

Message ID 20180511064121.18122-3-benh@kernel.crashing.org
State Accepted
Headers show
Series
  • [1/3] cpu: Remove duplicate setting of LPCR
Related show

Commit Message

Benjamin Herrenschmidt May 11, 2018, 6:41 a.m.
Currently we only call set_opal_console() to establish the backend
used by the OPAL console API if we find at least one FSP serial
port in HDAT.

On systems where there is none (IPMI only), we fail to set it,
causing the console code to try to use the dummy console causing
an assertion failure during boot due to clashing on the device-tree
node names.

So always set it if an FSP is present

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 hw/fsp/fsp-console.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Vasant Hegde May 21, 2018, 10:06 a.m. | #1
On 05/11/2018 12:11 PM, Benjamin Herrenschmidt wrote:
> Currently we only call set_opal_console() to establish the backend
> used by the OPAL console API if we find at least one FSP serial
> port in HDAT.

Ah! I thought FSP always gives at least one serial port detail.

> 
> On systems where there is none (IPMI only), we fail to set it,
> causing the console code to try to use the dummy console causing
> an assertion failure during boot due to clashing on the device-tree
> node names.
> 
> So always set it if an FSP is present

Looks good to me.

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

-Vasant

> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>   hw/fsp/fsp-console.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
> index ece9400e..c6e886f7 100644
> --- a/hw/fsp/fsp-console.c
> +++ b/hw/fsp/fsp-console.c
> @@ -850,6 +850,9 @@ void fsp_console_init(void)
>   	/* Register poller */
>   	opal_add_poller(fsp_console_poll, NULL);
>   
> +	/* Register OPAL console backend */
> +	set_opal_console(&fsp_opal_con);
> +
>   	/* Parse serial port data */
>   	serials = dt_find_by_path(dt_root, "ipl-params/fsp-serial");
>   	if (!serials) {
> @@ -869,8 +872,6 @@ void fsp_console_init(void)
>   	}
>   
>   	op_display(OP_LOG, OP_MOD_FSPCON, 0x0005);
> -
> -	set_opal_console(&fsp_opal_con);
>   }
>   
>   static int64_t fsp_console_flush(int64_t terminal __unused)
>
Benjamin Herrenschmidt May 21, 2018, 3:23 p.m. | #2
On Mon, 2018-05-21 at 15:36 +0530, Vasant Hegde wrote:
> On 05/11/2018 12:11 PM, Benjamin Herrenschmidt wrote:
> > Currently we only call set_opal_console() to establish the backend
> > used by the OPAL console API if we find at least one FSP serial
> > port in HDAT.
> 
> Ah! I thought FSP always gives at least one serial port detail.

Not on that big cores ZZ I was given access to (zzfp033)

> > 
> > On systems where there is none (IPMI only), we fail to set it,
> > causing the console code to try to use the dummy console causing
> > an assertion failure during boot due to clashing on the device-tree
> > node names.
> > 
> > So always set it if an FSP is present
> 
> Looks good to me.
> 
> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> 
> -Vasant
> 
> > 
> > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > ---
> >   hw/fsp/fsp-console.c | 5 +++--
> >   1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
> > index ece9400e..c6e886f7 100644
> > --- a/hw/fsp/fsp-console.c
> > +++ b/hw/fsp/fsp-console.c
> > @@ -850,6 +850,9 @@ void fsp_console_init(void)
> >   	/* Register poller */
> >   	opal_add_poller(fsp_console_poll, NULL);
> >   
> > +	/* Register OPAL console backend */
> > +	set_opal_console(&fsp_opal_con);
> > +
> >   	/* Parse serial port data */
> >   	serials = dt_find_by_path(dt_root, "ipl-params/fsp-serial");
> >   	if (!serials) {
> > @@ -869,8 +872,6 @@ void fsp_console_init(void)
> >   	}
> >   
> >   	op_display(OP_LOG, OP_MOD_FSPCON, 0x0005);
> > -
> > -	set_opal_console(&fsp_opal_con);
> >   }
> >   
> >   static int64_t fsp_console_flush(int64_t terminal __unused)
> >

Patch

diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
index ece9400e..c6e886f7 100644
--- a/hw/fsp/fsp-console.c
+++ b/hw/fsp/fsp-console.c
@@ -850,6 +850,9 @@  void fsp_console_init(void)
 	/* Register poller */
 	opal_add_poller(fsp_console_poll, NULL);
 
+	/* Register OPAL console backend */
+	set_opal_console(&fsp_opal_con);
+
 	/* Parse serial port data */
 	serials = dt_find_by_path(dt_root, "ipl-params/fsp-serial");
 	if (!serials) {
@@ -869,8 +872,6 @@  void fsp_console_init(void)
 	}
 
 	op_display(OP_LOG, OP_MOD_FSPCON, 0x0005);
-
-	set_opal_console(&fsp_opal_con);
 }
 
 static int64_t fsp_console_flush(int64_t terminal __unused)