All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] hw/arm/musicpal: Map the UART devices unconditionally
@ 2020-05-05  9:59 Philippe Mathieu-Daudé
  2020-05-05 10:09 ` Jan Kiszka
  2020-05-11 10:49 ` Peter Maydell
  0 siblings, 2 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-05  9:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-arm, Jan Kiszka, Philippe Mathieu-Daudé

I can't find proper documentation or datasheet, but it is likely
a MMIO mapped serial device mapped in the 0x80000000..0x8000ffff
range belongs to the SoC address space, thus is always mapped in
the memory bus.
Map the devices on the bus regardless a chardev is attached to it.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
from 2019... found while doing housekeeping
---
 hw/arm/musicpal.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index b2d0cfdac8..92f33ed87e 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -1619,14 +1619,10 @@ static void musicpal_init(MachineState *machine)
                           pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ],
                           pic[MP_TIMER4_IRQ], NULL);
 
-    if (serial_hd(0)) {
-        serial_mm_init(address_space_mem, MP_UART1_BASE, 2, pic[MP_UART1_IRQ],
-                       1825000, serial_hd(0), DEVICE_NATIVE_ENDIAN);
-    }
-    if (serial_hd(1)) {
-        serial_mm_init(address_space_mem, MP_UART2_BASE, 2, pic[MP_UART2_IRQ],
-                       1825000, serial_hd(1), DEVICE_NATIVE_ENDIAN);
-    }
+    serial_mm_init(address_space_mem, MP_UART1_BASE, 2, pic[MP_UART1_IRQ],
+                   1825000, serial_hd(0), DEVICE_NATIVE_ENDIAN);
+    serial_mm_init(address_space_mem, MP_UART2_BASE, 2, pic[MP_UART2_IRQ],
+                   1825000, serial_hd(1), DEVICE_NATIVE_ENDIAN);
 
     /* Register flash */
     dinfo = drive_get(IF_PFLASH, 0, 0);
-- 
2.21.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH] hw/arm/musicpal: Map the UART devices unconditionally
  2020-05-05  9:59 [RFC PATCH] hw/arm/musicpal: Map the UART devices unconditionally Philippe Mathieu-Daudé
@ 2020-05-05 10:09 ` Jan Kiszka
  2020-05-05 10:10   ` Peter Maydell
  2020-05-11 10:49 ` Peter Maydell
  1 sibling, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2020-05-05 10:09 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Peter Maydell, qemu-arm

On 05.05.20 11:59, Philippe Mathieu-Daudé wrote:
> I can't find proper documentation or datasheet, but it is likely
> a MMIO mapped serial device mapped in the 0x80000000..0x8000ffff
> range belongs to the SoC address space, thus is always mapped in
> the memory bus.
> Map the devices on the bus regardless a chardev is attached to it.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> from 2019... found while doing housekeeping
> ---
>   hw/arm/musicpal.c | 12 ++++--------
>   1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
> index b2d0cfdac8..92f33ed87e 100644
> --- a/hw/arm/musicpal.c
> +++ b/hw/arm/musicpal.c
> @@ -1619,14 +1619,10 @@ static void musicpal_init(MachineState *machine)
>                             pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ],
>                             pic[MP_TIMER4_IRQ], NULL);
>
> -    if (serial_hd(0)) {
> -        serial_mm_init(address_space_mem, MP_UART1_BASE, 2, pic[MP_UART1_IRQ],
> -                       1825000, serial_hd(0), DEVICE_NATIVE_ENDIAN);
> -    }
> -    if (serial_hd(1)) {
> -        serial_mm_init(address_space_mem, MP_UART2_BASE, 2, pic[MP_UART2_IRQ],
> -                       1825000, serial_hd(1), DEVICE_NATIVE_ENDIAN);
> -    }
> +    serial_mm_init(address_space_mem, MP_UART1_BASE, 2, pic[MP_UART1_IRQ],
> +                   1825000, serial_hd(0), DEVICE_NATIVE_ENDIAN);
> +    serial_mm_init(address_space_mem, MP_UART2_BASE, 2, pic[MP_UART2_IRQ],
> +                   1825000, serial_hd(1), DEVICE_NATIVE_ENDIAN);
>
>       /* Register flash */
>       dinfo = drive_get(IF_PFLASH, 0, 0);
>

I don't recall details anymore either (more than 10 year ago now...),
but this looks reasonable.

Reviewed-by: Jan Kiszka <jan.kiszka@web.de>

Jan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH] hw/arm/musicpal: Map the UART devices unconditionally
  2020-05-05 10:09 ` Jan Kiszka
@ 2020-05-05 10:10   ` Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2020-05-05 10:10 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: qemu-arm, Philippe Mathieu-Daudé, QEMU Developers

On Tue, 5 May 2020 at 11:09, Jan Kiszka <jan.kiszka@web.de> wrote:
>
> On 05.05.20 11:59, Philippe Mathieu-Daudé wrote:
> I don't recall details anymore either (more than 10 year ago now...),
> but this looks reasonable.

My guess is that it dates back to when the serial code would
crash if passed a NULL pointer for the backend rather than
treating it as "same as if connected to a /dev/null backend".

thanks
-- PMM


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC PATCH] hw/arm/musicpal: Map the UART devices unconditionally
  2020-05-05  9:59 [RFC PATCH] hw/arm/musicpal: Map the UART devices unconditionally Philippe Mathieu-Daudé
  2020-05-05 10:09 ` Jan Kiszka
@ 2020-05-11 10:49 ` Peter Maydell
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2020-05-11 10:49 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: qemu-arm, Jan Kiszka, QEMU Developers

On Tue, 5 May 2020 at 10:59, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> I can't find proper documentation or datasheet, but it is likely
> a MMIO mapped serial device mapped in the 0x80000000..0x8000ffff
> range belongs to the SoC address space, thus is always mapped in
> the memory bus.
> Map the devices on the bus regardless a chardev is attached to it.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> from 2019... found while doing housekeeping
> ---




Applied to target-arm.next, thanks.

-- PMM


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-11 10:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05  9:59 [RFC PATCH] hw/arm/musicpal: Map the UART devices unconditionally Philippe Mathieu-Daudé
2020-05-05 10:09 ` Jan Kiszka
2020-05-05 10:10   ` Peter Maydell
2020-05-11 10:49 ` Peter Maydell

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.