[PATCH-for-5.0] hw/display/sm501: Always map the UART0

Philippe Mathieu-Daudé posted 1 patch 4 years, 5 months ago
Test asan passed
Test checkpatch passed
Test FreeBSD passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test docker-quick@centos7 passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20191122133623.13004-1-philmd@redhat.com
Maintainers: BALATON Zoltan <balaton@eik.bme.hu>
hw/display/sm501.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
[PATCH-for-5.0] hw/display/sm501: Always map the UART0
Posted by Philippe Mathieu-Daudé 4 years, 5 months ago
The SM501 is a Mobile Multimedia Companion Chip with 2 UARTs.
This model only implements the first UART. Being part of the
chipset, the UART block is always mapped in memory, regardless
we provide a chardev backend.

Since commit 12051d82f, qemu_chr_fe_init() accepts a NULL chardev.
Let's remove the chardev check and always map the UART in the
chipset memory.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/display/sm501.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 1f33c87e65..79bd7bc2d1 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -1958,11 +1958,9 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp)
     sysbus_pass_irq(sbd, SYS_BUS_DEVICE(usb_dev));
 
     /* bridge to serial emulation module */
-    if (s->chr_state) {
-        serial_mm_init(&s->state.mmio_region, SM501_UART0, 2,
-                       NULL, /* TODO : chain irq to IRL */
-                       115200, s->chr_state, DEVICE_LITTLE_ENDIAN);
-    }
+    serial_mm_init(&s->state.mmio_region, SM501_UART0, 2,
+                   NULL, /* TODO : chain irq to IRL */
+                   115200, s->chr_state, DEVICE_LITTLE_ENDIAN);
 }
 
 static Property sm501_sysbus_properties[] = {
-- 
2.21.0


Re: [PATCH-for-5.0] hw/display/sm501: Always map the UART0
Posted by Peter Maydell 4 years, 5 months ago
On Fri, 22 Nov 2019 at 13:36, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> The SM501 is a Mobile Multimedia Companion Chip with 2 UARTs.
> This model only implements the first UART. Being part of the
> chipset, the UART block is always mapped in memory, regardless

"regardless of whether we provide"

> we provide a chardev backend.
>
> Since commit 12051d82f, qemu_chr_fe_init() accepts a NULL chardev.
> Let's remove the chardev check and always map the UART in the
> chipset memory.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/display/sm501.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/hw/display/sm501.c b/hw/display/sm501.c
> index 1f33c87e65..79bd7bc2d1 100644
> --- a/hw/display/sm501.c
> +++ b/hw/display/sm501.c
> @@ -1958,11 +1958,9 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp)
>      sysbus_pass_irq(sbd, SYS_BUS_DEVICE(usb_dev));
>
>      /* bridge to serial emulation module */
> -    if (s->chr_state) {
> -        serial_mm_init(&s->state.mmio_region, SM501_UART0, 2,
> -                       NULL, /* TODO : chain irq to IRL */
> -                       115200, s->chr_state, DEVICE_LITTLE_ENDIAN);
> -    }
> +    serial_mm_init(&s->state.mmio_region, SM501_UART0, 2,
> +                   NULL, /* TODO : chain irq to IRL */
> +                   115200, s->chr_state, DEVICE_LITTLE_ENDIAN);
>  }
>
>  static Property sm501_sysbus_properties[] = {

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

This would be one way of resolving a comment I had on
a patch to this device in Marc-André's series...

thanks
-- PMM