All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Andre Przywara <andre.przywara@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, Jaxson.Han@arm.com,
	robin.murphy@arm.com, vladimir.murzin@arm.com, Wei.Chen@arm.com
Subject: Re: [bootwrapper PATCH v2 08/13] Announce boot-wrapper mode / exception level
Date: Mon, 17 Jan 2022 15:50:21 +0000	[thread overview]
Message-ID: <20220117155021.GG87485@C02TD0UTHF1T.local> (raw)
In-Reply-To: <20220117143913.520a553c@donnerap.cambridge.arm.com>

On Mon, Jan 17, 2022 at 02:39:13PM +0000, Andre Przywara wrote:
> On Fri, 14 Jan 2022 10:56:48 +0000
> Mark Rutland <mark.rutland@arm.com> wrote:
> 
> Hi Mark,
> 
> > When something goes wrong within the boot-wrapper, it can be very
> > helpful to know where we started from. Add an arch_announce() function
> > to log this early in the boot process. More information can be added
> > here in future.
> > 
> > This is logged ot the serial console as:
> > 
> > | Boot-wrapper v0.2
> > | Entered at EL3
> 
> I like that one, and apart from the (already existing) UART issue below,
> this looks fine:
> 
> > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> 
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Thanks!

> > diff --git a/common/platform.c b/common/platform.c
> > index 47bf547..80d0562 100644
> > --- a/common/platform.c
> > +++ b/common/platform.c
> > @@ -31,21 +31,25 @@
> >  #define V2M_SYS(reg)	((void *)SYSREGS_BASE + V2M_SYS_##reg)
> >  #endif
> >  
> > -void print_string(const char *str)
> > +void print_char(char c)
> >  {
> >  	uint32_t flags;
> >  
> > -	while (*str) {
> > -		do
> > -			flags = raw_readl(PL011(UARTFR));
> > -		while (flags & PL011_UARTFR_FIFO_FULL);
> > +	do {
> > +		flags = raw_readl(PL011(UARTFR));
> > +	} while (flags & PL011_UARTFR_FIFO_FULL);
> > +
> > +	raw_writel(c, PL011(UARTDR));
> >  
> > -		raw_writel(*str++, PL011(UARTDR));
> > +	do {
> > +		flags = raw_readl(PL011(UARTFR));
> > +	} while (flags & PL011_UARTFR_BUSY);
> 
> Apologies if that appears to be nitpicking over a totally pointless issue
> (given the nature of the *emulated* PL011 in the model), but:
> 
> I understand that this code has not changed, but this loop basically
> renders the FIFOs ineffective. Is this intended? 

Hmm... AFAICT, we started to enable the FIFOs in commit:

  26a17ad59544f026 ("bootwrapper: improve UART initialisation")

... but back then the boot-wrapper didn't print anything to the UART, so
that was purely about putting the UART into a sane state for the OS.

We only started to write to the UART in commit:

  7ff3872adb33b068 ("Rewrite platform initialisation in C")

... where we said nothing about the FIFOs.

Therefore, I think there was no intent either way to use/avoid the
FIFOs within the boot-wrapper.

> I mean we explicitly enable the FIFOs in init_uart(), but then poll
> here until the transmit FIFO becomes empty, after *every* character
> pushed. I see that we probably want the output to be synchronous, for
> debug reasons, but I wonder if this should be achieved via an extra
> uart_flush() routine, once per line output? So call uart_flush() just
> in print_string(), but not in print_char(), for instance?

Hmm... we also use print_char() directly from the aarch64 init code when
logging the exception level, so we'd need an explicit sync there, if we
do want that output before other things can go wrong.

Otherwise, I don't have strong feelings either way, but I would like to
have the output completed before print_*() return. We could add an
internal print_char_nosync() that print_{char,string}() use to handle
that.

I'm happy to take a follow-up patch for that, but for now I'm going to
leave this as-is.

Thanks,
Mark.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-01-17 15:51 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-14 10:56 [bootwrapper PATCH v2 00/13] Cleanups and improvements Mark Rutland
2022-01-14 10:56 ` [bootwrapper PATCH v2 01/13] Document entry requirements Mark Rutland
2022-01-14 10:56 ` [bootwrapper PATCH v2 02/13] Add bit-field macros Mark Rutland
2022-01-17 12:11   ` Steven Price
2022-01-17 13:28     ` Mark Rutland
2022-01-14 10:56 ` [bootwrapper PATCH v2 03/13] aarch64: add system register accessors Mark Rutland
2022-01-14 15:32   ` Andre Przywara
2022-01-14 10:56 ` [bootwrapper PATCH v2 04/13] aarch32: add coprocessor accessors Mark Rutland
2022-01-14 10:56 ` [bootwrapper PATCH v2 05/13] aarch64: add mov_64 macro Mark Rutland
2022-01-14 15:50   ` Andre Przywara
2022-01-14 10:56 ` [bootwrapper PATCH v2 06/13] aarch64: initialize SCTLR_ELx for the boot-wrapper Mark Rutland
2022-01-14 18:12   ` Andre Przywara
2022-01-17 12:15     ` Mark Rutland
2022-01-17 13:05       ` Mark Rutland
2022-01-18 12:37         ` Andre Przywara
2022-01-25 13:32           ` Mark Rutland
2022-01-19 12:42       ` Mark Rutland
2022-01-14 10:56 ` [bootwrapper PATCH v2 07/13] Rework common init C code Mark Rutland
2022-01-17 16:23   ` Andre Przywara
2022-01-14 10:56 ` [bootwrapper PATCH v2 08/13] Announce boot-wrapper mode / exception level Mark Rutland
2022-01-17 14:39   ` Andre Przywara
2022-01-17 15:50     ` Mark Rutland [this message]
2022-01-14 10:56 ` [bootwrapper PATCH v2 09/13] aarch64: move the bulk of EL3 initialization to C Mark Rutland
2022-01-17 14:31   ` Andre Przywara
2022-01-17 18:08     ` Mark Rutland
2022-01-17 18:31       ` Andre Przywara
2022-01-18 16:50         ` Mark Brown
2022-01-19 15:22           ` Mark Rutland
2022-01-14 10:56 ` [bootwrapper PATCH v2 10/13] aarch32: move the bulk of Secure PL1 " Mark Rutland
2022-01-17 14:52   ` Andre Przywara
2022-01-14 10:56 ` [bootwrapper PATCH v2 11/13] Announce locations of memory objects Mark Rutland
2022-01-14 15:30   ` Andre Przywara
2022-01-14 16:04     ` Robin Murphy
2022-01-14 16:30       ` Mark Rutland
2022-01-14 16:21     ` Mark Rutland
2022-01-17 14:59   ` Andre Przywara
2022-01-14 10:56 ` [bootwrapper PATCH v2 12/13] Rework bootmethod initialization Mark Rutland
2022-01-17 17:43   ` Andre Przywara
2022-01-25 14:00     ` Mark Rutland
2022-01-14 10:56 ` [bootwrapper PATCH v2 13/13] Unify start_el3 & start_no_el3 Mark Rutland
2022-01-17 17:43   ` Andre Przywara
2022-01-14 15:09 ` [bootwrapper PATCH v2 00/13] Cleanups and improvements Andre Przywara
2022-01-14 15:23   ` Mark Rutland

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=20220117155021.GG87485@C02TD0UTHF1T.local \
    --to=mark.rutland@arm.com \
    --cc=Jaxson.Han@arm.com \
    --cc=Wei.Chen@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=robin.murphy@arm.com \
    --cc=vladimir.murzin@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.