Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	gregkh@linuxfoundation.org, jirislaby@kernel.org,
	prabhakar.mahadev-lad.rj@bp.renesas.com, lethal@linux-sh.org,
	g.liakhovetski@gmx.de, groeck@chromium.org, mka@chromium.org,
	ulrich.hecht+renesas@gmail.com, ysato@users.sourceforge.jp,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org,
	Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH RFT 0/6] serial: sh-sci: Fixes for earlycon and keep_bootcon
Date: Sat, 21 Dec 2024 11:54:51 +0200	[thread overview]
Message-ID: <c2b64230-f038-4da7-bc07-235072535ae1@tuxon.dev> (raw)
In-Reply-To: <CAMuHMdWx97OnPWnQn78oL+vVuQXmeaJP-byc_4ZwBMZhMOorxw@mail.gmail.com>

Hi, Geert,

On 19.12.2024 17:11, Geert Uytterhoeven wrote:
> Hi Claudiu,
> 
> On Thu, Dec 5, 2024 at 9:39 AM Claudiu Beznea <claudiu.beznea@tuxon.dev> wrote:
>> On 04.12.2024 23:38, Wolfram Sang wrote:
>>>> in the following scenarios:
>>>>
>>>> 1/ "earlycon keep_bootcon" were present in bootargs
>>>> 2/ only "earlycon" was present in bootargs
>>>> 3/ none of the "earlycon" or "earlycon keep_bootcon" were present in
>>>>    bootargs
>>> ...
>>>> Please give it a try on your devices as well.
>>>
>>> Will happily do so. Is there something to look for? Except for "it
>>> works"?
>>
>> As this code touches the earlycon functionality, of interest are the 3
>> cases highlighted above:
>>
>> 1/ "earlycon keep_bootcon" are both present in bootargs
>> 2/ only "earlycon" is present in bootargs
>> 3/ none of the "earlycon" or "earlycon keep_bootcon" are present in
>>    bootargs
>>
>> One other thing, that I was currently able to test only on RZ/G3S, is to
>> see how it behaves when the debug serial is described in DT with an alias
>> other than zero. E.g., on [1] the debug serial alias on RZ/G3S was changed
>> from 0 to 3. With the new alias (3) there were issues that I've tried to
>> fix with this series.
> 
> I gave this a try on Koelsch, which has two easily-accessible usb-serial
> ports, for all three cases above.  Originally, I had CONFIG_VT_CONSOLE=y
> (tty0 takes over from earlycon rather early), but I had to disable
> that to exercise all code paths (ttySC0 takes over much later).
> 
>   A. CONFIG_VT_CONSOLE=y: OK
>   B. CONFIG_VT_CONSOLE=y earlycon: OK
>        early_console_setup: mapbase 0x00000000e6e60000
>        earlycon: scif0 at MMIO 0x00000000e6e60000 (options '115200n8')
>        printk: legacy bootconsole [scif0] enabled
>        printk: legacy console [tty0] enabled
>        printk: legacy bootconsole [scif0] disabled
>        early_console_exit: Clearing sci_ports[0]
>   C. CONFIG_VT_CONSOLE=n earlycon: OK
>        early_console_setup: mapbase 0x00000000e6e60000
>        earlycon: scif0 at MMIO 0x00000000e6e60000 (options '115200n8')
>        printk: legacy bootconsole [scif0] enabled
>        printk: legacy console [ttySC0] enabled
>        printk: legacy bootconsole [scif0] disabled
>        early_console_exit: Not clearing sci_ports[0]
>   D. CONFIG_VT_CONSOLE=y earlycon keep_bootcon: OK
>        early_console_setup: mapbase 0x00000000e6e60000
>        earlycon: scif0 at MMIO 0x00000000e6e60000 (options '115200n8')
>        printk: legacy bootconsole [scif0] enabled
>        printk: legacy console [tty0] enabled
> 
> So all good, but note that these cases worked fine without your
> series, too.
> 
> The real troublesome cases involve using earlycon on a different
> serial port than serial0.  As I don't have any Renesas boards where
> chosen/stdout-path does not use serial0, I tried exchanging the serial0
> and serial1 DT aliases, and updating chosen/stdout-path accordingly.
> 
>   E. CONFIG_VT_CONSOLE=y: OK
>   F. CONFIG_VT_CONSOLE=y earlycon: OK
>        early_console_setup: mapbase 0x00000000e6e60000
>        earlycon: scif0 at MMIO 0x00000000e6e60000 (options '115200n8')
>        printk: legacy bootconsole [scif0] enabled
>        printk: legacy console [tty0] enabled
>        printk: legacy bootconsole [scif0] disabled
>        early_console_exit: Clearing sci_ports[0]
>   G. CONFIG_VT_CONSOLE=y earlycon keep_bootcon: SCIF1 missing
>        early_console_setup: mapbase 0x00000000e6e60000
>        earlycon: scif0 at MMIO 0x00000000e6e60000 (options '115200n8')
>        printk: legacy bootconsole [scif0] enabled
>        printk: legacy console [tty0] enabled
>        sh-sci e6e68000.serial: error -EBUSY: sci_port[0] is used by earlycon!
>   H. CONFIG_VT_CONSOLE=n earlycon: SCIF1 missing
>        early_console_setup: mapbase 0x00000000e6e60000
>        earlycon: scif0 at MMIO 0x00000000e6e60000 (options '115200n8')
>        printk: legacy bootconsole [scif0] enabled
>        printk: legacy console [ttySC1] enabled
>        printk: legacy bootconsole [scif0] disabled
>        early_console_exit: Not clearing sci_ports[0]
>        sh-sci e6e68000.serial: error -EBUSY: sci_port[0] is used by earlycon!
> 
> Case G gives a missing SCIF1, because sci_port[0] is still
> used for earlycon, as expected.
> Case H also gives a missing SCIF1, but should succeed IMHO, as earlycon
> is no longer active.  I think early_console_exit() should clear the
> earlycon flag regardless.

I'll double check it.

> 
> Note that before your series, cases E-F worked too, but cases G-H gave
> an initialized but broken SCIF1 instead.
> 
> Now, can we improve?
>   - Can we use a proper id instead of zero for earlycon, e.g.
>     sci_probe_earlyprintk() does fill in early_serial_console.index?

I looked into that but, as of my investigation, index zero is the one used
in the earlyprintk initialization process. sci_probe_earlyprintk() is
called from sci_probe(). I'll double checked it though, anyway.


>   - Alternatively, can we use a separate sci_port structure instead
>     of abusing sci_ports[0]?

I explored this too, but didn't manage to make it work.

Thank you for running all these tests,
Claudiu

> 
> Thanks!
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds


  reply	other threads:[~2024-12-21  9:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-04 15:58 [PATCH RFT 0/6] serial: sh-sci: Fixes for earlycon and keep_bootcon Claudiu
2024-12-04 15:58 ` [PATCH RFT 1/6] serial: sh-sci: Check if TX data was written to device in .tx_empty() Claudiu
2024-12-19  9:46   ` Geert Uytterhoeven
2024-12-21  9:16     ` Claudiu Beznea
2024-12-04 15:58 ` [PATCH RFT 2/6] serial: sh-sci: Drop __initdata macro for port_cfg Claudiu
2024-12-19  9:55   ` Geert Uytterhoeven
2024-12-04 15:58 ` [PATCH RFT 3/6] serial: sh-sci: Move runtime PM enable to sci_probe_single() Claudiu
2024-12-19 10:18   ` Geert Uytterhoeven
2024-12-21  9:20     ` Claudiu Beznea
2024-12-04 15:58 ` [PATCH RFT 4/6] serial: sh-sci: Do not probe the serial port if its slot in sci_ports[] is in use Claudiu
2024-12-19 14:21   ` Geert Uytterhoeven
2024-12-04 15:58 ` [PATCH RFT 5/6] serial: sh-sci: Clean sci_ports[0] after at earlycon exit Claudiu
2024-12-19 14:26   ` Geert Uytterhoeven
2024-12-21  9:39     ` Claudiu Beznea
2024-12-04 15:58 ` [PATCH RFT 6/6] serial: sh-sci: Increment the runtime usage counter for the earlycon device Claudiu
2024-12-19 14:30   ` Geert Uytterhoeven
2024-12-21  9:40     ` Claudiu Beznea
2025-01-02 17:57     ` Claudiu Beznea
2024-12-04 21:38 ` [PATCH RFT 0/6] serial: sh-sci: Fixes for earlycon and keep_bootcon Wolfram Sang
2024-12-05  8:39   ` Claudiu Beznea
2024-12-05  8:51     ` Claudiu Beznea
2024-12-19 15:11     ` Geert Uytterhoeven
2024-12-21  9:54       ` Claudiu Beznea [this message]
2025-01-03 11:48         ` Claudiu Beznea

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=c2b64230-f038-4da7-bc07-235072535ae1@tuxon.dev \
    --to=claudiu.beznea@tuxon.dev \
    --cc=claudiu.beznea.uj@bp.renesas.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=groeck@chromium.org \
    --cc=jirislaby@kernel.org \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=ulrich.hecht+renesas@gmail.com \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=ysato@users.sourceforge.jp \
    /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