linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Bastian Blank <waldi@debian.org>
Cc: linuxppc-dev@ozlabs.org, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/lpar - defer prefered console setup
Date: Tue, 29 Jul 2008 13:06:18 +1000	[thread overview]
Message-ID: <1217300778.11188.233.camel@pasglop> (raw)
In-Reply-To: <20080728185651.GA29530@wavehammer.waldi.eu.org>

On Mon, 2008-07-28 at 20:56 +0200, Bastian Blank wrote:
> Hi
> 
> The powerpc lpar code adds a prefered console at a very early state,
> during arch_setup. This runs even before the console setup from the
> command line and takes preference.
> 
> This patch moves the prefered console setup into an arch_initcall which
> runs later and allows the specification of the correct console on the
> command line. The udbg console remains as boot console.
> 
> There is a different problem that the code does not pick up the correct
> console because it uses a part (4) of the lpar device number (30000004)
> instead of the correct index 1.
> 
> Signed-off-by: Bastian Blank <waldi@debian.org>

Shouldn't it be a console_initcall() ? 

Now, regarding the "different problem" I think it's even worse than
that, looking at the code there's some non sensical things in here...

add_preferred_console() argument is what gets compared to
console->index, right ? Now if you look at hvc_instantiate(),
it compares each "index" argument passed in to hvc_con_driver.index,
and that index argument passed from hvc_find_vtys() has strictly
nothing to do with the vtermno, it's purely the index of the node
found in order...

So I think the whole stuff is non-sensical and needs fixing. 

Cheers,
Ben.

> diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
> index 9235c46..626290d 100644
> --- a/arch/powerpc/platforms/pseries/lpar.c
> +++ b/arch/powerpc/platforms/pseries/lpar.c
> @@ -57,6 +57,7 @@ extern void pSeries_find_serial_port(void);
>  
> 
>  int vtermno;	/* virtual terminal# for udbg  */
> +static char *console_name;
>  
>  #define __ALIGNED__ __attribute__((__aligned__(sizeof(long))))
>  static void udbg_hvsi_putc(char c)
> @@ -232,18 +233,24 @@ void __init find_udbg_vterm(void)
>  		udbg_putc = udbg_putcLP;
>  		udbg_getc = udbg_getcLP;
>  		udbg_getc_poll = udbg_getc_pollLP;
> -		add_preferred_console("hvc", termno[0] & 0xff, NULL);
> +		console_name = "hvc";
>  	} else if (of_device_is_compatible(stdout_node, "hvterm-protocol")) {
> -		vtermno = termno[0];
>  		udbg_putc = udbg_hvsi_putc;
>  		udbg_getc = udbg_hvsi_getc;
>  		udbg_getc_poll = udbg_hvsi_getc_poll;
> -		add_preferred_console("hvsi", termno[0] & 0xff, NULL);
> +		console_name = "hvsi";
>  	}
>  out:
>  	of_node_put(stdout_node);
>  }
>  
> +static void __init enable_vterm(void)
> +{
> +	if (console_name)
> +		add_preferred_console(console_name, vtermno, NULL);
> +}
> +arch_initcall(enable_vterm);
> +
>  void vpa_init(int cpu)
>  {
>  	int hwcpu = get_hard_smp_processor_id(cpu);
> 

  reply	other threads:[~2008-07-29  3:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-28 18:56 [PATCH] powerpc/lpar - defer prefered console setup Bastian Blank
2008-07-29  3:06 ` Benjamin Herrenschmidt [this message]
2008-07-29  7:36   ` Bastian Blank
2008-07-29  7:43     ` Benjamin Herrenschmidt
2008-07-29  8:07       ` Bastian Blank
2008-07-29  9:00         ` Benjamin Herrenschmidt
2008-07-30  2:34 ` Michael Ellerman
2008-07-30  6:23   ` Bastian Blank
2008-07-30  6:29     ` Bastian Blank
2008-07-30  7:34       ` [PATCH] hvc - register all available consoles (was: Re: [PATCH] powerpc/lpar - defer prefered console setup) Bastian Blank
2008-07-30  9:13       ` Milton Miller
2008-07-30 10:07         ` Bastian Blank
2008-07-30 18:18           ` Milton Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1217300778.11188.233.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=waldi@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).