Skip to contentSkip to conversation

hw/char: Remove TYPE_SERIAL_IO

PATCH New Philippe Mathieu-Daudé 2 participants 5 messages Sep 12, 2020

lore
Share & tools
lore
#0 lore raw

v3 cover hw/char: Remove TYPE_SERIAL_IO

Remove the TYPE_SERIAL_IO which is simply a superset of TYPE_SERIAL_MM, as suggested by Paolo and Peter here:
https://www.mail-archive.com/[email protected]/msg721806.html

All patches reviewed (patch #1 already queued in Paolo's misc tree).

Since v2:
- Rebased on "QOM boilerplate cleanup"

Since v1:
- Reword migration comment (Marc-André)

Philippe Mathieu-Daudé (2):
hw/mips/mipssim: Use MMIO serial device on fake ISA I/O hw/char/serial: Remove TYPE_SERIAL_IO (superset of TYPE_SERIAL_MM)

 hw/char/serial.c  | 41 -----------------------------------------
 hw/mips/mipssim.c |  5 +++--
 2 files changed, 3 insertions(+), 43 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH v3 1/2 hw/mips/mipssim: Use MMIO serial device on fake ISA I/O

From: Philippe Mathieu-Daudé <[email protected]>

The 'mipssim' is not a real hardware, it is a simulator.

There is an ISA MMIO space mapped at 0x1fd00000, however this is not a real ISA bus (no ISA IRQ). So can not use the TYPE_ISA_SERIAL device...
Instead we have been using a plain MMIO device, but named it IO.

TYPE_SERIAL_IO is a subset of TYPE_SERIAL_MM, using regshift=0 and endianness=DEVICE_LITTLE_ENDIAN.

Directly use the TYPE_SERIAL_MM device, enforcing the regshift/endianness values. 'regshift' default is already '0'. 'endianness' is meaningless for 8-bit accesses.

This change breaks migration back compatibility, but this is not an issue for the mipssim machine.

---
 hw/mips/mipssim.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/mips/mipssim.c +3 -2
index 1b3b7622035..5d4ad74828d 100644
@@ -216,10 +216,11 @@ mips_mipssim_init(MachineState *machine)
      * MIPS CPU INT2, which is interrupt 4.
      */
     if (serial_hd(0)) {
-        DeviceState *dev = qdev_new(TYPE_SERIAL_IO);
+        DeviceState *dev = qdev_new(TYPE_SERIAL_MM);
 
         qdev_prop_set_chr(dev, "chardev", serial_hd(0));
-        qdev_set_legacy_instance_id(dev, 0x3f8, 2);
+        qdev_prop_set_uint8(dev, "regshift", 0);
+        qdev_prop_set_uint8(dev, "endianness", DEVICE_LITTLE_ENDIAN);
         sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
         sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, env->irq[4]);
         sysbus_add_io(SYS_BUS_DEVICE(dev), 0x3f8,
Signature · 1 line
2.26.2
#2 lore raw

PATCH v3 2/2 hw/char/serial: Remove TYPE_SERIAL_IO (superset of TYPE_SERIAL_MM)

In reply to Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <[email protected]>

TYPE_SERIAL_IO is a superset of TYPE_SERIAL_MM, and it is not used anymore. Remove it.

---
 hw/char/serial.c | 41 -----------------------------------------
 1 file changed, 41 deletions(-)
hw/char/serial.c +0 -41
index 23864794929..fd80ae55929 100644
@@ -985,46 +985,6 @@ const MemoryRegionOps serial_io_ops = {
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
-static void serial_io_realize(DeviceState *dev, Error **errp)
-{
-    SerialIO *sio = SERIAL_IO(dev);
-    SerialState *s = &sio->serial;
-
-    if (!qdev_realize(DEVICE(s), NULL, errp)) {
-        return;
-    }
-
-    memory_region_init_io(&s->io, OBJECT(dev), &serial_io_ops, s, "serial", 8);
-    sysbus_init_mmio(SYS_BUS_DEVICE(sio), &s->io);
-    sysbus_init_irq(SYS_BUS_DEVICE(sio), &s->irq);
-}
-
-static void serial_io_class_init(ObjectClass *klass, void* data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-
-    dc->realize = serial_io_realize;
-    /* No dc->vmsd: class has no migratable state */
-}
-
-static void serial_io_instance_init(Object *o)
-{
-    SerialIO *sio = SERIAL_IO(o);
-
-    object_initialize_child(o, "serial", &sio->serial, TYPE_SERIAL);
-
-    qdev_alias_all_properties(DEVICE(&sio->serial), o);
-}
-
-
-static const TypeInfo serial_io_info = {
-    .name = TYPE_SERIAL_IO,
-    .parent = TYPE_SYS_BUS_DEVICE,
-    .instance_size = sizeof(SerialIO),
-    .instance_init = serial_io_instance_init,
-    .class_init = serial_io_class_init,
-};
-
 static Property serial_properties[] = {
     DEFINE_PROP_CHR("chardev", SerialState, chr),
     DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200),
@@ -1178,7 +1138,6 @@ static const TypeInfo serial_mm_info = {
 static void serial_register_types(void)
 {
     type_register_static(&serial_info);
-    type_register_static(&serial_io_info);
     type_register_static(&serial_mm_info);
 }
 
Signature · 1 line
2.26.2
#3 lore raw
In reply to Philippe Mathieu-Daudé
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series failed build test on FreeBSD host. Please find the details below.

The full log is available at
http://patchew.org/logs/[email protected]/testing.FreeBSD/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#4 lore raw
In reply to Philippe Mathieu-Daudé
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series failed the docker-quick@centos7 build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.

The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]