Skip to contentSkip to conversation

hw/display/sm501: Always map the UART0

PATCH-for-5.0 Philippe Mathieu-Daudé 2 participants 2 messages Nov 22, 2019

lore
Share & tools
lore
#0 lore raw

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.

---
 hw/display/sm501.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
hw/display/sm501.c +3 -5
index 1f33c87e65..79bd7bc2d1 100644
@@ -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[] = {
Signature · 1 line
2.21.0
Reviewed-by
#1 lore raw
Quoted 4 lines · Philippe Mathieu-Daudé

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"

Quoted 20 lines

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.

---
 hw/display/sm501.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
hw/display/sm501.c +0 -1
index 1f33c87e65..79bd7bc2d1 100644
@@ -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) {

hw/display/sm501.c static void sm501_realize_sysbus(DeviceState *dev, Error **errp) · line 1966

Quoted 10 lines
hw/display/sm501.c +3 -4
-        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[] = {

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

thanks
-- PMM