Ian Campbell
2013-Aug-22 16:01 UTC
[PATCH] pl011: early_panic if baud rate not set in hardware
Now that the driver defaults to BAUD_AUTO this can happen if the early uart !console or if early printk isn''t in use. The following division by zero causes a trap but that uses regular printk and not early_printk, so it is never seen. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> --- xen/drivers/char/pl011.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c index 0e1eb64..7eb90b0 100644 --- a/xen/drivers/char/pl011.c +++ b/xen/drivers/char/pl011.c @@ -104,6 +104,8 @@ static void __init pl011_init_preirq(struct serial_port *port) { /* Baud rate already set: read it out from the divisor latch. */ divisor = (pl011_read(uart, IBRD) << 6) | (pl011_read(uart, FBRD)); + if (!divisor) + early_panic("pl011: No Baud rate configured\n"); uart->baud = (uart->clock_hz << 2) / divisor; } /* This write must follow FBRD and IBRD writes. */ -- 1.7.2.5
Julien Grall
2013-Aug-22 16:34 UTC
Re: [PATCH] pl011: early_panic if baud rate not set in hardware
On 08/22/2013 05:01 PM, Ian Campbell wrote:> Now that the driver defaults to BAUD_AUTO this can happen if the early uart !> console or if early printk isn''t in use.Does the fast model set correctly the baud rate?> The following division by zero causes a trap but that uses regular printk and > not early_printk, so it is never seen.That''s annoying. I often have this problem, is there any plan to support early print in printk?> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>Acked-by: Julien Grall <julien.grall@linaro.org>> --- > xen/drivers/char/pl011.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c > index 0e1eb64..7eb90b0 100644 > --- a/xen/drivers/char/pl011.c > +++ b/xen/drivers/char/pl011.c > @@ -104,6 +104,8 @@ static void __init pl011_init_preirq(struct serial_port *port) > { > /* Baud rate already set: read it out from the divisor latch. */ > divisor = (pl011_read(uart, IBRD) << 6) | (pl011_read(uart, FBRD)); > + if (!divisor) > + early_panic("pl011: No Baud rate configured\n"); > uart->baud = (uart->clock_hz << 2) / divisor; > } > /* This write must follow FBRD and IBRD writes. */ >-- Julien Grall
Ian Campbell
2013-Aug-22 18:49 UTC
Re: [PATCH] pl011: early_panic if baud rate not set in hardware
On Thu, 2013-08-22 at 17:34 +0100, Julien Grall wrote:> On 08/22/2013 05:01 PM, Ian Campbell wrote: > > Now that the driver defaults to BAUD_AUTO this can happen if the early uart !> > console or if early printk isn''t in use. > > Does the fast model set correctly the baud rate?No.> > The following division by zero causes a trap but that uses regular printk and > > not early_printk, so it is never seen. > > That''s annoying. I often have this problem, is there any plan to support > early print in printk?TBH I thought it was somewhere (far down) your todo list. Maybe I''ll have a poke at it tomorrow.> > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> > Acked-by: Julien Grall <julien.grall@linaro.org> > > --- > > xen/drivers/char/pl011.c | 2 ++ > > 1 files changed, 2 insertions(+), 0 deletions(-) > > > > diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c > > index 0e1eb64..7eb90b0 100644 > > --- a/xen/drivers/char/pl011.c > > +++ b/xen/drivers/char/pl011.c > > @@ -104,6 +104,8 @@ static void __init pl011_init_preirq(struct serial_port *port) > > { > > /* Baud rate already set: read it out from the divisor latch. */ > > divisor = (pl011_read(uart, IBRD) << 6) | (pl011_read(uart, FBRD)); > > + if (!divisor) > > + early_panic("pl011: No Baud rate configured\n"); > > uart->baud = (uart->clock_hz << 2) / divisor; > > } > > /* This write must follow FBRD and IBRD writes. */ > > > >
Julien Grall
2013-Aug-22 21:09 UTC
Re: [PATCH] pl011: early_panic if baud rate not set in hardware
On 22 August 2013 19:49, Ian Campbell <Ian.Campbell@citrix.com> wrote:> On Thu, 2013-08-22 at 17:34 +0100, Julien Grall wrote: >> On 08/22/2013 05:01 PM, Ian Campbell wrote: >> > Now that the driver defaults to BAUD_AUTO this can happen if the early uart !>> > console or if early printk isn''t in use. >> >> Does the fast model set correctly the baud rate? > > No.Ok. So we need U-boot to boot Xen on the fast model.> >> > The following division by zero causes a trap but that uses regular printk and >> > not early_printk, so it is never seen. >> >> That''s annoying. I often have this problem, is there any plan to support >> early print in printk? > > TBH I thought it was somewhere (far down) your todo list. Maybe I''ll > have a poke at it tomorrow.It''s not on my priority list :). I would be happy if someone work on this item.>> >> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> >> Acked-by: Julien Grall <julien.grall@linaro.org> >> > --- >> > xen/drivers/char/pl011.c | 2 ++ >> > 1 files changed, 2 insertions(+), 0 deletions(-) >> > >> > diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c >> > index 0e1eb64..7eb90b0 100644 >> > --- a/xen/drivers/char/pl011.c >> > +++ b/xen/drivers/char/pl011.c >> > @@ -104,6 +104,8 @@ static void __init pl011_init_preirq(struct serial_port *port) >> > { >> > /* Baud rate already set: read it out from the divisor latch. */ >> > divisor = (pl011_read(uart, IBRD) << 6) | (pl011_read(uart, FBRD)); >> > + if (!divisor) >> > + early_panic("pl011: No Baud rate configured\n"); >> > uart->baud = (uart->clock_hz << 2) / divisor; >> > } >> > /* This write must follow FBRD and IBRD writes. */ >> > >> >> > >-- Julien Grall
Chen Baozi
2013-Aug-23 00:41 UTC
Re: [PATCH] pl011: early_panic if baud rate not set in hardware
On Aug 23, 2013, at 5:09 AM, Julien Grall <julien.grall@linaro.org> wrote:> On 22 August 2013 19:49, Ian Campbell <Ian.Campbell@citrix.com> wrote: >> On Thu, 2013-08-22 at 17:34 +0100, Julien Grall wrote: >>> On 08/22/2013 05:01 PM, Ian Campbell wrote: >>>> Now that the driver defaults to BAUD_AUTO this can happen if the early uart !>>>> console or if early printk isn''t in use. >>> >>> Does the fast model set correctly the baud rate? >> >> No. > > Ok. So we need U-boot to boot Xen on the fast model.Some one posted a ARM64 support for fast model on u-boot recently. See: http://lists.denx.de/pipermail/u-boot/2013-August/161120.html Hope it would be helpful. Cheers, Baozi> >> >>>> The following division by zero causes a trap but that uses regular printk and >>>> not early_printk, so it is never seen. >>> >>> That''s annoying. I often have this problem, is there any plan to support >>> early print in printk? >> >> TBH I thought it was somewhere (far down) your todo list. Maybe I''ll >> have a poke at it tomorrow. > > It''s not on my priority list :). I would be happy if someone work on this item. > >>> >>>> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> >>> Acked-by: Julien Grall <julien.grall@linaro.org> >>>> --- >>>> xen/drivers/char/pl011.c | 2 ++ >>>> 1 files changed, 2 insertions(+), 0 deletions(-) >>>> >>>> diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c >>>> index 0e1eb64..7eb90b0 100644 >>>> --- a/xen/drivers/char/pl011.c >>>> +++ b/xen/drivers/char/pl011.c >>>> @@ -104,6 +104,8 @@ static void __init pl011_init_preirq(struct serial_port *port) >>>> { >>>> /* Baud rate already set: read it out from the divisor latch. */ >>>> divisor = (pl011_read(uart, IBRD) << 6) | (pl011_read(uart, FBRD)); >>>> + if (!divisor) >>>> + early_panic("pl011: No Baud rate configured\n"); >>>> uart->baud = (uart->clock_hz << 2) / divisor; >>>> } >>>> /* This write must follow FBRD and IBRD writes. */ >>>> >>> >>> >> >> > > > > -- > Julien Grall > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel
Ian Campbell
2013-Aug-27 13:46 UTC
Re: [PATCH] pl011: early_panic if baud rate not set in hardware
On Thu, 2013-08-22 at 17:34 +0100, Julien Grall wrote:> On 08/22/2013 05:01 PM, Ian Campbell wrote: > > Now that the driver defaults to BAUD_AUTO this can happen if the early uart !> > console or if early printk isn''t in use. > > Does the fast model set correctly the baud rate? > > > The following division by zero causes a trap but that uses regular printk and > > not early_printk, so it is never seen. > > That''s annoying. I often have this problem, is there any plan to support > early print in printk?I didn''t get to this like I thought I might last week> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> > Acked-by: Julien Grall <julien.grall@linaro.org>Applied, thanks.