Skip to contentSkip to conversation

pl011: early_panic if baud rate not set in hardware

PATCH In review Ian Campbell 3 participants 6 messages Aug 22, 2013 – Aug 27, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 xen/drivers/char/pl011.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
xen/drivers/char/pl011.c +2 -0
index 0e1eb64..7eb90b0 100644
@@ -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. */
Signature · 1 line
1.7.2.5
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Ian Campbell

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?

Quoted 2 lines

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?

Quoted 1 line
Quoted 18 lines
---
 xen/drivers/char/pl011.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
xen/drivers/char/pl011.c +2 -0
index 0e1eb64..7eb90b0 100644
@@ -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. */
Signature · 1 line
Julien Grall
#2 lore raw
Quoted 5 lines · Julien Grall
Quoted 2 lines · Ian Campbell

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.

Quoted 5 lines
Quoted 2 lines

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.

Quoted 23 lines
Quoted 2 lines
Quoted 18 lines
---
 xen/drivers/char/pl011.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
xen/drivers/char/pl011.c +2 -0
index 0e1eb64..7eb90b0 100644
@@ -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. */
#3 lore raw
Quoted 8 lines · Ian Campbell
Quoted 5 lines · Julien Grall
Quoted 2 lines · Ian Campbell

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.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

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.

Quoted 25 lines
Quoted 23 lines
Quoted 2 lines
Quoted 18 lines
---
 xen/drivers/char/pl011.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
xen/drivers/char/pl011.c +2 -0
index 0e1eb64..7eb90b0 100644
@@ -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. */
Signature · 1 line
Julien Grall
#4 lore raw
Quoted 11 lines · Julien Grall
Quoted 8 lines · Ian Campbell
Quoted 5 lines · Julien Grall
Quoted 2 lines · Ian Campbell

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

Quoted 48 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines

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.

Quoted 25 lines
Quoted 23 lines
Quoted 2 lines
Quoted 18 lines

---
xen/drivers/char/pl011.c | 2 ++

1 files changed, 2 insertions(+), 0 deletions(-)
xen/drivers/char/pl011.c +2 -0
index 0e1eb64..7eb90b0 100644
@@ -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. */
Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
author Applied
#5 lore raw
In reply to Julien Grall
Quoted 11 lines · Julien Grall
Quoted 2 lines · Ian Campbell

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?

Quoted 2 lines

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

Quoted 2 lines
Quoted 1 line

Applied, thanks.