diff mbox series

[v2,1/2] hw/mips/mipssim: Use MMIO serial device on fake ISA I/O

Message ID 20200907011538.818996-2-philmd@redhat.com
State New
Headers show
Series hw/char: Remove TYPE_SERIAL_IO | expand

Commit Message

Philippe Mathieu-Daudé Sept. 7, 2020, 1:15 a.m. UTC
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 superset 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.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/mips/mipssim.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Paolo Bonzini Sept. 12, 2020, 8:07 a.m. UTC | #1
On 07/09/20 03:15, Philippe Mathieu-Daudé wrote:
> TYPE_SERIAL_IO is a superset of TYPE_SERIAL_MM, using
> regshift=0 and endianness=DEVICE_LITTLE_ENDIAN.

*subset*. :)

Queued the patch, thanks.


Paolo

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

Patch

diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c
index 1b3b7622035..5d4ad74828d 100644
--- a/hw/mips/mipssim.c
+++ b/hw/mips/mipssim.c
@@ -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,