All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/40] PS2 device QOMification - part 2
@ 2022-06-29 12:39 Mark Cave-Ayland
  2022-06-29 12:39 ` [PATCH 01/40] pl050: move PL050State from pl050.c to new pl050.h header file Mark Cave-Ayland
                   ` (40 more replies)
  0 siblings, 41 replies; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Here is the follow-on series from part 1 which completes the work to remove
the legacy global device init functions for PS2 devices. Now that part 1 has
been applied, the hard part to remove the PS2 function callback and argument
has been completed and all that remains is to improve the PS2 device
QOMification to allow the legacy PS2 functions to be removed.

Patches 1-11 update the pl050 device to remove the use of ps2_kbd_init() and
ps2_mouse_init(), whilst patches 12-34 make some more involved changes to
the lasips2 device (in particular completing the LASIPS2Port abstraction)
before doing the same.

Finally patches 35-40 complete the process for the pckbd (I8042 and I8042_MMIO
devices) before removing the now unused ps2_kbd_init(), ps2_mouse_init() and
i8042_mm_init() functions.

Note that this series is a migration break for the HPPA B160L and MIPS magnum
machines: I've had agreement from both Helge and Hervé that this is worth
doing to allow the use of the DeviceClass vmsd property to set the
VMStateDescription rather than manually calling vmstate_register().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


Mark Cave-Ayland (40):
  pl050: move PL050State from pl050.c to new pl050.h header file
  pl050: rename pl050_keyboard_init() to pl050_kbd_init()
  pl050: change PL050State dev pointer from void to PS2State
  pl050: introduce new PL050_KBD_DEVICE QOM type
  pl050: introduce new PL050_MOUSE_DEVICE QOM type
  pl050: move logic from pl050_realize() to pl050_init()
  pl050: introduce PL050DeviceClass for the PL050 device
  pl050: introduce pl050_kbd_class_init() and pl050_kbd_realize()
  pl050: introduce pl050_mouse_class_init() and pl050_mouse_realize()
  pl050: don't use legacy ps2_kbd_init() function
  pl050: don't use legacy ps2_mouse_init() function
  lasips2: don't use vmstate_register() in lasips2_realize()
  lasips2: remove the qdev base property and the lasips2_properties
    array
  lasips2: remove legacy lasips2_initfn() function
  lasips2: change LASIPS2State dev pointer from void to PS2State
  lasips2: QOMify LASIPS2Port
  lasips2: introduce new LASIPS2_KBD_PORT QOM type
  lasips2: introduce new LASIPS2_MOUSE_PORT QOM type
  lasips2: move keyboard port initialisation to new
    lasips2_kbd_port_init() function
  lasips2: move mouse port initialisation to new
    lasips2_mouse_port_init() function
  lasips2: introduce lasips2_kbd_port_class_init() and
    lasips2_kbd_port_realize()
  lasips2: introduce lasips2_mouse_port_class_init() and
    lasips2_mouse_port_realize()
  lasips2: rename LASIPS2Port irq field to birq
  lasips2: introduce port IRQ and new lasips2_port_init() function
  lasips2: introduce LASIPS2PortDeviceClass for the LASIPS2_PORT device
  lasips2: add named input gpio to port for downstream PS2 device IRQ
  lasips2: add named input gpio to handle incoming port IRQs
  lasips2: switch to using port-based IRQs
  lasips2: rename LASIPS2Port parent pointer to lasips2
  lasips2: standardise on lp name for LASIPS2Port variables
  lasips2: switch register memory region to DEVICE_BIG_ENDIAN
  lasips2: don't use legacy ps2_kbd_init() function
  lasips2: don't use legacy ps2_mouse_init() function
  lasips2: update VMStateDescription for LASIPS2 device
  pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the
    I8042_MMIO device
  pckbd: don't use legacy ps2_kbd_init() function
  ps2: remove unused legacy ps2_kbd_init() function
  pckbd: don't use legacy ps2_mouse_init() function
  ps2: remove unused legacy ps2_mouse_init() function
  pckbd: remove legacy i8042_mm_init() function

 hw/hppa/machine.c          |   7 +-
 hw/input/lasips2.c         | 320 ++++++++++++++++++++++++++-----------
 hw/input/pckbd.c           |  82 ++++++----
 hw/input/pl050.c           | 112 ++++++++-----
 hw/input/ps2.c             |  26 ---
 hw/input/trace-events      |   2 -
 hw/mips/jazz.c             |  13 +-
 include/hw/input/i8042.h   |   7 +-
 include/hw/input/lasips2.h |  57 +++++--
 include/hw/input/pl050.h   |  59 +++++++
 include/hw/input/ps2.h     |   2 -
 11 files changed, 466 insertions(+), 221 deletions(-)
 create mode 100644 include/hw/input/pl050.h

-- 
2.30.2



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

* [PATCH 01/40] pl050: move PL050State from pl050.c to new pl050.h header file
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
@ 2022-06-29 12:39 ` Mark Cave-Ayland
  2022-07-04 13:12   ` Peter Maydell
  2022-06-29 12:39 ` [PATCH 02/40] pl050: rename pl050_keyboard_init() to pl050_kbd_init() Mark Cave-Ayland
                   ` (39 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This allows the QOM types in pl050.c to be used elsewhere by simply including
pl050.h.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pl050.c         | 16 +---------------
 include/hw/input/pl050.h | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 15 deletions(-)
 create mode 100644 include/hw/input/pl050.h

diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index 209cc001cf..c7980b6ed7 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -19,26 +19,12 @@
 #include "hw/sysbus.h"
 #include "migration/vmstate.h"
 #include "hw/input/ps2.h"
+#include "hw/input/pl050.h"
 #include "hw/irq.h"
 #include "qemu/log.h"
 #include "qemu/module.h"
 #include "qom/object.h"
 
-#define TYPE_PL050 "pl050"
-OBJECT_DECLARE_SIMPLE_TYPE(PL050State, PL050)
-
-struct PL050State {
-    SysBusDevice parent_obj;
-
-    MemoryRegion iomem;
-    void *dev;
-    uint32_t cr;
-    uint32_t clk;
-    uint32_t last;
-    int pending;
-    qemu_irq irq;
-    bool is_mouse;
-};
 
 static const VMStateDescription vmstate_pl050 = {
     .name = "pl050",
diff --git a/include/hw/input/pl050.h b/include/hw/input/pl050.h
new file mode 100644
index 0000000000..2bbf7a9d50
--- /dev/null
+++ b/include/hw/input/pl050.h
@@ -0,0 +1,35 @@
+/*
+ * Arm PrimeCell PL050 Keyboard / Mouse Interface
+ *
+ * Copyright (c) 2006-2007 CodeSourcery.
+ * Written by Paul Brook
+ *
+ * This code is licensed under the GPL.
+ */
+
+#ifndef HW_PL050_H
+#define HW_PL050_H
+
+#include "qemu/osdep.h"
+#include "hw/sysbus.h"
+#include "migration/vmstate.h"
+#include "hw/input/ps2.h"
+#include "hw/irq.h"
+
+#define TYPE_PL050 "pl050"
+OBJECT_DECLARE_SIMPLE_TYPE(PL050State, PL050)
+
+struct PL050State {
+    SysBusDevice parent_obj;
+
+    MemoryRegion iomem;
+    void *dev;
+    uint32_t cr;
+    uint32_t clk;
+    uint32_t last;
+    int pending;
+    qemu_irq irq;
+    bool is_mouse;
+};
+
+#endif
-- 
2.30.2



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

* [PATCH 02/40] pl050: rename pl050_keyboard_init() to pl050_kbd_init()
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
  2022-06-29 12:39 ` [PATCH 01/40] pl050: move PL050State from pl050.c to new pl050.h header file Mark Cave-Ayland
@ 2022-06-29 12:39 ` Mark Cave-Ayland
  2022-07-04 13:12   ` Peter Maydell
  2022-06-29 12:39 ` [PATCH 03/40] pl050: change PL050State dev pointer from void to PS2State Mark Cave-Ayland
                   ` (38 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This is for consistency with all of the other devices that use the PS2 keyboard
device.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pl050.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index c7980b6ed7..8e32b8ed46 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -166,7 +166,7 @@ static void pl050_realize(DeviceState *dev, Error **errp)
                           qdev_get_gpio_in_named(dev, "ps2-input-irq", 0));
 }
 
-static void pl050_keyboard_init(Object *obj)
+static void pl050_kbd_init(Object *obj)
 {
     PL050State *s = PL050(obj);
 
@@ -183,7 +183,7 @@ static void pl050_mouse_init(Object *obj)
 static const TypeInfo pl050_kbd_info = {
     .name          = "pl050_keyboard",
     .parent        = TYPE_PL050,
-    .instance_init = pl050_keyboard_init,
+    .instance_init = pl050_kbd_init,
 };
 
 static const TypeInfo pl050_mouse_info = {
-- 
2.30.2



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

* [PATCH 03/40] pl050: change PL050State dev pointer from void to PS2State
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
  2022-06-29 12:39 ` [PATCH 01/40] pl050: move PL050State from pl050.c to new pl050.h header file Mark Cave-Ayland
  2022-06-29 12:39 ` [PATCH 02/40] pl050: rename pl050_keyboard_init() to pl050_kbd_init() Mark Cave-Ayland
@ 2022-06-29 12:39 ` Mark Cave-Ayland
  2022-07-04 13:14   ` Peter Maydell
  2022-06-29 12:39 ` [PATCH 04/40] pl050: introduce new PL050_KBD_DEVICE QOM type Mark Cave-Ayland
                   ` (37 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This allows the compiler to enforce that the PS2 device pointer is always of
type PS2State. Update the name of the pointer from dev to ps2dev to emphasise
this type change.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pl050.c         | 13 +++++++------
 include/hw/input/pl050.h |  2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index 8e32b8ed46..0d91b0eaea 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -101,7 +101,7 @@ static uint64_t pl050_read(void *opaque, hwaddr offset,
         }
     case 2: /* KMIDATA */
         if (s->pending) {
-            s->last = ps2_read_data(s->dev);
+            s->last = ps2_read_data(s->ps2dev);
         }
         return s->last;
     case 3: /* KMICLKDIV */
@@ -130,9 +130,9 @@ static void pl050_write(void *opaque, hwaddr offset,
         /* ??? This should toggle the TX interrupt line.  */
         /* ??? This means kbd/mouse can block each other.  */
         if (s->is_mouse) {
-            ps2_write_mouse(s->dev, value);
+            ps2_write_mouse(PS2_MOUSE_DEVICE(s->ps2dev), value);
         } else {
-            ps2_write_keyboard(s->dev, value);
+            ps2_write_keyboard(PS2_KBD_DEVICE(s->ps2dev), value);
         }
         break;
     case 3: /* KMICLKDIV */
@@ -158,11 +158,12 @@ static void pl050_realize(DeviceState *dev, Error **errp)
     sysbus_init_mmio(sbd, &s->iomem);
     sysbus_init_irq(sbd, &s->irq);
     if (s->is_mouse) {
-        s->dev = ps2_mouse_init();
+        s->ps2dev = ps2_mouse_init();
     } else {
-        s->dev = ps2_kbd_init();
+        s->ps2dev = ps2_kbd_init();
     }
-    qdev_connect_gpio_out(DEVICE(s->dev), PS2_DEVICE_IRQ,
+
+    qdev_connect_gpio_out(DEVICE(s->ps2dev), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-input-irq", 0));
 }
 
diff --git a/include/hw/input/pl050.h b/include/hw/input/pl050.h
index 2bbf7a9d50..c1f6c5a1fb 100644
--- a/include/hw/input/pl050.h
+++ b/include/hw/input/pl050.h
@@ -23,7 +23,7 @@ struct PL050State {
     SysBusDevice parent_obj;
 
     MemoryRegion iomem;
-    void *dev;
+    PS2State *ps2dev;
     uint32_t cr;
     uint32_t clk;
     uint32_t last;
-- 
2.30.2



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

* [PATCH 04/40] pl050: introduce new PL050_KBD_DEVICE QOM type
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (2 preceding siblings ...)
  2022-06-29 12:39 ` [PATCH 03/40] pl050: change PL050State dev pointer from void to PS2State Mark Cave-Ayland
@ 2022-06-29 12:39 ` Mark Cave-Ayland
  2022-07-04 13:15   ` Peter Maydell
  2022-06-29 12:39 ` [PATCH 05/40] pl050: introduce new PL050_MOUSE_DEVICE " Mark Cave-Ayland
                   ` (36 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This will be soon be used to hold the underlying PS2_KBD_DEVICE object.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pl050.c         | 3 ++-
 include/hw/input/pl050.h | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index 0d91b0eaea..7f4ac99081 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -182,9 +182,10 @@ static void pl050_mouse_init(Object *obj)
 }
 
 static const TypeInfo pl050_kbd_info = {
-    .name          = "pl050_keyboard",
+    .name          = TYPE_PL050_KBD_DEVICE,
     .parent        = TYPE_PL050,
     .instance_init = pl050_kbd_init,
+    .instance_size = sizeof(PL050KbdState),
 };
 
 static const TypeInfo pl050_mouse_info = {
diff --git a/include/hw/input/pl050.h b/include/hw/input/pl050.h
index c1f6c5a1fb..9ce8794bd0 100644
--- a/include/hw/input/pl050.h
+++ b/include/hw/input/pl050.h
@@ -32,4 +32,11 @@ struct PL050State {
     bool is_mouse;
 };
 
+#define TYPE_PL050_KBD_DEVICE "pl050_keyboard"
+OBJECT_DECLARE_SIMPLE_TYPE(PL050KbdState, PL050_KBD_DEVICE)
+
+struct PL050KbdState {
+    PL050State parent_obj;
+};
+
 #endif
-- 
2.30.2



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

* [PATCH 05/40] pl050: introduce new PL050_MOUSE_DEVICE QOM type
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (3 preceding siblings ...)
  2022-06-29 12:39 ` [PATCH 04/40] pl050: introduce new PL050_KBD_DEVICE QOM type Mark Cave-Ayland
@ 2022-06-29 12:39 ` Mark Cave-Ayland
  2022-07-04 13:15   ` Peter Maydell
  2022-06-29 12:39 ` [PATCH 06/40] pl050: move logic from pl050_realize() to pl050_init() Mark Cave-Ayland
                   ` (35 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This will be soon be used to hold the underlying PS2_MOUSE_DEVICE object.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pl050.c         | 3 ++-
 include/hw/input/pl050.h | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index 7f4ac99081..88459997e0 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -189,9 +189,10 @@ static const TypeInfo pl050_kbd_info = {
 };
 
 static const TypeInfo pl050_mouse_info = {
-    .name          = "pl050_mouse",
+    .name          = TYPE_PL050_MOUSE_DEVICE,
     .parent        = TYPE_PL050,
     .instance_init = pl050_mouse_init,
+    .instance_size = sizeof(PL050MouseState),
 };
 
 static void pl050_init(Object *obj)
diff --git a/include/hw/input/pl050.h b/include/hw/input/pl050.h
index 9ce8794bd0..bb0e87ff45 100644
--- a/include/hw/input/pl050.h
+++ b/include/hw/input/pl050.h
@@ -39,4 +39,11 @@ struct PL050KbdState {
     PL050State parent_obj;
 };
 
+#define TYPE_PL050_MOUSE_DEVICE "pl050_mouse"
+OBJECT_DECLARE_SIMPLE_TYPE(PL050MouseState, PL050_MOUSE_DEVICE)
+
+struct PL050MouseState {
+    PL050State parent_obj;
+};
+
 #endif
-- 
2.30.2



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

* [PATCH 06/40] pl050: move logic from pl050_realize() to pl050_init()
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (4 preceding siblings ...)
  2022-06-29 12:39 ` [PATCH 05/40] pl050: introduce new PL050_MOUSE_DEVICE " Mark Cave-Ayland
@ 2022-06-29 12:39 ` Mark Cave-Ayland
  2022-07-04 13:16   ` Peter Maydell
  2022-06-29 12:39 ` [PATCH 07/40] pl050: introduce PL050DeviceClass for the PL050 device Mark Cave-Ayland
                   ` (34 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

The logic for initialising the register memory region and the sysbus output IRQ
does not depend upon any device properties and so can be moved from
pl050_realize() to pl050_init().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pl050.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index 88459997e0..e32d86005a 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -152,11 +152,7 @@ static const MemoryRegionOps pl050_ops = {
 static void pl050_realize(DeviceState *dev, Error **errp)
 {
     PL050State *s = PL050(dev);
-    SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
 
-    memory_region_init_io(&s->iomem, OBJECT(s), &pl050_ops, s, "pl050", 0x1000);
-    sysbus_init_mmio(sbd, &s->iomem);
-    sysbus_init_irq(sbd, &s->irq);
     if (s->is_mouse) {
         s->ps2dev = ps2_mouse_init();
     } else {
@@ -197,6 +193,13 @@ static const TypeInfo pl050_mouse_info = {
 
 static void pl050_init(Object *obj)
 {
+    PL050State *s = PL050(obj);
+    SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
+
+    memory_region_init_io(&s->iomem, obj, &pl050_ops, s, "pl050", 0x1000);
+    sysbus_init_mmio(sbd, &s->iomem);
+    sysbus_init_irq(sbd, &s->irq);
+
     qdev_init_gpio_in_named(DEVICE(obj), pl050_set_irq, "ps2-input-irq", 1);
 }
 
-- 
2.30.2



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

* [PATCH 07/40] pl050: introduce PL050DeviceClass for the PL050 device
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (5 preceding siblings ...)
  2022-06-29 12:39 ` [PATCH 06/40] pl050: move logic from pl050_realize() to pl050_init() Mark Cave-Ayland
@ 2022-06-29 12:39 ` Mark Cave-Ayland
  2022-07-04 13:17   ` Peter Maydell
  2022-06-29 12:39 ` [PATCH 08/40] pl050: introduce pl050_kbd_class_init() and pl050_kbd_realize() Mark Cave-Ayland
                   ` (33 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This will soon be used to store the reference to the PL050 parent device
for PL050_KBD_DEVICE and PL050_MOUSE_DEVICE.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pl050.c         | 2 ++
 include/hw/input/pl050.h | 8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index e32d86005a..d7796b73a1 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -216,6 +216,8 @@ static const TypeInfo pl050_type_info = {
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_init = pl050_init,
     .instance_size = sizeof(PL050State),
+    .class_init    = pl050_class_init,
+    .class_size    = sizeof(PL050DeviceClass),
     .abstract      = true,
     .class_init    = pl050_class_init,
 };
diff --git a/include/hw/input/pl050.h b/include/hw/input/pl050.h
index bb0e87ff45..203f03a194 100644
--- a/include/hw/input/pl050.h
+++ b/include/hw/input/pl050.h
@@ -16,8 +16,14 @@
 #include "hw/input/ps2.h"
 #include "hw/irq.h"
 
+struct PL050DeviceClass {
+    SysBusDeviceClass parent_class;
+
+    DeviceRealize parent_realize;
+};
+
 #define TYPE_PL050 "pl050"
-OBJECT_DECLARE_SIMPLE_TYPE(PL050State, PL050)
+OBJECT_DECLARE_TYPE(PL050State, PL050DeviceClass, PL050)
 
 struct PL050State {
     SysBusDevice parent_obj;
-- 
2.30.2



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

* [PATCH 08/40] pl050: introduce pl050_kbd_class_init() and pl050_kbd_realize()
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (6 preceding siblings ...)
  2022-06-29 12:39 ` [PATCH 07/40] pl050: introduce PL050DeviceClass for the PL050 device Mark Cave-Ayland
@ 2022-06-29 12:39 ` Mark Cave-Ayland
  2022-07-04 13:17   ` Peter Maydell
  2022-06-29 12:39 ` [PATCH 09/40] pl050: introduce pl050_mouse_class_init() and pl050_mouse_realize() Mark Cave-Ayland
                   ` (32 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Introduce a new pl050_kbd_class_init() function containing a call to
device_class_set_parent_realize() which calls a new pl050_kbd_realize()
function to initialise the PS2 keyboard device.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pl050.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index d7796b73a1..24363c007e 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -155,14 +155,21 @@ static void pl050_realize(DeviceState *dev, Error **errp)
 
     if (s->is_mouse) {
         s->ps2dev = ps2_mouse_init();
-    } else {
-        s->ps2dev = ps2_kbd_init();
     }
 
     qdev_connect_gpio_out(DEVICE(s->ps2dev), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-input-irq", 0));
 }
 
+static void pl050_kbd_realize(DeviceState *dev, Error **errp)
+{
+    PL050DeviceClass *pdc = PL050_GET_CLASS(dev);
+    PL050State *ps = PL050(dev);
+
+    ps->ps2dev = ps2_kbd_init();
+    pdc->parent_realize(dev, errp);
+}
+
 static void pl050_kbd_init(Object *obj)
 {
     PL050State *s = PL050(obj);
@@ -177,11 +184,21 @@ static void pl050_mouse_init(Object *obj)
     s->is_mouse = true;
 }
 
+static void pl050_kbd_class_init(ObjectClass *oc, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(oc);
+    PL050DeviceClass *pdc = PL050_CLASS(oc);
+
+    device_class_set_parent_realize(dc, pl050_kbd_realize,
+                                    &pdc->parent_realize);
+}
+
 static const TypeInfo pl050_kbd_info = {
     .name          = TYPE_PL050_KBD_DEVICE,
     .parent        = TYPE_PL050,
     .instance_init = pl050_kbd_init,
     .instance_size = sizeof(PL050KbdState),
+    .class_init    = pl050_kbd_class_init,
 };
 
 static const TypeInfo pl050_mouse_info = {
-- 
2.30.2



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

* [PATCH 09/40] pl050: introduce pl050_mouse_class_init() and pl050_mouse_realize()
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (7 preceding siblings ...)
  2022-06-29 12:39 ` [PATCH 08/40] pl050: introduce pl050_kbd_class_init() and pl050_kbd_realize() Mark Cave-Ayland
@ 2022-06-29 12:39 ` Mark Cave-Ayland
  2022-07-04 13:18   ` Peter Maydell
  2022-06-29 12:39 ` [PATCH 10/40] pl050: don't use legacy ps2_kbd_init() function Mark Cave-Ayland
                   ` (31 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Introduce a new pl050_mouse_class_init() function containing a call to
device_class_set_parent_realize() which calls a new pl050_mouse_realize()
function to initialise the PS2 mouse device.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pl050.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index 24363c007e..fcc40758a3 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -153,10 +153,6 @@ static void pl050_realize(DeviceState *dev, Error **errp)
 {
     PL050State *s = PL050(dev);
 
-    if (s->is_mouse) {
-        s->ps2dev = ps2_mouse_init();
-    }
-
     qdev_connect_gpio_out(DEVICE(s->ps2dev), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-input-irq", 0));
 }
@@ -177,6 +173,15 @@ static void pl050_kbd_init(Object *obj)
     s->is_mouse = false;
 }
 
+static void pl050_mouse_realize(DeviceState *dev, Error **errp)
+{
+    PL050DeviceClass *pdc = PL050_GET_CLASS(dev);
+    PL050State *ps = PL050(dev);
+
+    ps->ps2dev = ps2_mouse_init();
+    pdc->parent_realize(dev, errp);
+}
+
 static void pl050_mouse_init(Object *obj)
 {
     PL050State *s = PL050(obj);
@@ -201,11 +206,21 @@ static const TypeInfo pl050_kbd_info = {
     .class_init    = pl050_kbd_class_init,
 };
 
+static void pl050_mouse_class_init(ObjectClass *oc, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(oc);
+    PL050DeviceClass *pdc = PL050_CLASS(oc);
+
+    device_class_set_parent_realize(dc, pl050_mouse_realize,
+                                    &pdc->parent_realize);
+}
+
 static const TypeInfo pl050_mouse_info = {
     .name          = TYPE_PL050_MOUSE_DEVICE,
     .parent        = TYPE_PL050,
     .instance_init = pl050_mouse_init,
     .instance_size = sizeof(PL050MouseState),
+    .class_init    = pl050_mouse_class_init,
 };
 
 static void pl050_init(Object *obj)
-- 
2.30.2



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

* [PATCH 10/40] pl050: don't use legacy ps2_kbd_init() function
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (8 preceding siblings ...)
  2022-06-29 12:39 ` [PATCH 09/40] pl050: introduce pl050_mouse_class_init() and pl050_mouse_realize() Mark Cave-Ayland
@ 2022-06-29 12:39 ` Mark Cave-Ayland
  2022-07-04 13:20   ` Peter Maydell
  2022-06-29 12:39 ` [PATCH 11/40] pl050: don't use legacy ps2_mouse_init() function Mark Cave-Ayland
                   ` (30 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Instantiate the PS2 keyboard device within PL050KbdState using
object_initialize_child() in pl050_kbd_init() and realize it in
pl050_kbd_realize() accordingly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pl050.c         | 13 ++++++++++---
 include/hw/input/pl050.h |  2 ++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index fcc40758a3..64b579e877 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -160,17 +160,24 @@ static void pl050_realize(DeviceState *dev, Error **errp)
 static void pl050_kbd_realize(DeviceState *dev, Error **errp)
 {
     PL050DeviceClass *pdc = PL050_GET_CLASS(dev);
+    PL050KbdState *s = PL050_KBD_DEVICE(dev);
     PL050State *ps = PL050(dev);
 
-    ps->ps2dev = ps2_kbd_init();
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->kbd), errp)) {
+        return;
+    }
+
+    ps->ps2dev = PS2_DEVICE(&s->kbd);
     pdc->parent_realize(dev, errp);
 }
 
 static void pl050_kbd_init(Object *obj)
 {
-    PL050State *s = PL050(obj);
+    PL050KbdState *s = PL050_KBD_DEVICE(obj);
+    PL050State *ps = PL050(obj);
 
-    s->is_mouse = false;
+    ps->is_mouse = false;
+    object_initialize_child(obj, "kbd", &s->kbd, TYPE_PS2_KBD_DEVICE);
 }
 
 static void pl050_mouse_realize(DeviceState *dev, Error **errp)
diff --git a/include/hw/input/pl050.h b/include/hw/input/pl050.h
index 203f03a194..28f6216dc3 100644
--- a/include/hw/input/pl050.h
+++ b/include/hw/input/pl050.h
@@ -43,6 +43,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(PL050KbdState, PL050_KBD_DEVICE)
 
 struct PL050KbdState {
     PL050State parent_obj;
+
+    PS2KbdState kbd;
 };
 
 #define TYPE_PL050_MOUSE_DEVICE "pl050_mouse"
-- 
2.30.2



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

* [PATCH 11/40] pl050: don't use legacy ps2_mouse_init() function
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (9 preceding siblings ...)
  2022-06-29 12:39 ` [PATCH 10/40] pl050: don't use legacy ps2_kbd_init() function Mark Cave-Ayland
@ 2022-06-29 12:39 ` Mark Cave-Ayland
  2022-07-04 13:20   ` Peter Maydell
  2022-06-29 12:39 ` [PATCH 12/40] lasips2: don't use vmstate_register() in lasips2_realize() Mark Cave-Ayland
                   ` (29 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Instantiate the PS2 mouse device within PL050MouseState using
object_initialize_child() in pl050_mouse_init() and realize it in
pl050_mouse_realize() accordingly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pl050.c         | 13 ++++++++++---
 include/hw/input/pl050.h |  2 ++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index 64b579e877..ec5e19285e 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -183,17 +183,24 @@ static void pl050_kbd_init(Object *obj)
 static void pl050_mouse_realize(DeviceState *dev, Error **errp)
 {
     PL050DeviceClass *pdc = PL050_GET_CLASS(dev);
+    PL050MouseState *s = PL050_MOUSE_DEVICE(dev);
     PL050State *ps = PL050(dev);
 
-    ps->ps2dev = ps2_mouse_init();
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->mouse), errp)) {
+        return;
+    }
+
+    ps->ps2dev = PS2_DEVICE(&s->mouse);
     pdc->parent_realize(dev, errp);
 }
 
 static void pl050_mouse_init(Object *obj)
 {
-    PL050State *s = PL050(obj);
+    PL050MouseState *s = PL050_MOUSE_DEVICE(obj);
+    PL050State *ps = PL050(obj);
 
-    s->is_mouse = true;
+    ps->is_mouse = true;
+    object_initialize_child(obj, "mouse", &s->mouse, TYPE_PS2_MOUSE_DEVICE);
 }
 
 static void pl050_kbd_class_init(ObjectClass *oc, void *data)
diff --git a/include/hw/input/pl050.h b/include/hw/input/pl050.h
index 28f6216dc3..89ec4fafc9 100644
--- a/include/hw/input/pl050.h
+++ b/include/hw/input/pl050.h
@@ -52,6 +52,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(PL050MouseState, PL050_MOUSE_DEVICE)
 
 struct PL050MouseState {
     PL050State parent_obj;
+
+    PS2MouseState mouse;
 };
 
 #endif
-- 
2.30.2



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

* [PATCH 12/40] lasips2: don't use vmstate_register() in lasips2_realize()
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (10 preceding siblings ...)
  2022-06-29 12:39 ` [PATCH 11/40] pl050: don't use legacy ps2_mouse_init() function Mark Cave-Ayland
@ 2022-06-29 12:39 ` Mark Cave-Ayland
  2022-07-04 13:20   ` Peter Maydell
  2022-06-29 12:39 ` [PATCH 13/40] lasips2: remove the qdev base property and the lasips2_properties array Mark Cave-Ayland
                   ` (28 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Since lasips2 is a qdev device then vmstate_ps2_mouse can be registered using
the DeviceClass vmsd field instead.

Note that due to the use of the base parameter in the original vmstate_register()
function call, this is actually a migration break for the HPPA B160L machine.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 9223cb0af4..d4fa248729 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -272,8 +272,6 @@ static void lasips2_realize(DeviceState *dev, Error **errp)
 {
     LASIPS2State *s = LASIPS2(dev);
 
-    vmstate_register(NULL, s->base, &vmstate_lasips2, s);
-
     s->kbd.dev = ps2_kbd_init();
     qdev_connect_gpio_out(DEVICE(s->kbd.dev), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
@@ -319,6 +317,7 @@ static void lasips2_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = lasips2_realize;
+    dc->vmsd = &vmstate_lasips2;
     device_class_set_props(dc, lasips2_properties);
     set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
 }
-- 
2.30.2



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

* [PATCH 13/40] lasips2: remove the qdev base property and the lasips2_properties array
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (11 preceding siblings ...)
  2022-06-29 12:39 ` [PATCH 12/40] lasips2: don't use vmstate_register() in lasips2_realize() Mark Cave-Ayland
@ 2022-06-29 12:39 ` Mark Cave-Ayland
  2022-07-04 13:21   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 14/40] lasips2: remove legacy lasips2_initfn() function Mark Cave-Ayland
                   ` (27 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:39 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

The base property was only needed for use by vmstate_register() in order to
preserve migration compatibility. Now that the lasips2 migration state is
registered through the DeviceClass vmsd field, the base property and also
the lasips2_properties array can be removed completely as they are no longer
required.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/hppa/machine.c          | 3 +--
 hw/input/lasips2.c         | 9 +--------
 include/hw/input/lasips2.h | 3 +--
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 44ecd446c3..6080037cf1 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -280,8 +280,7 @@ static void machine_hppa_init(MachineState *machine)
     }
 
     /* PS/2 Keyboard/Mouse */
-    dev = DEVICE(lasips2_initfn(LASI_PS2KBD_HPA,
-                                qdev_get_gpio_in(lasi_dev,
+    dev = DEVICE(lasips2_initfn(qdev_get_gpio_in(lasi_dev,
                                                  LASI_IRQ_PS2KBD_HPA)));
     memory_region_add_subregion(addr_space, LASI_PS2KBD_HPA,
                                 sysbus_mmio_get_region(SYS_BUS_DEVICE(dev),
diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index d4fa248729..40f77baf3e 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -255,12 +255,11 @@ static void lasips2_set_mouse_irq(void *opaque, int n, int level)
     lasips2_update_irq(port->parent);
 }
 
-LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq)
+LASIPS2State *lasips2_initfn(qemu_irq irq)
 {
     DeviceState *dev;
 
     dev = qdev_new(TYPE_LASIPS2);
-    qdev_prop_set_uint64(dev, "base", base);
     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
 
     sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);
@@ -307,18 +306,12 @@ static void lasips2_init(Object *obj)
                             "ps2-mouse-input-irq", 1);
 }
 
-static Property lasips2_properties[] = {
-    DEFINE_PROP_UINT64("base", LASIPS2State, base, UINT64_MAX),
-    DEFINE_PROP_END_OF_LIST(),
-};
-
 static void lasips2_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = lasips2_realize;
     dc->vmsd = &vmstate_lasips2;
-    device_class_set_props(dc, lasips2_properties);
     set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
 }
 
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 03f0c9e9f9..f051c970f0 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -39,7 +39,6 @@ typedef struct LASIPS2Port {
 struct LASIPS2State {
     SysBusDevice parent_obj;
 
-    hwaddr base;
     LASIPS2Port kbd;
     LASIPS2Port mouse;
     qemu_irq irq;
@@ -48,6 +47,6 @@ struct LASIPS2State {
 #define TYPE_LASIPS2 "lasips2"
 OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2)
 
-LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq);
+LASIPS2State *lasips2_initfn(qemu_irq irq);
 
 #endif /* HW_INPUT_LASIPS2_H */
-- 
2.30.2



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

* [PATCH 14/40] lasips2: remove legacy lasips2_initfn() function
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (12 preceding siblings ...)
  2022-06-29 12:39 ` [PATCH 13/40] lasips2: remove the qdev base property and the lasips2_properties array Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:22   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 15/40] lasips2: change LASIPS2State dev pointer from void to PS2State Mark Cave-Ayland
                   ` (26 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

There is only one user of the legacy lasips2_initfn() function which is in
machine_hppa_init(), so inline its functionality into machine_hppa_init() and
then remove it.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/hppa/machine.c          |  6 ++++--
 hw/input/lasips2.c         | 12 ------------
 include/hw/input/lasips2.h |  2 --
 3 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 6080037cf1..e53d5f0fa7 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -280,8 +280,10 @@ static void machine_hppa_init(MachineState *machine)
     }
 
     /* PS/2 Keyboard/Mouse */
-    dev = DEVICE(lasips2_initfn(qdev_get_gpio_in(lasi_dev,
-                                                 LASI_IRQ_PS2KBD_HPA)));
+    dev = qdev_new(TYPE_LASIPS2);
+    sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
+    sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
+                       qdev_get_gpio_in(lasi_dev, LASI_IRQ_PS2KBD_HPA));
     memory_region_add_subregion(addr_space, LASI_PS2KBD_HPA,
                                 sysbus_mmio_get_region(SYS_BUS_DEVICE(dev),
                                                        0));
diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 40f77baf3e..48237816a3 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -255,18 +255,6 @@ static void lasips2_set_mouse_irq(void *opaque, int n, int level)
     lasips2_update_irq(port->parent);
 }
 
-LASIPS2State *lasips2_initfn(qemu_irq irq)
-{
-    DeviceState *dev;
-
-    dev = qdev_new(TYPE_LASIPS2);
-    sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
-
-    sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);
-
-    return LASIPS2(dev);
-}
-
 static void lasips2_realize(DeviceState *dev, Error **errp)
 {
     LASIPS2State *s = LASIPS2(dev);
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index f051c970f0..868c5521d7 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -47,6 +47,4 @@ struct LASIPS2State {
 #define TYPE_LASIPS2 "lasips2"
 OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2)
 
-LASIPS2State *lasips2_initfn(qemu_irq irq);
-
 #endif /* HW_INPUT_LASIPS2_H */
-- 
2.30.2



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

* [PATCH 15/40] lasips2: change LASIPS2State dev pointer from void to PS2State
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (13 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 14/40] lasips2: remove legacy lasips2_initfn() function Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:22   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 16/40] lasips2: QOMify LASIPS2Port Mark Cave-Ayland
                   ` (25 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This allows the compiler to enforce that the PS2 device pointer is always of
type PS2State. Update the name of the pointer from dev to ps2dev to emphasise
this type change.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 16 ++++++++--------
 include/hw/input/lasips2.h |  3 ++-
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 48237816a3..b539c4de7a 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -146,9 +146,9 @@ static void lasips2_reg_write(void *opaque, hwaddr addr, uint64_t val,
         }
 
         if (port->id) {
-            ps2_write_mouse(port->dev, val);
+            ps2_write_mouse(PS2_MOUSE_DEVICE(port->ps2dev), val);
         } else {
-            ps2_write_keyboard(port->dev, val);
+            ps2_write_keyboard(PS2_KBD_DEVICE(port->ps2dev), val);
         }
         break;
 
@@ -181,7 +181,7 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size)
             break;
         }
 
-        ret = ps2_read_data(port->dev);
+        ret = ps2_read_data(port->ps2dev);
         break;
 
     case REG_PS2_CONTROL:
@@ -206,7 +206,7 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size)
                 ret |= LASIPS2_STATUS_RBNE;
             }
         } else {
-            if (!ps2_queue_empty(port->dev)) {
+            if (!ps2_queue_empty(port->ps2dev)) {
                 ret |= LASIPS2_STATUS_RBNE;
             }
         }
@@ -259,12 +259,12 @@ static void lasips2_realize(DeviceState *dev, Error **errp)
 {
     LASIPS2State *s = LASIPS2(dev);
 
-    s->kbd.dev = ps2_kbd_init();
-    qdev_connect_gpio_out(DEVICE(s->kbd.dev), PS2_DEVICE_IRQ,
+    s->kbd.ps2dev = ps2_kbd_init();
+    qdev_connect_gpio_out(DEVICE(s->kbd.ps2dev), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
                                                  0));
-    s->mouse.dev = ps2_mouse_init();
-    qdev_connect_gpio_out(DEVICE(s->mouse.dev), PS2_DEVICE_IRQ,
+    s->mouse.ps2dev = ps2_mouse_init();
+    qdev_connect_gpio_out(DEVICE(s->mouse.ps2dev), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq",
                                                  0));
 }
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 868c5521d7..9746b7a132 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -23,12 +23,13 @@
 
 #include "exec/hwaddr.h"
 #include "hw/sysbus.h"
+#include "hw/input/ps2.h"
 
 struct LASIPS2State;
 typedef struct LASIPS2Port {
     struct LASIPS2State *parent;
     MemoryRegion reg;
-    void *dev;
+    PS2State *ps2dev;
     uint8_t id;
     uint8_t control;
     uint8_t buf;
-- 
2.30.2



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

* [PATCH 16/40] lasips2: QOMify LASIPS2Port
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (14 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 15/40] lasips2: change LASIPS2State dev pointer from void to PS2State Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:23   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 17/40] lasips2: introduce new LASIPS2_KBD_PORT QOM type Mark Cave-Ayland
                   ` (24 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This becomes an abstract QOM type which will be a parent type for separate
keyboard and mouse port types.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         |  8 ++++++++
 include/hw/input/lasips2.h | 14 ++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index b539c4de7a..56bfd759af 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -311,9 +311,17 @@ static const TypeInfo lasips2_info = {
     .class_init    = lasips2_class_init,
 };
 
+static const TypeInfo lasips2_port_info = {
+    .name          = TYPE_LASIPS2_PORT,
+    .parent        = TYPE_DEVICE,
+    .instance_size = sizeof(LASIPS2Port),
+    .abstract      = true,
+};
+
 static void lasips2_register_types(void)
 {
     type_register_static(&lasips2_info);
+    type_register_static(&lasips2_port_info);
 }
 
 type_init(lasips2_register_types)
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 9746b7a132..f4514081fe 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -25,9 +25,15 @@
 #include "hw/sysbus.h"
 #include "hw/input/ps2.h"
 
-struct LASIPS2State;
-typedef struct LASIPS2Port {
-    struct LASIPS2State *parent;
+#define TYPE_LASIPS2_PORT "lasips2-port"
+OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2Port, LASIPS2_PORT)
+
+typedef struct LASIPS2State LASIPS2State;
+
+struct LASIPS2Port {
+    DeviceState parent_obj;
+
+    LASIPS2State *parent;
     MemoryRegion reg;
     PS2State *ps2dev;
     uint8_t id;
@@ -35,7 +41,7 @@ typedef struct LASIPS2Port {
     uint8_t buf;
     bool loopback_rbne;
     bool irq;
-} LASIPS2Port;
+};
 
 struct LASIPS2State {
     SysBusDevice parent_obj;
-- 
2.30.2



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

* [PATCH 17/40] lasips2: introduce new LASIPS2_KBD_PORT QOM type
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (15 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 16/40] lasips2: QOMify LASIPS2Port Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:22   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 18/40] lasips2: introduce new LASIPS2_MOUSE_PORT " Mark Cave-Ayland
                   ` (23 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This will be soon be used to hold the underlying PS2_KBD_DEVICE object.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 7 +++++++
 include/hw/input/lasips2.h | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 56bfd759af..b043f2e264 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -318,10 +318,17 @@ static const TypeInfo lasips2_port_info = {
     .abstract      = true,
 };
 
+static const TypeInfo lasips2_kbd_port_info = {
+    .name          = TYPE_LASIPS2_KBD_PORT,
+    .parent        = TYPE_LASIPS2_PORT,
+    .instance_size = sizeof(LASIPS2KbdPort),
+};
+
 static void lasips2_register_types(void)
 {
     type_register_static(&lasips2_info);
     type_register_static(&lasips2_port_info);
+    type_register_static(&lasips2_kbd_port_info);
 }
 
 type_init(lasips2_register_types)
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index f4514081fe..504e2c06de 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -43,6 +43,13 @@ struct LASIPS2Port {
     bool irq;
 };
 
+#define TYPE_LASIPS2_KBD_PORT "lasips2-kbd-port"
+OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2KbdPort, LASIPS2_KBD_PORT)
+
+struct LASIPS2KbdPort {
+    LASIPS2Port parent_obj;
+};
+
 struct LASIPS2State {
     SysBusDevice parent_obj;
 
-- 
2.30.2



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

* [PATCH 18/40] lasips2: introduce new LASIPS2_MOUSE_PORT QOM type
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (16 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 17/40] lasips2: introduce new LASIPS2_KBD_PORT QOM type Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:23   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 19/40] lasips2: move keyboard port initialisation to new lasips2_kbd_port_init() function Mark Cave-Ayland
                   ` (22 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This will be soon be used to hold the underlying PS2_MOUSE_DEVICE object.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 7 +++++++
 include/hw/input/lasips2.h | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index b043f2e264..f70cf893f6 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -324,11 +324,18 @@ static const TypeInfo lasips2_kbd_port_info = {
     .instance_size = sizeof(LASIPS2KbdPort),
 };
 
+static const TypeInfo lasips2_mouse_port_info = {
+    .name          = TYPE_LASIPS2_MOUSE_PORT,
+    .parent        = TYPE_LASIPS2_PORT,
+    .instance_size = sizeof(LASIPS2MousePort),
+};
+
 static void lasips2_register_types(void)
 {
     type_register_static(&lasips2_info);
     type_register_static(&lasips2_port_info);
     type_register_static(&lasips2_kbd_port_info);
+    type_register_static(&lasips2_mouse_port_info);
 }
 
 type_init(lasips2_register_types)
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 504e2c06de..aab6a3500c 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -50,6 +50,13 @@ struct LASIPS2KbdPort {
     LASIPS2Port parent_obj;
 };
 
+#define TYPE_LASIPS2_MOUSE_PORT "lasips2-mouse-port"
+OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2MousePort, LASIPS2_MOUSE_PORT)
+
+struct LASIPS2MousePort {
+    LASIPS2Port parent_obj;
+};
+
 struct LASIPS2State {
     SysBusDevice parent_obj;
 
-- 
2.30.2



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

* [PATCH 19/40] lasips2: move keyboard port initialisation to new lasips2_kbd_port_init() function
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (17 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 18/40] lasips2: introduce new LASIPS2_MOUSE_PORT " Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:24   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 20/40] lasips2: move mouse port initialisation to new lasips2_mouse_port_init() function Mark Cave-Ayland
                   ` (21 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Move the initialisation of the keyboard port from lasips2_init() to
a new lasips2_kbd_port_init() function which will be invoked using
object_initialize_child() during the LASIPS2 device init.

Update LASIPS2State so that it now holds the new LASIPS2KbdPort child object and
ensure that it is realised in lasips2_realize().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 47 ++++++++++++++++++++++++++------------
 include/hw/input/lasips2.h |  2 +-
 2 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index f70cf893f6..74427c9990 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -40,9 +40,9 @@ static const VMStateDescription vmstate_lasips2 = {
     .version_id = 0,
     .minimum_version_id = 0,
     .fields = (VMStateField[]) {
-        VMSTATE_UINT8(kbd.control, LASIPS2State),
-        VMSTATE_UINT8(kbd.id, LASIPS2State),
-        VMSTATE_BOOL(kbd.irq, LASIPS2State),
+        VMSTATE_UINT8(kbd_port.parent_obj.control, LASIPS2State),
+        VMSTATE_UINT8(kbd_port.parent_obj.id, LASIPS2State),
+        VMSTATE_BOOL(kbd_port.parent_obj.irq, LASIPS2State),
         VMSTATE_UINT8(mouse.control, LASIPS2State),
         VMSTATE_UINT8(mouse.id, LASIPS2State),
         VMSTATE_BOOL(mouse.irq, LASIPS2State),
@@ -119,8 +119,8 @@ static const char *lasips2_write_reg_name(uint64_t addr)
 
 static void lasips2_update_irq(LASIPS2State *s)
 {
-    trace_lasips2_intr(s->kbd.irq | s->mouse.irq);
-    qemu_set_irq(s->irq, s->kbd.irq | s->mouse.irq);
+    trace_lasips2_intr(s->kbd_port.parent_obj.irq | s->mouse.irq);
+    qemu_set_irq(s->irq, s->kbd_port.parent_obj.irq | s->mouse.irq);
 }
 
 static void lasips2_reg_write(void *opaque, hwaddr addr, uint64_t val,
@@ -211,7 +211,7 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size)
             }
         }
 
-        if (port->parent->kbd.irq || port->parent->mouse.irq) {
+        if (port->parent->kbd_port.parent_obj.irq || port->parent->mouse.irq) {
             ret |= LASIPS2_STATUS_CMPINTR;
         }
         break;
@@ -240,7 +240,7 @@ static const MemoryRegionOps lasips2_reg_ops = {
 static void lasips2_set_kbd_irq(void *opaque, int n, int level)
 {
     LASIPS2State *s = LASIPS2(opaque);
-    LASIPS2Port *port = &s->kbd;
+    LASIPS2Port *port = LASIPS2_PORT(&s->kbd_port);
 
     port->irq = level;
     lasips2_update_irq(port->parent);
@@ -258,9 +258,15 @@ static void lasips2_set_mouse_irq(void *opaque, int n, int level)
 static void lasips2_realize(DeviceState *dev, Error **errp)
 {
     LASIPS2State *s = LASIPS2(dev);
+    LASIPS2Port *lp;
 
-    s->kbd.ps2dev = ps2_kbd_init();
-    qdev_connect_gpio_out(DEVICE(s->kbd.ps2dev), PS2_DEVICE_IRQ,
+    lp = LASIPS2_PORT(&s->kbd_port);
+    if (!(qdev_realize(DEVICE(lp), NULL, errp))) {
+        return;
+    }
+
+    lp->ps2dev = ps2_kbd_init();
+    qdev_connect_gpio_out(DEVICE(lp->ps2dev), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
                                                  0));
     s->mouse.ps2dev = ps2_mouse_init();
@@ -272,18 +278,19 @@ static void lasips2_realize(DeviceState *dev, Error **errp)
 static void lasips2_init(Object *obj)
 {
     LASIPS2State *s = LASIPS2(obj);
+    LASIPS2Port *lp;
+
+    object_initialize_child(obj, "lasips2-kbd-port", &s->kbd_port,
+                            TYPE_LASIPS2_KBD_PORT);
 
-    s->kbd.id = 0;
     s->mouse.id = 1;
-    s->kbd.parent = s;
     s->mouse.parent = s;
 
-    memory_region_init_io(&s->kbd.reg, obj, &lasips2_reg_ops, &s->kbd,
-                          "lasips2-kbd", 0x100);
     memory_region_init_io(&s->mouse.reg, obj, &lasips2_reg_ops, &s->mouse,
                           "lasips2-mouse", 0x100);
 
-    sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->kbd.reg);
+    lp = LASIPS2_PORT(&s->kbd_port);
+    sysbus_init_mmio(SYS_BUS_DEVICE(obj), &lp->reg);
     sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg);
 
     sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
@@ -318,10 +325,22 @@ static const TypeInfo lasips2_port_info = {
     .abstract      = true,
 };
 
+static void lasips2_kbd_port_init(Object *obj)
+{
+    LASIPS2KbdPort *s = LASIPS2_KBD_PORT(obj);
+    LASIPS2Port *lp = LASIPS2_PORT(obj);
+
+    memory_region_init_io(&lp->reg, obj, &lasips2_reg_ops, lp, "lasips2-kbd",
+                          0x100);
+    lp->id = 0;
+    lp->parent = container_of(s, LASIPS2State, kbd_port);
+}
+
 static const TypeInfo lasips2_kbd_port_info = {
     .name          = TYPE_LASIPS2_KBD_PORT,
     .parent        = TYPE_LASIPS2_PORT,
     .instance_size = sizeof(LASIPS2KbdPort),
+    .instance_init = lasips2_kbd_port_init,
 };
 
 static const TypeInfo lasips2_mouse_port_info = {
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index aab6a3500c..f728f54c78 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -60,7 +60,7 @@ struct LASIPS2MousePort {
 struct LASIPS2State {
     SysBusDevice parent_obj;
 
-    LASIPS2Port kbd;
+    LASIPS2KbdPort kbd_port;
     LASIPS2Port mouse;
     qemu_irq irq;
 };
-- 
2.30.2



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

* [PATCH 20/40] lasips2: move mouse port initialisation to new lasips2_mouse_port_init() function
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (18 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 19/40] lasips2: move keyboard port initialisation to new lasips2_kbd_port_init() function Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:25   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 21/40] lasips2: introduce lasips2_kbd_port_class_init() and lasips2_kbd_port_realize() Mark Cave-Ayland
                   ` (20 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Move the initialisation of the mouse port from lasips2_init() to
a new lasips2_mouse_port_init() function which will be invoked using
object_initialize_child() during the LASIPS2 device init.

Update LASIPS2State so that it now holds the new LASIPS2MousePort child object and
ensure that it is realised in lasips2_realize().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 52 +++++++++++++++++++++++++-------------
 include/hw/input/lasips2.h |  2 +-
 2 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 74427c9990..9535cab268 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -43,9 +43,9 @@ static const VMStateDescription vmstate_lasips2 = {
         VMSTATE_UINT8(kbd_port.parent_obj.control, LASIPS2State),
         VMSTATE_UINT8(kbd_port.parent_obj.id, LASIPS2State),
         VMSTATE_BOOL(kbd_port.parent_obj.irq, LASIPS2State),
-        VMSTATE_UINT8(mouse.control, LASIPS2State),
-        VMSTATE_UINT8(mouse.id, LASIPS2State),
-        VMSTATE_BOOL(mouse.irq, LASIPS2State),
+        VMSTATE_UINT8(mouse_port.parent_obj.control, LASIPS2State),
+        VMSTATE_UINT8(mouse_port.parent_obj.id, LASIPS2State),
+        VMSTATE_BOOL(mouse_port.parent_obj.irq, LASIPS2State),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -119,8 +119,10 @@ static const char *lasips2_write_reg_name(uint64_t addr)
 
 static void lasips2_update_irq(LASIPS2State *s)
 {
-    trace_lasips2_intr(s->kbd_port.parent_obj.irq | s->mouse.irq);
-    qemu_set_irq(s->irq, s->kbd_port.parent_obj.irq | s->mouse.irq);
+    trace_lasips2_intr(s->kbd_port.parent_obj.irq |
+                       s->mouse_port.parent_obj.irq);
+    qemu_set_irq(s->irq, s->kbd_port.parent_obj.irq |
+                         s->mouse_port.parent_obj.irq);
 }
 
 static void lasips2_reg_write(void *opaque, hwaddr addr, uint64_t val,
@@ -211,8 +213,9 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size)
             }
         }
 
-        if (port->parent->kbd_port.parent_obj.irq || port->parent->mouse.irq) {
-            ret |= LASIPS2_STATUS_CMPINTR;
+        if (port->parent->kbd_port.parent_obj.irq ||
+            port->parent->mouse_port.parent_obj.irq) {
+                ret |= LASIPS2_STATUS_CMPINTR;
         }
         break;
 
@@ -249,7 +252,7 @@ static void lasips2_set_kbd_irq(void *opaque, int n, int level)
 static void lasips2_set_mouse_irq(void *opaque, int n, int level)
 {
     LASIPS2State *s = LASIPS2(opaque);
-    LASIPS2Port *port = &s->mouse;
+    LASIPS2Port *port = LASIPS2_PORT(&s->mouse_port);
 
     port->irq = level;
     lasips2_update_irq(port->parent);
@@ -269,8 +272,14 @@ static void lasips2_realize(DeviceState *dev, Error **errp)
     qdev_connect_gpio_out(DEVICE(lp->ps2dev), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
                                                  0));
-    s->mouse.ps2dev = ps2_mouse_init();
-    qdev_connect_gpio_out(DEVICE(s->mouse.ps2dev), PS2_DEVICE_IRQ,
+
+    lp = LASIPS2_PORT(&s->mouse_port);
+    if (!(qdev_realize(DEVICE(lp), NULL, errp))) {
+        return;
+    }
+
+    lp->ps2dev = ps2_mouse_init();
+    qdev_connect_gpio_out(DEVICE(lp->ps2dev), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq",
                                                  0));
 }
@@ -282,16 +291,13 @@ static void lasips2_init(Object *obj)
 
     object_initialize_child(obj, "lasips2-kbd-port", &s->kbd_port,
                             TYPE_LASIPS2_KBD_PORT);
-
-    s->mouse.id = 1;
-    s->mouse.parent = s;
-
-    memory_region_init_io(&s->mouse.reg, obj, &lasips2_reg_ops, &s->mouse,
-                          "lasips2-mouse", 0x100);
+    object_initialize_child(obj, "lasips2-mouse-port", &s->mouse_port,
+                            TYPE_LASIPS2_MOUSE_PORT);
 
     lp = LASIPS2_PORT(&s->kbd_port);
     sysbus_init_mmio(SYS_BUS_DEVICE(obj), &lp->reg);
-    sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg);
+    lp = LASIPS2_PORT(&s->mouse_port);
+    sysbus_init_mmio(SYS_BUS_DEVICE(obj), &lp->reg);
 
     sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
 
@@ -343,10 +349,22 @@ static const TypeInfo lasips2_kbd_port_info = {
     .instance_init = lasips2_kbd_port_init,
 };
 
+static void lasips2_mouse_port_init(Object *obj)
+{
+    LASIPS2MousePort *s = LASIPS2_MOUSE_PORT(obj);
+    LASIPS2Port *lp = LASIPS2_PORT(obj);
+
+    memory_region_init_io(&lp->reg, obj, &lasips2_reg_ops, lp, "lasips2-mouse",
+                          0x100);
+    lp->id = 1;
+    lp->parent = container_of(s, LASIPS2State, mouse_port);
+}
+
 static const TypeInfo lasips2_mouse_port_info = {
     .name          = TYPE_LASIPS2_MOUSE_PORT,
     .parent        = TYPE_LASIPS2_PORT,
     .instance_size = sizeof(LASIPS2MousePort),
+    .instance_init = lasips2_mouse_port_init,
 };
 
 static void lasips2_register_types(void)
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index f728f54c78..84807bec36 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -61,7 +61,7 @@ struct LASIPS2State {
     SysBusDevice parent_obj;
 
     LASIPS2KbdPort kbd_port;
-    LASIPS2Port mouse;
+    LASIPS2MousePort mouse_port;
     qemu_irq irq;
 };
 
-- 
2.30.2



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

* [PATCH 21/40] lasips2: introduce lasips2_kbd_port_class_init() and lasips2_kbd_port_realize()
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (19 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 20/40] lasips2: move mouse port initialisation to new lasips2_mouse_port_init() function Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:25   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 22/40] lasips2: introduce lasips2_mouse_port_class_init() and lasips2_mouse_port_realize() Mark Cave-Ayland
                   ` (19 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Introduce a new lasips2_kbd_port_class_init() function which uses a new
lasips2_kbd_port_realize() function to initialise the PS2 keyboard device.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 9535cab268..b4fdaed5cb 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -268,7 +268,6 @@ static void lasips2_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    lp->ps2dev = ps2_kbd_init();
     qdev_connect_gpio_out(DEVICE(lp->ps2dev), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
                                                  0));
@@ -331,6 +330,13 @@ static const TypeInfo lasips2_port_info = {
     .abstract      = true,
 };
 
+static void lasips2_kbd_port_realize(DeviceState *dev, Error **errp)
+{
+    LASIPS2Port *lp = LASIPS2_PORT(dev);
+
+    lp->ps2dev = ps2_kbd_init();
+}
+
 static void lasips2_kbd_port_init(Object *obj)
 {
     LASIPS2KbdPort *s = LASIPS2_KBD_PORT(obj);
@@ -342,11 +348,19 @@ static void lasips2_kbd_port_init(Object *obj)
     lp->parent = container_of(s, LASIPS2State, kbd_port);
 }
 
+static void lasips2_kbd_port_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->realize = lasips2_kbd_port_realize;
+}
+
 static const TypeInfo lasips2_kbd_port_info = {
     .name          = TYPE_LASIPS2_KBD_PORT,
     .parent        = TYPE_LASIPS2_PORT,
     .instance_size = sizeof(LASIPS2KbdPort),
     .instance_init = lasips2_kbd_port_init,
+    .class_init    = lasips2_kbd_port_class_init,
 };
 
 static void lasips2_mouse_port_init(Object *obj)
-- 
2.30.2



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

* [PATCH 22/40] lasips2: introduce lasips2_mouse_port_class_init() and lasips2_mouse_port_realize()
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (20 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 21/40] lasips2: introduce lasips2_kbd_port_class_init() and lasips2_kbd_port_realize() Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:25   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 23/40] lasips2: rename LASIPS2Port irq field to birq Mark Cave-Ayland
                   ` (18 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Introduce a new lasips2_mouse_port_class_init() function which uses a new
lasips2_mouse_port_realize() function to initialise the PS2 mouse device.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index b4fdaed5cb..ce87c66f2a 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -277,7 +277,6 @@ static void lasips2_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    lp->ps2dev = ps2_mouse_init();
     qdev_connect_gpio_out(DEVICE(lp->ps2dev), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq",
                                                  0));
@@ -363,6 +362,13 @@ static const TypeInfo lasips2_kbd_port_info = {
     .class_init    = lasips2_kbd_port_class_init,
 };
 
+static void lasips2_mouse_port_realize(DeviceState *dev, Error **errp)
+{
+    LASIPS2Port *lp = LASIPS2_PORT(dev);
+
+    lp->ps2dev = ps2_mouse_init();
+}
+
 static void lasips2_mouse_port_init(Object *obj)
 {
     LASIPS2MousePort *s = LASIPS2_MOUSE_PORT(obj);
@@ -374,11 +380,19 @@ static void lasips2_mouse_port_init(Object *obj)
     lp->parent = container_of(s, LASIPS2State, mouse_port);
 }
 
+static void lasips2_mouse_port_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->realize = lasips2_mouse_port_realize;
+}
+
 static const TypeInfo lasips2_mouse_port_info = {
     .name          = TYPE_LASIPS2_MOUSE_PORT,
     .parent        = TYPE_LASIPS2_PORT,
     .instance_size = sizeof(LASIPS2MousePort),
     .instance_init = lasips2_mouse_port_init,
+    .class_init    = lasips2_mouse_port_class_init,
 };
 
 static void lasips2_register_types(void)
-- 
2.30.2



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

* [PATCH 23/40] lasips2: rename LASIPS2Port irq field to birq
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (21 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 22/40] lasips2: introduce lasips2_mouse_port_class_init() and lasips2_mouse_port_realize() Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:25   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 24/40] lasips2: introduce port IRQ and new lasips2_port_init() function Mark Cave-Ayland
                   ` (17 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

The existing boolean irq field in LASIPS2Port will soon be replaced by a proper
qemu_irq, so rename the field to birq to allow the upcoming qemu_irq to use the
irq name.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 24 ++++++++++++------------
 include/hw/input/lasips2.h |  2 +-
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index ce87c66f2a..49e5c90b73 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -42,10 +42,10 @@ static const VMStateDescription vmstate_lasips2 = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT8(kbd_port.parent_obj.control, LASIPS2State),
         VMSTATE_UINT8(kbd_port.parent_obj.id, LASIPS2State),
-        VMSTATE_BOOL(kbd_port.parent_obj.irq, LASIPS2State),
+        VMSTATE_BOOL(kbd_port.parent_obj.birq, LASIPS2State),
         VMSTATE_UINT8(mouse_port.parent_obj.control, LASIPS2State),
         VMSTATE_UINT8(mouse_port.parent_obj.id, LASIPS2State),
-        VMSTATE_BOOL(mouse_port.parent_obj.irq, LASIPS2State),
+        VMSTATE_BOOL(mouse_port.parent_obj.birq, LASIPS2State),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -119,10 +119,10 @@ static const char *lasips2_write_reg_name(uint64_t addr)
 
 static void lasips2_update_irq(LASIPS2State *s)
 {
-    trace_lasips2_intr(s->kbd_port.parent_obj.irq |
-                       s->mouse_port.parent_obj.irq);
-    qemu_set_irq(s->irq, s->kbd_port.parent_obj.irq |
-                         s->mouse_port.parent_obj.irq);
+    trace_lasips2_intr(s->kbd_port.parent_obj.birq |
+                       s->mouse_port.parent_obj.birq);
+    qemu_set_irq(s->irq, s->kbd_port.parent_obj.birq |
+                         s->mouse_port.parent_obj.birq);
 }
 
 static void lasips2_reg_write(void *opaque, hwaddr addr, uint64_t val,
@@ -141,7 +141,7 @@ static void lasips2_reg_write(void *opaque, hwaddr addr, uint64_t val,
     case REG_PS2_XMTDATA:
         if (port->control & LASIPS2_CONTROL_LOOPBACK) {
             port->buf = val;
-            port->irq = true;
+            port->birq = true;
             port->loopback_rbne = true;
             lasips2_update_irq(port->parent);
             break;
@@ -176,7 +176,7 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size)
 
     case REG_PS2_RCVDATA:
         if (port->control & LASIPS2_CONTROL_LOOPBACK) {
-            port->irq = false;
+            port->birq = false;
             port->loopback_rbne = false;
             lasips2_update_irq(port->parent);
             ret = port->buf;
@@ -213,8 +213,8 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size)
             }
         }
 
-        if (port->parent->kbd_port.parent_obj.irq ||
-            port->parent->mouse_port.parent_obj.irq) {
+        if (port->parent->kbd_port.parent_obj.birq ||
+            port->parent->mouse_port.parent_obj.birq) {
                 ret |= LASIPS2_STATUS_CMPINTR;
         }
         break;
@@ -245,7 +245,7 @@ static void lasips2_set_kbd_irq(void *opaque, int n, int level)
     LASIPS2State *s = LASIPS2(opaque);
     LASIPS2Port *port = LASIPS2_PORT(&s->kbd_port);
 
-    port->irq = level;
+    port->birq = level;
     lasips2_update_irq(port->parent);
 }
 
@@ -254,7 +254,7 @@ static void lasips2_set_mouse_irq(void *opaque, int n, int level)
     LASIPS2State *s = LASIPS2(opaque);
     LASIPS2Port *port = LASIPS2_PORT(&s->mouse_port);
 
-    port->irq = level;
+    port->birq = level;
     lasips2_update_irq(port->parent);
 }
 
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 84807bec36..4c4b471737 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -40,7 +40,7 @@ struct LASIPS2Port {
     uint8_t control;
     uint8_t buf;
     bool loopback_rbne;
-    bool irq;
+    bool birq;
 };
 
 #define TYPE_LASIPS2_KBD_PORT "lasips2-kbd-port"
-- 
2.30.2



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

* [PATCH 24/40] lasips2: introduce port IRQ and new lasips2_port_init() function
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (22 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 23/40] lasips2: rename LASIPS2Port irq field to birq Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:26   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 25/40] lasips2: introduce LASIPS2PortDeviceClass for the LASIPS2_PORT device Mark Cave-Ayland
                   ` (16 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Introduce a new lasips2_port_init() QOM init function for the LASIPS2_PORT type
and use it to initialise a new gpio for use as a port IRQ. Add a new qemu_irq
representing the gpio as a new irq field within LASIPS2Port.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 8 ++++++++
 include/hw/input/lasips2.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 49e5c90b73..6b53153838 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -322,9 +322,17 @@ static const TypeInfo lasips2_info = {
     .class_init    = lasips2_class_init,
 };
 
+static void lasips2_port_init(Object *obj)
+{
+    LASIPS2Port *s = LASIPS2_PORT(obj);
+
+    qdev_init_gpio_out(DEVICE(obj), &s->irq, 1);
+}
+
 static const TypeInfo lasips2_port_info = {
     .name          = TYPE_LASIPS2_PORT,
     .parent        = TYPE_DEVICE,
+    .instance_init = lasips2_port_init,
     .instance_size = sizeof(LASIPS2Port),
     .abstract      = true,
 };
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 4c4b471737..a05f26cbd9 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -41,6 +41,7 @@ struct LASIPS2Port {
     uint8_t buf;
     bool loopback_rbne;
     bool birq;
+    qemu_irq irq;
 };
 
 #define TYPE_LASIPS2_KBD_PORT "lasips2-kbd-port"
-- 
2.30.2



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

* [PATCH 25/40] lasips2: introduce LASIPS2PortDeviceClass for the LASIPS2_PORT device
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (23 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 24/40] lasips2: introduce port IRQ and new lasips2_port_init() function Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:26   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 26/40] lasips2: add named input gpio to port for downstream PS2 device IRQ Mark Cave-Ayland
                   ` (15 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This will soon be used to store the reference to the LASIPS2_PORT parent device
for LASIPS2_KBD_PORT and LASIPS2_MOUSE_PORT.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 2 ++
 include/hw/input/lasips2.h | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 6b53153838..10494a2322 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -334,6 +334,8 @@ static const TypeInfo lasips2_port_info = {
     .parent        = TYPE_DEVICE,
     .instance_init = lasips2_port_init,
     .instance_size = sizeof(LASIPS2Port),
+    .class_init    = lasips2_port_class_init,
+    .class_size    = sizeof(LASIPS2PortDeviceClass),
     .abstract      = true,
 };
 
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index a05f26cbd9..426aa1371f 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -26,7 +26,11 @@
 #include "hw/input/ps2.h"
 
 #define TYPE_LASIPS2_PORT "lasips2-port"
-OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2Port, LASIPS2_PORT)
+OBJECT_DECLARE_TYPE(LASIPS2Port, LASIPS2PortDeviceClass, LASIPS2_PORT)
+
+struct LASIPS2PortDeviceClass {
+    DeviceClass parent;
+};
 
 typedef struct LASIPS2State LASIPS2State;
 
-- 
2.30.2



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

* [PATCH 26/40] lasips2: add named input gpio to port for downstream PS2 device IRQ
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (24 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 25/40] lasips2: introduce LASIPS2PortDeviceClass for the LASIPS2_PORT device Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:27   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 27/40] lasips2: add named input gpio to handle incoming port IRQs Mark Cave-Ayland
                   ` (14 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

The named input gpio is to be connected to the IRQ output of the downstream
PS2 device and used to drive the port IRQ. Initialise the named input gpio
in lasips2_port_init() and add new lasips2_port_class_init() and
lasips2_port_realize() functions to connect the PS2 device output gpio to
the new named input gpio.

Note that the reference to lasips2_port_realize() is stored in
LASIPS2PortDeviceClass but not yet used.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 32 ++++++++++++++++++++++++++++++--
 include/hw/input/lasips2.h |  2 ++
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 10494a2322..ec1661a8f1 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -322,11 +322,35 @@ static const TypeInfo lasips2_info = {
     .class_init    = lasips2_class_init,
 };
 
+static void lasips2_port_set_irq(void *opaque, int n, int level)
+{
+    LASIPS2Port *s = LASIPS2_PORT(opaque);
+
+    qemu_set_irq(s->irq, level);
+}
+
+static void lasips2_port_realize(DeviceState *dev, Error **errp)
+{
+    LASIPS2Port *s = LASIPS2_PORT(dev);
+
+    qdev_connect_gpio_out(DEVICE(s->ps2dev), PS2_DEVICE_IRQ,
+                          qdev_get_gpio_in_named(dev, "ps2-input-irq", 0));
+}
+
 static void lasips2_port_init(Object *obj)
 {
     LASIPS2Port *s = LASIPS2_PORT(obj);
 
     qdev_init_gpio_out(DEVICE(obj), &s->irq, 1);
+    qdev_init_gpio_in_named(DEVICE(obj), lasips2_port_set_irq,
+                            "ps2-input-irq", 1);
+}
+
+static void lasips2_port_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->realize = lasips2_port_realize;
 }
 
 static const TypeInfo lasips2_port_info = {
@@ -360,8 +384,10 @@ static void lasips2_kbd_port_init(Object *obj)
 static void lasips2_kbd_port_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    LASIPS2PortDeviceClass *lpdc = LASIPS2_PORT_CLASS(klass);
 
-    dc->realize = lasips2_kbd_port_realize;
+    device_class_set_parent_realize(dc, lasips2_kbd_port_realize,
+                                    &lpdc->parent_realize);
 }
 
 static const TypeInfo lasips2_kbd_port_info = {
@@ -393,8 +419,10 @@ static void lasips2_mouse_port_init(Object *obj)
 static void lasips2_mouse_port_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    LASIPS2PortDeviceClass *lpdc = LASIPS2_PORT_CLASS(klass);
 
-    dc->realize = lasips2_mouse_port_realize;
+    device_class_set_parent_realize(dc, lasips2_mouse_port_realize,
+                                    &lpdc->parent_realize);
 }
 
 static const TypeInfo lasips2_mouse_port_info = {
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 426aa1371f..35e0aa26eb 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -30,6 +30,8 @@ OBJECT_DECLARE_TYPE(LASIPS2Port, LASIPS2PortDeviceClass, LASIPS2_PORT)
 
 struct LASIPS2PortDeviceClass {
     DeviceClass parent;
+
+    DeviceRealize parent_realize;
 };
 
 typedef struct LASIPS2State LASIPS2State;
-- 
2.30.2



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

* [PATCH 27/40] lasips2: add named input gpio to handle incoming port IRQs
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (25 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 26/40] lasips2: add named input gpio to port for downstream PS2 device IRQ Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:27   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 28/40] lasips2: switch to using port-based IRQs Mark Cave-Ayland
                   ` (13 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

The LASIPS2 device named input gpio is soon to be connected to the port output
IRQs. Add a new int_status field to LASIPS2State which is a bitmap representing
the port input IRQ status.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 15 +++++++++++++++
 include/hw/input/lasips2.h |  1 +
 2 files changed, 16 insertions(+)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index ec1661a8f1..013d891af6 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -125,6 +125,19 @@ static void lasips2_update_irq(LASIPS2State *s)
                          s->mouse_port.parent_obj.birq);
 }
 
+static void lasips2_set_irq(void *opaque, int n, int level)
+{
+    LASIPS2State *s = LASIPS2(opaque);
+
+    if (level) {
+        s->int_status |= BIT(n);
+    } else {
+        s->int_status &= ~BIT(n);
+    }
+
+    lasips2_update_irq(s);
+}
+
 static void lasips2_reg_write(void *opaque, hwaddr addr, uint64_t val,
                               unsigned size)
 {
@@ -303,6 +316,8 @@ static void lasips2_init(Object *obj)
                             "ps2-kbd-input-irq", 1);
     qdev_init_gpio_in_named(DEVICE(obj), lasips2_set_mouse_irq,
                             "ps2-mouse-input-irq", 1);
+    qdev_init_gpio_in_named(DEVICE(obj), lasips2_set_irq,
+                            "lasips2-port-input-irq", 2);
 }
 
 static void lasips2_class_init(ObjectClass *klass, void *data)
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 35e0aa26eb..b79febf64b 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -69,6 +69,7 @@ struct LASIPS2State {
 
     LASIPS2KbdPort kbd_port;
     LASIPS2MousePort mouse_port;
+    uint8_t int_status;
     qemu_irq irq;
 };
 
-- 
2.30.2



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

* [PATCH 28/40] lasips2: switch to using port-based IRQs
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (26 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 27/40] lasips2: add named input gpio to handle incoming port IRQs Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:28   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 29/40] lasips2: rename LASIPS2Port parent pointer to lasips2 Mark Cave-Ayland
                   ` (12 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Now we can implement port-based IRQs by wiring the PS2 device IRQs to the
LASI2Port named input gpios rather than directly to the LASIPS2 device, and
generate the LASIPS2 output IRQ from the int_status bitmap representing the
individual port IRQs instead of the birq boolean.

This enables us to remove the separate PS2 keyboard and PS2 mouse named input
gpios from the LASIPS2 device and simplify the register implementation to
drive the port IRQ using qemu_set_irq() rather than accessing the LASIPS2
device IRQs directly. As a consequence the IRQ level logic in lasips2_set_irq()
can also be simplified accordingly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 59 ++++++++++++--------------------------
 include/hw/input/lasips2.h |  7 ++---
 2 files changed, 20 insertions(+), 46 deletions(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 013d891af6..5ceb38c1af 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -42,10 +42,8 @@ static const VMStateDescription vmstate_lasips2 = {
     .fields = (VMStateField[]) {
         VMSTATE_UINT8(kbd_port.parent_obj.control, LASIPS2State),
         VMSTATE_UINT8(kbd_port.parent_obj.id, LASIPS2State),
-        VMSTATE_BOOL(kbd_port.parent_obj.birq, LASIPS2State),
         VMSTATE_UINT8(mouse_port.parent_obj.control, LASIPS2State),
         VMSTATE_UINT8(mouse_port.parent_obj.id, LASIPS2State),
-        VMSTATE_BOOL(mouse_port.parent_obj.birq, LASIPS2State),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -119,10 +117,10 @@ static const char *lasips2_write_reg_name(uint64_t addr)
 
 static void lasips2_update_irq(LASIPS2State *s)
 {
-    trace_lasips2_intr(s->kbd_port.parent_obj.birq |
-                       s->mouse_port.parent_obj.birq);
-    qemu_set_irq(s->irq, s->kbd_port.parent_obj.birq |
-                         s->mouse_port.parent_obj.birq);
+    int level = s->int_status ? 1 : 0;
+
+    trace_lasips2_intr(level);
+    qemu_set_irq(s->irq, level);
 }
 
 static void lasips2_set_irq(void *opaque, int n, int level)
@@ -154,9 +152,8 @@ static void lasips2_reg_write(void *opaque, hwaddr addr, uint64_t val,
     case REG_PS2_XMTDATA:
         if (port->control & LASIPS2_CONTROL_LOOPBACK) {
             port->buf = val;
-            port->birq = true;
             port->loopback_rbne = true;
-            lasips2_update_irq(port->parent);
+            qemu_set_irq(port->irq, 1);
             break;
         }
 
@@ -189,9 +186,8 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size)
 
     case REG_PS2_RCVDATA:
         if (port->control & LASIPS2_CONTROL_LOOPBACK) {
-            port->birq = false;
             port->loopback_rbne = false;
-            lasips2_update_irq(port->parent);
+            qemu_set_irq(port->irq, 0);
             ret = port->buf;
             break;
         }
@@ -226,9 +222,8 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size)
             }
         }
 
-        if (port->parent->kbd_port.parent_obj.birq ||
-            port->parent->mouse_port.parent_obj.birq) {
-                ret |= LASIPS2_STATUS_CMPINTR;
+        if (port->parent->int_status) {
+            ret |= LASIPS2_STATUS_CMPINTR;
         }
         break;
 
@@ -253,24 +248,6 @@ static const MemoryRegionOps lasips2_reg_ops = {
     .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
-static void lasips2_set_kbd_irq(void *opaque, int n, int level)
-{
-    LASIPS2State *s = LASIPS2(opaque);
-    LASIPS2Port *port = LASIPS2_PORT(&s->kbd_port);
-
-    port->birq = level;
-    lasips2_update_irq(port->parent);
-}
-
-static void lasips2_set_mouse_irq(void *opaque, int n, int level)
-{
-    LASIPS2State *s = LASIPS2(opaque);
-    LASIPS2Port *port = LASIPS2_PORT(&s->mouse_port);
-
-    port->birq = level;
-    lasips2_update_irq(port->parent);
-}
-
 static void lasips2_realize(DeviceState *dev, Error **errp)
 {
     LASIPS2State *s = LASIPS2(dev);
@@ -281,18 +258,18 @@ static void lasips2_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    qdev_connect_gpio_out(DEVICE(lp->ps2dev), PS2_DEVICE_IRQ,
-                          qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
-                                                 0));
+    qdev_connect_gpio_out(DEVICE(lp), 0,
+                          qdev_get_gpio_in_named(dev, "lasips2-port-input-irq",
+                                                 lp->id));
 
     lp = LASIPS2_PORT(&s->mouse_port);
     if (!(qdev_realize(DEVICE(lp), NULL, errp))) {
         return;
     }
 
-    qdev_connect_gpio_out(DEVICE(lp->ps2dev), PS2_DEVICE_IRQ,
-                          qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq",
-                                                 0));
+    qdev_connect_gpio_out(DEVICE(lp), 0,
+                          qdev_get_gpio_in_named(dev, "lasips2-port-input-irq",
+                                                 lp->id));
 }
 
 static void lasips2_init(Object *obj)
@@ -312,10 +289,6 @@ static void lasips2_init(Object *obj)
 
     sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
 
-    qdev_init_gpio_in_named(DEVICE(obj), lasips2_set_kbd_irq,
-                            "ps2-kbd-input-irq", 1);
-    qdev_init_gpio_in_named(DEVICE(obj), lasips2_set_mouse_irq,
-                            "ps2-mouse-input-irq", 1);
     qdev_init_gpio_in_named(DEVICE(obj), lasips2_set_irq,
                             "lasips2-port-input-irq", 2);
 }
@@ -381,8 +354,10 @@ static const TypeInfo lasips2_port_info = {
 static void lasips2_kbd_port_realize(DeviceState *dev, Error **errp)
 {
     LASIPS2Port *lp = LASIPS2_PORT(dev);
+    LASIPS2PortDeviceClass *lpdc = LASIPS2_PORT_GET_CLASS(lp);
 
     lp->ps2dev = ps2_kbd_init();
+    lpdc->parent_realize(dev, errp);
 }
 
 static void lasips2_kbd_port_init(Object *obj)
@@ -416,8 +391,10 @@ static const TypeInfo lasips2_kbd_port_info = {
 static void lasips2_mouse_port_realize(DeviceState *dev, Error **errp)
 {
     LASIPS2Port *lp = LASIPS2_PORT(dev);
+    LASIPS2PortDeviceClass *lpdc = LASIPS2_PORT_GET_CLASS(lp);
 
     lp->ps2dev = ps2_mouse_init();
+    lpdc->parent_realize(dev, errp);
 }
 
 static void lasips2_mouse_port_init(Object *obj)
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index b79febf64b..7199f16622 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -12,10 +12,8 @@
  * + sysbus MMIO region 1: MemoryRegion defining the LASI PS2 mouse
  *   registers
  * + sysbus IRQ 0: LASI PS2 output irq
- * + Named GPIO input "ps2-kbd-input-irq": set to 1 if the downstream PS2
- *   keyboard device has asserted its irq
- * + Named GPIO input "ps2-mouse-input-irq": set to 1 if the downstream PS2
- *   mouse device has asserted its irq
+ * + Named GPIO input "lasips2-port-input-irq[0..1]": set to 1 if the downstream
+ *   LASIPS2Port has asserted its irq
  */
 
 #ifndef HW_INPUT_LASIPS2_H
@@ -46,7 +44,6 @@ struct LASIPS2Port {
     uint8_t control;
     uint8_t buf;
     bool loopback_rbne;
-    bool birq;
     qemu_irq irq;
 };
 
-- 
2.30.2



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

* [PATCH 29/40] lasips2: rename LASIPS2Port parent pointer to lasips2
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (27 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 28/40] lasips2: switch to using port-based IRQs Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:28   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 30/40] lasips2: standardise on lp name for LASIPS2Port variables Mark Cave-Ayland
                   ` (11 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This makes it clearer that the pointer is a reference to the LASIPS2 container
device rather than an implied part of the QOM hierarchy.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 6 +++---
 include/hw/input/lasips2.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 5ceb38c1af..0f392e2bee 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -222,7 +222,7 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size)
             }
         }
 
-        if (port->parent->int_status) {
+        if (port->lasips2->int_status) {
             ret |= LASIPS2_STATUS_CMPINTR;
         }
         break;
@@ -368,7 +368,7 @@ static void lasips2_kbd_port_init(Object *obj)
     memory_region_init_io(&lp->reg, obj, &lasips2_reg_ops, lp, "lasips2-kbd",
                           0x100);
     lp->id = 0;
-    lp->parent = container_of(s, LASIPS2State, kbd_port);
+    lp->lasips2 = container_of(s, LASIPS2State, kbd_port);
 }
 
 static void lasips2_kbd_port_class_init(ObjectClass *klass, void *data)
@@ -405,7 +405,7 @@ static void lasips2_mouse_port_init(Object *obj)
     memory_region_init_io(&lp->reg, obj, &lasips2_reg_ops, lp, "lasips2-mouse",
                           0x100);
     lp->id = 1;
-    lp->parent = container_of(s, LASIPS2State, mouse_port);
+    lp->lasips2 = container_of(s, LASIPS2State, mouse_port);
 }
 
 static void lasips2_mouse_port_class_init(ObjectClass *klass, void *data)
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 7199f16622..9fe9e63a66 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -37,7 +37,7 @@ typedef struct LASIPS2State LASIPS2State;
 struct LASIPS2Port {
     DeviceState parent_obj;
 
-    LASIPS2State *parent;
+    LASIPS2State *lasips2;
     MemoryRegion reg;
     PS2State *ps2dev;
     uint8_t id;
-- 
2.30.2



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

* [PATCH 30/40] lasips2: standardise on lp name for LASIPS2Port variables
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (28 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 29/40] lasips2: rename LASIPS2Port parent pointer to lasips2 Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:29   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 31/40] lasips2: switch register memory region to DEVICE_BIG_ENDIAN Mark Cave-Ayland
                   ` (10 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This is shorter to type and keeps the naming convention consistent within the
LASIPS2 device.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c | 52 +++++++++++++++++++++++-----------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 0f392e2bee..09d909c843 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -139,28 +139,28 @@ static void lasips2_set_irq(void *opaque, int n, int level)
 static void lasips2_reg_write(void *opaque, hwaddr addr, uint64_t val,
                               unsigned size)
 {
-    LASIPS2Port *port = opaque;
+    LASIPS2Port *lp = LASIPS2_PORT(opaque);
 
-    trace_lasips2_reg_write(size, port->id, addr,
+    trace_lasips2_reg_write(size, lp->id, addr,
                             lasips2_write_reg_name(addr), val);
 
     switch (addr & 0xc) {
     case REG_PS2_CONTROL:
-        port->control = val;
+        lp->control = val;
         break;
 
     case REG_PS2_XMTDATA:
-        if (port->control & LASIPS2_CONTROL_LOOPBACK) {
-            port->buf = val;
-            port->loopback_rbne = true;
-            qemu_set_irq(port->irq, 1);
+        if (lp->control & LASIPS2_CONTROL_LOOPBACK) {
+            lp->buf = val;
+            lp->loopback_rbne = true;
+            qemu_set_irq(lp->irq, 1);
             break;
         }
 
-        if (port->id) {
-            ps2_write_mouse(PS2_MOUSE_DEVICE(port->ps2dev), val);
+        if (lp->id) {
+            ps2_write_mouse(PS2_MOUSE_DEVICE(lp->ps2dev), val);
         } else {
-            ps2_write_keyboard(PS2_KBD_DEVICE(port->ps2dev), val);
+            ps2_write_keyboard(PS2_KBD_DEVICE(lp->ps2dev), val);
         }
         break;
 
@@ -176,53 +176,53 @@ static void lasips2_reg_write(void *opaque, hwaddr addr, uint64_t val,
 
 static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size)
 {
-    LASIPS2Port *port = opaque;
+    LASIPS2Port *lp = LASIPS2_PORT(opaque);
     uint64_t ret = 0;
 
     switch (addr & 0xc) {
     case REG_PS2_ID:
-        ret = port->id;
+        ret = lp->id;
         break;
 
     case REG_PS2_RCVDATA:
-        if (port->control & LASIPS2_CONTROL_LOOPBACK) {
-            port->loopback_rbne = false;
-            qemu_set_irq(port->irq, 0);
-            ret = port->buf;
+        if (lp->control & LASIPS2_CONTROL_LOOPBACK) {
+            lp->loopback_rbne = false;
+            qemu_set_irq(lp->irq, 0);
+            ret = lp->buf;
             break;
         }
 
-        ret = ps2_read_data(port->ps2dev);
+        ret = ps2_read_data(lp->ps2dev);
         break;
 
     case REG_PS2_CONTROL:
-        ret = port->control;
+        ret = lp->control;
         break;
 
     case REG_PS2_STATUS:
         ret = LASIPS2_STATUS_DATSHD | LASIPS2_STATUS_CLKSHD;
 
-        if (port->control & LASIPS2_CONTROL_DIAG) {
-            if (!(port->control & LASIPS2_CONTROL_DATDIR)) {
+        if (lp->control & LASIPS2_CONTROL_DIAG) {
+            if (!(lp->control & LASIPS2_CONTROL_DATDIR)) {
                 ret &= ~LASIPS2_STATUS_DATSHD;
             }
 
-            if (!(port->control & LASIPS2_CONTROL_CLKDIR)) {
+            if (!(lp->control & LASIPS2_CONTROL_CLKDIR)) {
                 ret &= ~LASIPS2_STATUS_CLKSHD;
             }
         }
 
-        if (port->control & LASIPS2_CONTROL_LOOPBACK) {
-            if (port->loopback_rbne) {
+        if (lp->control & LASIPS2_CONTROL_LOOPBACK) {
+            if (lp->loopback_rbne) {
                 ret |= LASIPS2_STATUS_RBNE;
             }
         } else {
-            if (!ps2_queue_empty(port->ps2dev)) {
+            if (!ps2_queue_empty(lp->ps2dev)) {
                 ret |= LASIPS2_STATUS_RBNE;
             }
         }
 
-        if (port->lasips2->int_status) {
+        if (lp->lasips2->int_status) {
             ret |= LASIPS2_STATUS_CMPINTR;
         }
         break;
@@ -233,7 +233,7 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size)
         break;
     }
 
-    trace_lasips2_reg_read(size, port->id, addr,
+    trace_lasips2_reg_read(size, lp->id, addr,
                            lasips2_read_reg_name(addr), ret);
     return ret;
 }
-- 
2.30.2



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

* [PATCH 31/40] lasips2: switch register memory region to DEVICE_BIG_ENDIAN
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (29 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 30/40] lasips2: standardise on lp name for LASIPS2Port variables Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:29   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 32/40] lasips2: don't use legacy ps2_kbd_init() function Mark Cave-Ayland
                   ` (9 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

The LASI device (and so also the LASIPS2 device) are only used for the HPPA
B160L machine which is a big endian architecture.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 09d909c843..7bf6077b58 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -245,7 +245,7 @@ static const MemoryRegionOps lasips2_reg_ops = {
         .min_access_size = 1,
         .max_access_size = 4,
     },
-    .endianness = DEVICE_NATIVE_ENDIAN,
+    .endianness = DEVICE_BIG_ENDIAN,
 };
 
 static void lasips2_realize(DeviceState *dev, Error **errp)
-- 
2.30.2



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

* [PATCH 32/40] lasips2: don't use legacy ps2_kbd_init() function
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (30 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 31/40] lasips2: switch register memory region to DEVICE_BIG_ENDIAN Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:29   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 33/40] lasips2: don't use legacy ps2_mouse_init() function Mark Cave-Ayland
                   ` (8 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Instantiate the PS2 keyboard device within LASIPS2KbdPort using
object_initialize_child() in lasips2_kbd_port_init() and realize it in
lasips2_kbd_port_realize() accordingly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 10 +++++++++-
 include/hw/input/lasips2.h |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 7bf6077b58..4b3264a02d 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -353,10 +353,15 @@ static const TypeInfo lasips2_port_info = {
 
 static void lasips2_kbd_port_realize(DeviceState *dev, Error **errp)
 {
+    LASIPS2KbdPort *s = LASIPS2_KBD_PORT(dev);
     LASIPS2Port *lp = LASIPS2_PORT(dev);
     LASIPS2PortDeviceClass *lpdc = LASIPS2_PORT_GET_CLASS(lp);
 
-    lp->ps2dev = ps2_kbd_init();
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->kbd), errp)) {
+        return;
+    }
+
+    lp->ps2dev = PS2_DEVICE(&s->kbd);
     lpdc->parent_realize(dev, errp);
 }
 
@@ -367,6 +372,9 @@ static void lasips2_kbd_port_init(Object *obj)
 
     memory_region_init_io(&lp->reg, obj, &lasips2_reg_ops, lp, "lasips2-kbd",
                           0x100);
+
+    object_initialize_child(obj, "kbd", &s->kbd, TYPE_PS2_KBD_DEVICE);
+
     lp->id = 0;
     lp->lasips2 = container_of(s, LASIPS2State, kbd_port);
 }
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 9fe9e63a66..4a0ad999d7 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -52,6 +52,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2KbdPort, LASIPS2_KBD_PORT)
 
 struct LASIPS2KbdPort {
     LASIPS2Port parent_obj;
+
+    PS2KbdState kbd;
 };
 
 #define TYPE_LASIPS2_MOUSE_PORT "lasips2-mouse-port"
-- 
2.30.2



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

* [PATCH 33/40] lasips2: don't use legacy ps2_mouse_init() function
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (31 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 32/40] lasips2: don't use legacy ps2_kbd_init() function Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:30   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 34/40] lasips2: update VMStateDescription for LASIPS2 device Mark Cave-Ayland
                   ` (7 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Instantiate the PS2 mouse device within LASIPS2MousePort using
object_initialize_child() in lasips2_mouse_port_init() and realize it in
lasips2_mouse_port_realize() accordingly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c         | 10 +++++++++-
 include/hw/input/lasips2.h |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 4b3264a02d..e602e3c986 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -398,10 +398,15 @@ static const TypeInfo lasips2_kbd_port_info = {
 
 static void lasips2_mouse_port_realize(DeviceState *dev, Error **errp)
 {
+    LASIPS2MousePort *s = LASIPS2_MOUSE_PORT(dev);
     LASIPS2Port *lp = LASIPS2_PORT(dev);
     LASIPS2PortDeviceClass *lpdc = LASIPS2_PORT_GET_CLASS(lp);
 
-    lp->ps2dev = ps2_mouse_init();
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->mouse), errp)) {
+        return;
+    }
+
+    lp->ps2dev = PS2_DEVICE(&s->mouse);
     lpdc->parent_realize(dev, errp);
 }
 
@@ -412,6 +417,9 @@ static void lasips2_mouse_port_init(Object *obj)
 
     memory_region_init_io(&lp->reg, obj, &lasips2_reg_ops, lp, "lasips2-mouse",
                           0x100);
+
+    object_initialize_child(obj, "mouse", &s->mouse, TYPE_PS2_MOUSE_DEVICE);
+
     lp->id = 1;
     lp->lasips2 = container_of(s, LASIPS2State, mouse_port);
 }
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 4a0ad999d7..01911c50f9 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -61,6 +61,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2MousePort, LASIPS2_MOUSE_PORT)
 
 struct LASIPS2MousePort {
     LASIPS2Port parent_obj;
+
+    PS2MouseState mouse;
 };
 
 struct LASIPS2State {
-- 
2.30.2



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

* [PATCH 34/40] lasips2: update VMStateDescription for LASIPS2 device
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (32 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 33/40] lasips2: don't use legacy ps2_mouse_init() function Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:38   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 35/40] pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the I8042_MMIO device Mark Cave-Ayland
                   ` (6 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Since this series has already introduced a migration break for the HPPA B160L
machine, we can use this opportunity to improve the VMStateDescription for
the LASIPS2 device.

Add the new int_status field to the VMStateDescription and remodel the ports
as separate VMSTATE_STRUCT instances.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/lasips2.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index e602e3c986..ea7c07a2ba 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -35,15 +35,28 @@
 #include "qapi/error.h"
 
 
+static const VMStateDescription vmstate_lasips2_port = {
+    .name = "lasips2-port",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT8(control, LASIPS2Port),
+        VMSTATE_UINT8(buf, LASIPS2Port),
+        VMSTATE_BOOL(loopback_rbne, LASIPS2Port),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static const VMStateDescription vmstate_lasips2 = {
     .name = "lasips2",
-    .version_id = 0,
-    .minimum_version_id = 0,
+    .version_id = 1,
+    .minimum_version_id = 1,
     .fields = (VMStateField[]) {
-        VMSTATE_UINT8(kbd_port.parent_obj.control, LASIPS2State),
-        VMSTATE_UINT8(kbd_port.parent_obj.id, LASIPS2State),
-        VMSTATE_UINT8(mouse_port.parent_obj.control, LASIPS2State),
-        VMSTATE_UINT8(mouse_port.parent_obj.id, LASIPS2State),
+        VMSTATE_UINT8(int_status, LASIPS2State),
+        VMSTATE_STRUCT(kbd_port.parent_obj, LASIPS2State, 1,
+                       vmstate_lasips2_port, LASIPS2Port),
+        VMSTATE_STRUCT(mouse_port.parent_obj, LASIPS2State, 1,
+                       vmstate_lasips2_port, LASIPS2Port),
         VMSTATE_END_OF_LIST()
     }
 };
-- 
2.30.2



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

* [PATCH 35/40] pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the I8042_MMIO device
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (33 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 34/40] lasips2: update VMStateDescription for LASIPS2 device Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:35   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 36/40] pckbd: don't use legacy ps2_kbd_init() function Mark Cave-Ayland
                   ` (5 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This enables us to register the VMStateDescription using the DeviceClass vmsd
property rather than having to call vmstate_register() from i8042_mmio_realize().

Note that this is a migration break for the MIPS jazz machine which is the only
user of the I8042_MMIO device.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pckbd.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index 9184411c3e..195a64f520 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -699,9 +699,6 @@ static void i8042_mmio_realize(DeviceState *dev, Error **errp)
 
     sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->region);
 
-    /* Note we can't use dc->vmsd without breaking migration compatibility */
-    vmstate_register(NULL, 0, &vmstate_kbd, ks);
-
     ks->kbd = ps2_kbd_init();
     qdev_connect_gpio_out(DEVICE(ks->kbd), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
@@ -732,12 +729,23 @@ static Property i8042_mmio_properties[] = {
     DEFINE_PROP_END_OF_LIST(),
 };
 
+static const VMStateDescription vmstate_kbd_mmio = {
+    .name = "pckbd-mmio",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (VMStateField[]) {
+        VMSTATE_STRUCT(kbd, MMIOKBDState, 0, vmstate_kbd, KBDState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static void i8042_mmio_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = i8042_mmio_realize;
     dc->reset = i8042_mmio_reset;
+    dc->vmsd = &vmstate_kbd_mmio;
     device_class_set_props(dc, i8042_mmio_properties);
     set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
 }
-- 
2.30.2



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

* [PATCH 36/40] pckbd: don't use legacy ps2_kbd_init() function
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (34 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 35/40] pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the I8042_MMIO device Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:36   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 37/40] ps2: remove unused " Mark Cave-Ayland
                   ` (4 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Instantiate the PS2 keyboard device within KBDState using
object_initialize_child() in i8042_initfn() and i8042_mmio_init() and realize
it in i8042_realizefn() and i8042_mmio_realize() accordingly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pckbd.c         | 29 +++++++++++++++++++++--------
 include/hw/input/i8042.h |  3 ++-
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index 195a64f520..cb452f2612 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -286,7 +286,7 @@ static void kbd_queue(KBDState *s, int b, int aux)
         s->pending |= aux ? KBD_PENDING_CTRL_AUX : KBD_PENDING_CTRL_KBD;
         kbd_safe_update_irq(s);
     } else {
-        ps2_queue(aux ? s->mouse : s->kbd, b);
+        ps2_queue(aux ? s->mouse : PS2_DEVICE(&s->ps2kbd), b);
     }
 }
 
@@ -408,7 +408,7 @@ static uint64_t kbd_read_data(void *opaque, hwaddr addr,
                 timer_mod(s->throttle_timer,
                           qemu_clock_get_us(QEMU_CLOCK_VIRTUAL) + 1000);
             }
-            s->obdata = ps2_read_data(s->kbd);
+            s->obdata = ps2_read_data(PS2_DEVICE(&s->ps2kbd));
         } else if (s->obsrc & KBD_OBSRC_MOUSE) {
             s->obdata = ps2_read_data(s->mouse);
         } else if (s->obsrc & KBD_OBSRC_CTRL) {
@@ -429,14 +429,15 @@ static void kbd_write_data(void *opaque, hwaddr addr,
 
     switch (s->write_cmd) {
     case 0:
-        ps2_write_keyboard(s->kbd, val);
+        ps2_write_keyboard(&s->ps2kbd, val);
         /* sending data to the keyboard reenables PS/2 communication */
         s->mode &= ~KBD_MODE_DISABLE_KBD;
         kbd_safe_update_irq(s);
         break;
     case KBD_CCMD_WRITE_MODE:
         s->mode = val;
-        ps2_keyboard_set_translation(s->kbd, (s->mode & KBD_MODE_KCC) != 0);
+        ps2_keyboard_set_translation(&s->ps2kbd,
+                                     (s->mode & KBD_MODE_KCC) != 0);
         /*
          * a write to the mode byte interrupt enable flags directly updates
          * the irq lines
@@ -699,10 +700,14 @@ static void i8042_mmio_realize(DeviceState *dev, Error **errp)
 
     sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->region);
 
-    ks->kbd = ps2_kbd_init();
-    qdev_connect_gpio_out(DEVICE(ks->kbd), PS2_DEVICE_IRQ,
+    if (!sysbus_realize(SYS_BUS_DEVICE(&ks->ps2kbd), errp)) {
+        return;
+    }
+
+    qdev_connect_gpio_out(DEVICE(&ks->ps2kbd), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
                                                  0));
+
     ks->mouse = ps2_mouse_init();
     qdev_connect_gpio_out(DEVICE(ks->mouse), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq",
@@ -716,6 +721,8 @@ static void i8042_mmio_init(Object *obj)
 
     ks->extended_state = true;
 
+    object_initialize_child(obj, "ps2kbd", &ks->ps2kbd, TYPE_PS2_KBD_DEVICE);
+
     qdev_init_gpio_out(DEVICE(obj), ks->irqs, 2);
     qdev_init_gpio_in_named(DEVICE(obj), i8042_mmio_set_kbd_irq,
                             "ps2-kbd-input-irq", 1);
@@ -851,6 +858,8 @@ static void i8042_initfn(Object *obj)
     memory_region_init_io(isa_s->io + 1, obj, &i8042_cmd_ops, s,
                           "i8042-cmd", 1);
 
+    object_initialize_child(obj, "ps2kbd", &s->ps2kbd, TYPE_PS2_KBD_DEVICE);
+
     qdev_init_gpio_out_named(DEVICE(obj), &s->a20_out, I8042_A20_LINE, 1);
 
     qdev_init_gpio_out(DEVICE(obj), s->irqs, 2);
@@ -884,10 +893,14 @@ static void i8042_realizefn(DeviceState *dev, Error **errp)
     isa_register_ioport(isadev, isa_s->io + 0, 0x60);
     isa_register_ioport(isadev, isa_s->io + 1, 0x64);
 
-    s->kbd = ps2_kbd_init();
-    qdev_connect_gpio_out(DEVICE(s->kbd), PS2_DEVICE_IRQ,
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->ps2kbd), errp)) {
+        return;
+    }
+
+    qdev_connect_gpio_out(DEVICE(&s->ps2kbd), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
                                                  0));
+
     s->mouse = ps2_mouse_init();
     qdev_connect_gpio_out(DEVICE(s->mouse), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq",
diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h
index ca933d8e1b..8beb0ac01f 100644
--- a/include/hw/input/i8042.h
+++ b/include/hw/input/i8042.h
@@ -10,6 +10,7 @@
 
 #include "hw/isa/isa.h"
 #include "hw/sysbus.h"
+#include "hw/input/ps2.h"
 #include "qom/object.h"
 
 #define I8042_KBD_IRQ      0
@@ -30,7 +31,7 @@ typedef struct KBDState {
     uint8_t obdata;
     uint8_t cbdata;
     uint8_t pending_tmp;
-    void *kbd;
+    PS2KbdState ps2kbd;
     void *mouse;
     QEMUTimer *throttle_timer;
 
-- 
2.30.2



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

* [PATCH 37/40] ps2: remove unused legacy ps2_kbd_init() function
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (35 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 36/40] pckbd: don't use legacy ps2_kbd_init() function Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:37   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 38/40] pckbd: don't use legacy ps2_mouse_init() function Mark Cave-Ayland
                   ` (3 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Now that the legacy ps2_kbd_init() function is no longer used, it can be completely
removed along with its associated trace-event.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/ps2.c         | 13 -------------
 hw/input/trace-events  |  1 -
 include/hw/input/ps2.h |  1 -
 3 files changed, 15 deletions(-)

diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 59bac28ac8..5b1728ef02 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -1224,19 +1224,6 @@ static void ps2_kbd_realize(DeviceState *dev, Error **errp)
     qemu_input_handler_register(dev, &ps2_keyboard_handler);
 }
 
-void *ps2_kbd_init(void)
-{
-    DeviceState *dev;
-    PS2KbdState *s;
-
-    dev = qdev_new(TYPE_PS2_KBD_DEVICE);
-    sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
-    s = PS2_KBD_DEVICE(dev);
-
-    trace_ps2_kbd_init(s);
-    return s;
-}
-
 static QemuInputHandler ps2_mouse_handler = {
     .name  = "QEMU PS/2 Mouse",
     .mask  = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL,
diff --git a/hw/input/trace-events b/hw/input/trace-events
index e0bfe7f3ee..df998d13eb 100644
--- a/hw/input/trace-events
+++ b/hw/input/trace-events
@@ -41,7 +41,6 @@ ps2_mouse_fake_event(void *opaque) "%p"
 ps2_write_mouse(void *opaque, int val) "%p val %d"
 ps2_kbd_reset(void *opaque) "%p"
 ps2_mouse_reset(void *opaque) "%p"
-ps2_kbd_init(void *s) "%p"
 ps2_mouse_init(void *s) "%p"
 
 # hid.c
diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h
index a78619d8cb..18fd10cc75 100644
--- a/include/hw/input/ps2.h
+++ b/include/hw/input/ps2.h
@@ -98,7 +98,6 @@ struct PS2MouseState {
 OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVICE)
 
 /* ps2.c */
-void *ps2_kbd_init(void);
 void *ps2_mouse_init(void);
 void ps2_write_mouse(PS2MouseState *s, int val);
 void ps2_write_keyboard(PS2KbdState *s, int val);
-- 
2.30.2



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

* [PATCH 38/40] pckbd: don't use legacy ps2_mouse_init() function
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (36 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 37/40] ps2: remove unused " Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:37   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 39/40] ps2: remove unused " Mark Cave-Ayland
                   ` (2 subsequent siblings)
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Instantiate the PS2 mouse device within KBDState using
object_initialize_child() in i8042_initfn() and i8042_mmio_init() and realize
it in i8042_realizefn() and i8042_mmio_realize() accordingly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pckbd.c         | 27 +++++++++++++++++++--------
 include/hw/input/i8042.h |  2 +-
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index cb452f2612..0fc1af403e 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -286,7 +286,7 @@ static void kbd_queue(KBDState *s, int b, int aux)
         s->pending |= aux ? KBD_PENDING_CTRL_AUX : KBD_PENDING_CTRL_KBD;
         kbd_safe_update_irq(s);
     } else {
-        ps2_queue(aux ? s->mouse : PS2_DEVICE(&s->ps2kbd), b);
+        ps2_queue(aux ? PS2_DEVICE(&s->ps2mouse) : PS2_DEVICE(&s->ps2kbd), b);
     }
 }
 
@@ -410,7 +410,7 @@ static uint64_t kbd_read_data(void *opaque, hwaddr addr,
             }
             s->obdata = ps2_read_data(PS2_DEVICE(&s->ps2kbd));
         } else if (s->obsrc & KBD_OBSRC_MOUSE) {
-            s->obdata = ps2_read_data(s->mouse);
+            s->obdata = ps2_read_data(PS2_DEVICE(&s->ps2mouse));
         } else if (s->obsrc & KBD_OBSRC_CTRL) {
             s->obdata = kbd_dequeue(s);
         }
@@ -459,7 +459,7 @@ static void kbd_write_data(void *opaque, hwaddr addr,
         outport_write(s, val);
         break;
     case KBD_CCMD_WRITE_MOUSE:
-        ps2_write_mouse(s->mouse, val);
+        ps2_write_mouse(&s->ps2mouse, val);
         /* sending data to the mouse reenables PS/2 communication */
         s->mode &= ~KBD_MODE_DISABLE_MOUSE;
         kbd_safe_update_irq(s);
@@ -704,12 +704,15 @@ static void i8042_mmio_realize(DeviceState *dev, Error **errp)
         return;
     }
 
+    if (!sysbus_realize(SYS_BUS_DEVICE(&ks->ps2mouse), errp)) {
+        return;
+    }
+
     qdev_connect_gpio_out(DEVICE(&ks->ps2kbd), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
                                                  0));
 
-    ks->mouse = ps2_mouse_init();
-    qdev_connect_gpio_out(DEVICE(ks->mouse), PS2_DEVICE_IRQ,
+    qdev_connect_gpio_out(DEVICE(&ks->ps2mouse), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq",
                                                  0));
 }
@@ -722,6 +725,8 @@ static void i8042_mmio_init(Object *obj)
     ks->extended_state = true;
 
     object_initialize_child(obj, "ps2kbd", &ks->ps2kbd, TYPE_PS2_KBD_DEVICE);
+    object_initialize_child(obj, "ps2mouse", &ks->ps2mouse,
+                            TYPE_PS2_MOUSE_DEVICE);
 
     qdev_init_gpio_out(DEVICE(obj), ks->irqs, 2);
     qdev_init_gpio_in_named(DEVICE(obj), i8042_mmio_set_kbd_irq,
@@ -785,7 +790,7 @@ void i8042_isa_mouse_fake_event(ISAKBDState *isa)
 {
     KBDState *s = &isa->kbd;
 
-    ps2_mouse_fake_event(s->mouse);
+    ps2_mouse_fake_event(&s->ps2mouse);
 }
 
 void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out)
@@ -859,6 +864,8 @@ static void i8042_initfn(Object *obj)
                           "i8042-cmd", 1);
 
     object_initialize_child(obj, "ps2kbd", &s->ps2kbd, TYPE_PS2_KBD_DEVICE);
+    object_initialize_child(obj, "ps2mouse", &s->ps2mouse,
+                            TYPE_PS2_MOUSE_DEVICE);
 
     qdev_init_gpio_out_named(DEVICE(obj), &s->a20_out, I8042_A20_LINE, 1);
 
@@ -901,10 +908,14 @@ static void i8042_realizefn(DeviceState *dev, Error **errp)
                           qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
                                                  0));
 
-    s->mouse = ps2_mouse_init();
-    qdev_connect_gpio_out(DEVICE(s->mouse), PS2_DEVICE_IRQ,
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->ps2mouse), errp)) {
+        return;
+    }
+
+    qdev_connect_gpio_out(DEVICE(&s->ps2mouse), PS2_DEVICE_IRQ,
                           qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq",
                                                  0));
+
     if (isa_s->kbd_throttle && !isa_s->kbd.extended_state) {
         warn_report(TYPE_I8042 ": can't enable kbd-throttle without"
                     " extended-state, disabling kbd-throttle");
diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h
index 8beb0ac01f..e199f1ece8 100644
--- a/include/hw/input/i8042.h
+++ b/include/hw/input/i8042.h
@@ -32,7 +32,7 @@ typedef struct KBDState {
     uint8_t cbdata;
     uint8_t pending_tmp;
     PS2KbdState ps2kbd;
-    void *mouse;
+    PS2MouseState ps2mouse;
     QEMUTimer *throttle_timer;
 
     qemu_irq irqs[2];
-- 
2.30.2



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

* [PATCH 39/40] ps2: remove unused legacy ps2_mouse_init() function
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (37 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 38/40] pckbd: don't use legacy ps2_mouse_init() function Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:37   ` Peter Maydell
  2022-06-29 12:40 ` [PATCH 40/40] pckbd: remove legacy i8042_mm_init() function Mark Cave-Ayland
  2022-07-01 19:37 ` [PATCH 00/40] PS2 device QOMification - part 2 Helge Deller
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

Now that the legacy ps2_mouse_init() function is no longer used, it can be completely
removed along with its associated trace-event.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/ps2.c         | 13 -------------
 hw/input/trace-events  |  1 -
 include/hw/input/ps2.h |  1 -
 3 files changed, 15 deletions(-)

diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 5b1728ef02..05cf7111e3 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -1236,19 +1236,6 @@ static void ps2_mouse_realize(DeviceState *dev, Error **errp)
     qemu_input_handler_register(dev, &ps2_mouse_handler);
 }
 
-void *ps2_mouse_init(void)
-{
-    DeviceState *dev;
-    PS2MouseState *s;
-
-    dev = qdev_new(TYPE_PS2_MOUSE_DEVICE);
-    sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
-    s = PS2_MOUSE_DEVICE(dev);
-
-    trace_ps2_mouse_init(s);
-    return s;
-}
-
 static void ps2_kbd_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
diff --git a/hw/input/trace-events b/hw/input/trace-events
index df998d13eb..29001a827d 100644
--- a/hw/input/trace-events
+++ b/hw/input/trace-events
@@ -41,7 +41,6 @@ ps2_mouse_fake_event(void *opaque) "%p"
 ps2_write_mouse(void *opaque, int val) "%p val %d"
 ps2_kbd_reset(void *opaque) "%p"
 ps2_mouse_reset(void *opaque) "%p"
-ps2_mouse_init(void *s) "%p"
 
 # hid.c
 hid_kbd_queue_full(void) "queue full"
diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h
index 18fd10cc75..ff777582cd 100644
--- a/include/hw/input/ps2.h
+++ b/include/hw/input/ps2.h
@@ -98,7 +98,6 @@ struct PS2MouseState {
 OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVICE)
 
 /* ps2.c */
-void *ps2_mouse_init(void);
 void ps2_write_mouse(PS2MouseState *s, int val);
 void ps2_write_keyboard(PS2KbdState *s, int val);
 uint32_t ps2_read_data(PS2State *s);
-- 
2.30.2



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

* [PATCH 40/40] pckbd: remove legacy i8042_mm_init() function
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (38 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 39/40] ps2: remove unused " Mark Cave-Ayland
@ 2022-06-29 12:40 ` Mark Cave-Ayland
  2022-07-04 13:38   ` Peter Maydell
  2022-07-01 19:37 ` [PATCH 00/40] PS2 device QOMification - part 2 Helge Deller
  40 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-06-29 12:40 UTC (permalink / raw)
  To: richard.henderson, deller, svens, mst, pbonzini, peter.maydell,
	hpoussin, aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

This legacy function is only used during the initialisation of the MIPS magnum
machine, so inline its functionality directly into mips_jazz_init() and then
remove it.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/input/pckbd.c         | 16 ----------------
 hw/mips/jazz.c           | 13 ++++++++++---
 include/hw/input/i8042.h |  2 --
 3 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index 0fc1af403e..b92b63bedc 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -762,22 +762,6 @@ static void i8042_mmio_class_init(ObjectClass *klass, void *data)
     set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
 }
 
-MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
-                            ram_addr_t size, hwaddr mask)
-{
-    DeviceState *dev;
-
-    dev = qdev_new(TYPE_I8042_MMIO);
-    qdev_prop_set_uint64(dev, "mask", mask);
-    qdev_prop_set_uint32(dev, "size", size);
-    sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
-
-    qdev_connect_gpio_out(dev, I8042_KBD_IRQ, kbd_irq);
-    qdev_connect_gpio_out(dev, I8042_MOUSE_IRQ, mouse_irq);
-
-    return I8042_MMIO(dev);
-}
-
 static const TypeInfo i8042_mmio_info = {
     .name          = TYPE_I8042_MMIO,
     .parent        = TYPE_SYS_BUS_DEVICE,
diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c
index 1eb8bd5018..6aefe9a61b 100644
--- a/hw/mips/jazz.c
+++ b/hw/mips/jazz.c
@@ -361,9 +361,16 @@ static void mips_jazz_init(MachineState *machine,
     memory_region_add_subregion(address_space, 0x80004000, rtc);
 
     /* Keyboard (i8042) */
-    i8042 = i8042_mm_init(qdev_get_gpio_in(rc4030, 6),
-                          qdev_get_gpio_in(rc4030, 7),
-                          0x1000, 0x1);
+    i8042 = I8042_MMIO(qdev_new(TYPE_I8042_MMIO));
+    qdev_prop_set_uint64(DEVICE(i8042), "mask", 1);
+    qdev_prop_set_uint32(DEVICE(i8042), "size", 0x1000);
+    sysbus_realize_and_unref(SYS_BUS_DEVICE(i8042), &error_fatal);
+
+    qdev_connect_gpio_out(DEVICE(i8042), I8042_KBD_IRQ,
+                          qdev_get_gpio_in(rc4030, 6));
+    qdev_connect_gpio_out(DEVICE(i8042), I8042_MOUSE_IRQ,
+                          qdev_get_gpio_in(rc4030, 7));
+
     memory_region_add_subregion(address_space, 0x80005000,
                                 sysbus_mmio_get_region(SYS_BUS_DEVICE(i8042),
                                                        0));
diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h
index e199f1ece8..9fb3f8d787 100644
--- a/include/hw/input/i8042.h
+++ b/include/hw/input/i8042.h
@@ -88,8 +88,6 @@ struct MMIOKBDState {
 #define I8042_A20_LINE "a20"
 
 
-MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
-                            ram_addr_t size, hwaddr mask);
 void i8042_isa_mouse_fake_event(ISAKBDState *isa);
 void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out);
 
-- 
2.30.2



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

* Re: [PATCH 00/40] PS2 device QOMification - part 2
  2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
                   ` (39 preceding siblings ...)
  2022-06-29 12:40 ` [PATCH 40/40] pckbd: remove legacy i8042_mm_init() function Mark Cave-Ayland
@ 2022-07-01 19:37 ` Helge Deller
  40 siblings, 0 replies; 84+ messages in thread
From: Helge Deller @ 2022-07-01 19:37 UTC (permalink / raw)
  To: Mark Cave-Ayland, richard.henderson, svens, mst, pbonzini,
	peter.maydell, hpoussin, aleksandar.rikalo, f4bug, qemu-devel,
	qemu-arm

Hi Mark,

On 6/29/22 14:39, Mark Cave-Ayland wrote:
> Here is the follow-on series from part 1 which completes the work to remove
> the legacy global device init functions for PS2 devices. Now that part 1 has
> been applied, the hard part to remove the PS2 function callback and argument
> has been completed and all that remains is to improve the PS2 device
> QOMification to allow the legacy PS2 functions to be removed.
>
> Patches 1-11 update the pl050 device to remove the use of ps2_kbd_init() and
> ps2_mouse_init(), whilst patches 12-34 make some more involved changes to
> the lasips2 device (in particular completing the LASIPS2Port abstraction)
> before doing the same.
>
> Finally patches 35-40 complete the process for the pckbd (I8042 and I8042_MMIO
> devices) before removing the now unused ps2_kbd_init(), ps2_mouse_init() and
> i8042_mm_init() functions.
>
> Note that this series is a migration break for the HPPA B160L and MIPS magnum
> machines: I've had agreement from both Helge and Hervé that this is worth
> doing to allow the use of the DeviceClass vmsd property to set the
> VMStateDescription rather than manually calling vmstate_register().
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

I did tested this patch series successfully with hppa Linux and HP-UX guests.
PS/2 mouse and keyboard works as expected.
Thanks for this nice cleanup work!

You may add either or both of:
Tested-by: Helge Deller <deller@gmx.de>
Acked-by: Helge Deller <deller@gmx.de>

Helge


>
> Mark Cave-Ayland (40):
>   pl050: move PL050State from pl050.c to new pl050.h header file
>   pl050: rename pl050_keyboard_init() to pl050_kbd_init()
>   pl050: change PL050State dev pointer from void to PS2State
>   pl050: introduce new PL050_KBD_DEVICE QOM type
>   pl050: introduce new PL050_MOUSE_DEVICE QOM type
>   pl050: move logic from pl050_realize() to pl050_init()
>   pl050: introduce PL050DeviceClass for the PL050 device
>   pl050: introduce pl050_kbd_class_init() and pl050_kbd_realize()
>   pl050: introduce pl050_mouse_class_init() and pl050_mouse_realize()
>   pl050: don't use legacy ps2_kbd_init() function
>   pl050: don't use legacy ps2_mouse_init() function
>   lasips2: don't use vmstate_register() in lasips2_realize()
>   lasips2: remove the qdev base property and the lasips2_properties
>     array
>   lasips2: remove legacy lasips2_initfn() function
>   lasips2: change LASIPS2State dev pointer from void to PS2State
>   lasips2: QOMify LASIPS2Port
>   lasips2: introduce new LASIPS2_KBD_PORT QOM type
>   lasips2: introduce new LASIPS2_MOUSE_PORT QOM type
>   lasips2: move keyboard port initialisation to new
>     lasips2_kbd_port_init() function
>   lasips2: move mouse port initialisation to new
>     lasips2_mouse_port_init() function
>   lasips2: introduce lasips2_kbd_port_class_init() and
>     lasips2_kbd_port_realize()
>   lasips2: introduce lasips2_mouse_port_class_init() and
>     lasips2_mouse_port_realize()
>   lasips2: rename LASIPS2Port irq field to birq
>   lasips2: introduce port IRQ and new lasips2_port_init() function
>   lasips2: introduce LASIPS2PortDeviceClass for the LASIPS2_PORT device
>   lasips2: add named input gpio to port for downstream PS2 device IRQ
>   lasips2: add named input gpio to handle incoming port IRQs
>   lasips2: switch to using port-based IRQs
>   lasips2: rename LASIPS2Port parent pointer to lasips2
>   lasips2: standardise on lp name for LASIPS2Port variables
>   lasips2: switch register memory region to DEVICE_BIG_ENDIAN
>   lasips2: don't use legacy ps2_kbd_init() function
>   lasips2: don't use legacy ps2_mouse_init() function
>   lasips2: update VMStateDescription for LASIPS2 device
>   pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the
>     I8042_MMIO device
>   pckbd: don't use legacy ps2_kbd_init() function
>   ps2: remove unused legacy ps2_kbd_init() function
>   pckbd: don't use legacy ps2_mouse_init() function
>   ps2: remove unused legacy ps2_mouse_init() function
>   pckbd: remove legacy i8042_mm_init() function
>
>  hw/hppa/machine.c          |   7 +-
>  hw/input/lasips2.c         | 320 ++++++++++++++++++++++++++-----------
>  hw/input/pckbd.c           |  82 ++++++----
>  hw/input/pl050.c           | 112 ++++++++-----
>  hw/input/ps2.c             |  26 ---
>  hw/input/trace-events      |   2 -
>  hw/mips/jazz.c             |  13 +-
>  include/hw/input/i8042.h   |   7 +-
>  include/hw/input/lasips2.h |  57 +++++--
>  include/hw/input/pl050.h   |  59 +++++++
>  include/hw/input/ps2.h     |   2 -
>  11 files changed, 466 insertions(+), 221 deletions(-)
>  create mode 100644 include/hw/input/pl050.h
>



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

* Re: [PATCH 01/40] pl050: move PL050State from pl050.c to new pl050.h header file
  2022-06-29 12:39 ` [PATCH 01/40] pl050: move PL050State from pl050.c to new pl050.h header file Mark Cave-Ayland
@ 2022-07-04 13:12   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:12 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:40, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This allows the QOM types in pl050.c to be used elsewhere by simply including
> pl050.h.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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

thanks
-- PMM


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

* Re: [PATCH 02/40] pl050: rename pl050_keyboard_init() to pl050_kbd_init()
  2022-06-29 12:39 ` [PATCH 02/40] pl050: rename pl050_keyboard_init() to pl050_kbd_init() Mark Cave-Ayland
@ 2022-07-04 13:12   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:12 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:40, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This is for consistency with all of the other devices that use the PS2 keyboard
> device.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/input/pl050.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/input/pl050.c b/hw/input/pl050.c
> index c7980b6ed7..8e32b8ed46 100644
> --- a/hw/input/pl050.c
> +++ b/hw/input/pl050.c
> @@ -166,7 +166,7 @@ static void pl050_realize(DeviceState *dev, Error **errp)
>                            qdev_get_gpio_in_named(dev, "ps2-input-irq", 0));
>  }
>
> -static void pl050_keyboard_init(Object *obj)
> +static void pl050_kbd_init(Object *obj)
>  {
>      PL050State *s = PL050(obj);
>
> @@ -183,7 +183,7 @@ static void pl050_mouse_init(Object *obj)
>  static const TypeInfo pl050_kbd_info = {
>      .name          = "pl050_keyboard",
>      .parent        = TYPE_PL050,
> -    .instance_init = pl050_keyboard_init,
> +    .instance_init = pl050_kbd_init,
>  };

It's a static function so the name doesn't matter much, but
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 03/40] pl050: change PL050State dev pointer from void to PS2State
  2022-06-29 12:39 ` [PATCH 03/40] pl050: change PL050State dev pointer from void to PS2State Mark Cave-Ayland
@ 2022-07-04 13:14   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:14 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:40, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This allows the compiler to enforce that the PS2 device pointer is always of
> type PS2State. Update the name of the pointer from dev to ps2dev to emphasise
> this type change.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 04/40] pl050: introduce new PL050_KBD_DEVICE QOM type
  2022-06-29 12:39 ` [PATCH 04/40] pl050: introduce new PL050_KBD_DEVICE QOM type Mark Cave-Ayland
@ 2022-07-04 13:15   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:15 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:40, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This will be soon be used to hold the underlying PS2_KBD_DEVICE object.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/input/pl050.c         | 3 ++-
>  include/hw/input/pl050.h | 7 +++++++
>  2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/hw/input/pl050.c b/hw/input/pl050.c
> index 0d91b0eaea..7f4ac99081 100644
> --- a/hw/input/pl050.c
> +++ b/hw/input/pl050.c
> @@ -182,9 +182,10 @@ static void pl050_mouse_init(Object *obj)
>  }
>
>  static const TypeInfo pl050_kbd_info = {
> -    .name          = "pl050_keyboard",
> +    .name          = TYPE_PL050_KBD_DEVICE,
>      .parent        = TYPE_PL050,
>      .instance_init = pl050_kbd_init,
> +    .instance_size = sizeof(PL050KbdState),
>  };

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

thanks
-- PMM


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

* Re: [PATCH 05/40] pl050: introduce new PL050_MOUSE_DEVICE QOM type
  2022-06-29 12:39 ` [PATCH 05/40] pl050: introduce new PL050_MOUSE_DEVICE " Mark Cave-Ayland
@ 2022-07-04 13:15   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:15 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:40, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This will be soon be used to hold the underlying PS2_MOUSE_DEVICE object.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---

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

thanks
-- PMM


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

* Re: [PATCH 06/40] pl050: move logic from pl050_realize() to pl050_init()
  2022-06-29 12:39 ` [PATCH 06/40] pl050: move logic from pl050_realize() to pl050_init() Mark Cave-Ayland
@ 2022-07-04 13:16   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:16 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:40, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> The logic for initialising the register memory region and the sysbus output IRQ
> does not depend upon any device properties and so can be moved from
> pl050_realize() to pl050_init().
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

One of these days we must figure out and write down some conventions
for init vs realize...

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

thanks
-- PMM


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

* Re: [PATCH 07/40] pl050: introduce PL050DeviceClass for the PL050 device
  2022-06-29 12:39 ` [PATCH 07/40] pl050: introduce PL050DeviceClass for the PL050 device Mark Cave-Ayland
@ 2022-07-04 13:17   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:17 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:40, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This will soon be used to store the reference to the PL050 parent device
> for PL050_KBD_DEVICE and PL050_MOUSE_DEVICE.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 08/40] pl050: introduce pl050_kbd_class_init() and pl050_kbd_realize()
  2022-06-29 12:39 ` [PATCH 08/40] pl050: introduce pl050_kbd_class_init() and pl050_kbd_realize() Mark Cave-Ayland
@ 2022-07-04 13:17   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:17 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Introduce a new pl050_kbd_class_init() function containing a call to
> device_class_set_parent_realize() which calls a new pl050_kbd_realize()
> function to initialise the PS2 keyboard device.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 09/40] pl050: introduce pl050_mouse_class_init() and pl050_mouse_realize()
  2022-06-29 12:39 ` [PATCH 09/40] pl050: introduce pl050_mouse_class_init() and pl050_mouse_realize() Mark Cave-Ayland
@ 2022-07-04 13:18   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:18 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Introduce a new pl050_mouse_class_init() function containing a call to
> device_class_set_parent_realize() which calls a new pl050_mouse_realize()
> function to initialise the PS2 mouse device.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---

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

thanks
-- PMM


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

* Re: [PATCH 10/40] pl050: don't use legacy ps2_kbd_init() function
  2022-06-29 12:39 ` [PATCH 10/40] pl050: don't use legacy ps2_kbd_init() function Mark Cave-Ayland
@ 2022-07-04 13:20   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:20 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Instantiate the PS2 keyboard device within PL050KbdState using
> object_initialize_child() in pl050_kbd_init() and realize it in
> pl050_kbd_realize() accordingly.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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

thanks
-- PMM


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

* Re: [PATCH 11/40] pl050: don't use legacy ps2_mouse_init() function
  2022-06-29 12:39 ` [PATCH 11/40] pl050: don't use legacy ps2_mouse_init() function Mark Cave-Ayland
@ 2022-07-04 13:20   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:20 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Instantiate the PS2 mouse device within PL050MouseState using
> object_initialize_child() in pl050_mouse_init() and realize it in
> pl050_mouse_realize() accordingly.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 12/40] lasips2: don't use vmstate_register() in lasips2_realize()
  2022-06-29 12:39 ` [PATCH 12/40] lasips2: don't use vmstate_register() in lasips2_realize() Mark Cave-Ayland
@ 2022-07-04 13:20   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:20 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Since lasips2 is a qdev device then vmstate_ps2_mouse can be registered using
> the DeviceClass vmsd field instead.
>
> Note that due to the use of the base parameter in the original vmstate_register()
> function call, this is actually a migration break for the HPPA B160L machine.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 13/40] lasips2: remove the qdev base property and the lasips2_properties array
  2022-06-29 12:39 ` [PATCH 13/40] lasips2: remove the qdev base property and the lasips2_properties array Mark Cave-Ayland
@ 2022-07-04 13:21   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:21 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> The base property was only needed for use by vmstate_register() in order to
> preserve migration compatibility. Now that the lasips2 migration state is
> registered through the DeviceClass vmsd field, the base property and also
> the lasips2_properties array can be removed completely as they are no longer
> required.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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

thanks
-- PMM


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

* Re: [PATCH 14/40] lasips2: remove legacy lasips2_initfn() function
  2022-06-29 12:40 ` [PATCH 14/40] lasips2: remove legacy lasips2_initfn() function Mark Cave-Ayland
@ 2022-07-04 13:22   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:22 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> There is only one user of the legacy lasips2_initfn() function which is in
> machine_hppa_init(), so inline its functionality into machine_hppa_init() and
> then remove it.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 15/40] lasips2: change LASIPS2State dev pointer from void to PS2State
  2022-06-29 12:40 ` [PATCH 15/40] lasips2: change LASIPS2State dev pointer from void to PS2State Mark Cave-Ayland
@ 2022-07-04 13:22   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:22 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This allows the compiler to enforce that the PS2 device pointer is always of
> type PS2State. Update the name of the pointer from dev to ps2dev to emphasise
> this type change.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/input/lasips2.c         | 16 ++++++++--------
>  include/hw/input/lasips2.h |  3 ++-
>  2 files changed, 10 insertions(+), 9 deletions(-)


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

thanks
-- PMM


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

* Re: [PATCH 17/40] lasips2: introduce new LASIPS2_KBD_PORT QOM type
  2022-06-29 12:40 ` [PATCH 17/40] lasips2: introduce new LASIPS2_KBD_PORT QOM type Mark Cave-Ayland
@ 2022-07-04 13:22   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:22 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This will be soon be used to hold the underlying PS2_KBD_DEVICE object.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 16/40] lasips2: QOMify LASIPS2Port
  2022-06-29 12:40 ` [PATCH 16/40] lasips2: QOMify LASIPS2Port Mark Cave-Ayland
@ 2022-07-04 13:23   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:23 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This becomes an abstract QOM type which will be a parent type for separate
> keyboard and mouse port types.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/input/lasips2.c         |  8 ++++++++
>  include/hw/input/lasips2.h | 14 ++++++++++----
>  2 files changed, 18 insertions(+), 4 deletions(-)

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

thanks
-- PMM


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

* Re: [PATCH 18/40] lasips2: introduce new LASIPS2_MOUSE_PORT QOM type
  2022-06-29 12:40 ` [PATCH 18/40] lasips2: introduce new LASIPS2_MOUSE_PORT " Mark Cave-Ayland
@ 2022-07-04 13:23   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:23 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This will be soon be used to hold the underlying PS2_MOUSE_DEVICE object.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


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

thanks
-- PMM


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

* Re: [PATCH 19/40] lasips2: move keyboard port initialisation to new lasips2_kbd_port_init() function
  2022-06-29 12:40 ` [PATCH 19/40] lasips2: move keyboard port initialisation to new lasips2_kbd_port_init() function Mark Cave-Ayland
@ 2022-07-04 13:24   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:24 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Move the initialisation of the keyboard port from lasips2_init() to
> a new lasips2_kbd_port_init() function which will be invoked using
> object_initialize_child() during the LASIPS2 device init.
>
> Update LASIPS2State so that it now holds the new LASIPS2KbdPort child object and
> ensure that it is realised in lasips2_realize().
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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

thanks
-- PMM


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

* Re: [PATCH 20/40] lasips2: move mouse port initialisation to new lasips2_mouse_port_init() function
  2022-06-29 12:40 ` [PATCH 20/40] lasips2: move mouse port initialisation to new lasips2_mouse_port_init() function Mark Cave-Ayland
@ 2022-07-04 13:25   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:25 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Move the initialisation of the mouse port from lasips2_init() to
> a new lasips2_mouse_port_init() function which will be invoked using
> object_initialize_child() during the LASIPS2 device init.
>
> Update LASIPS2State so that it now holds the new LASIPS2MousePort child object and
> ensure that it is realised in lasips2_realize().
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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

thanks
-- PMM


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

* Re: [PATCH 21/40] lasips2: introduce lasips2_kbd_port_class_init() and lasips2_kbd_port_realize()
  2022-06-29 12:40 ` [PATCH 21/40] lasips2: introduce lasips2_kbd_port_class_init() and lasips2_kbd_port_realize() Mark Cave-Ayland
@ 2022-07-04 13:25   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:25 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Introduce a new lasips2_kbd_port_class_init() function which uses a new
> lasips2_kbd_port_realize() function to initialise the PS2 keyboard device.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---

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

thanks
-- PMM


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

* Re: [PATCH 22/40] lasips2: introduce lasips2_mouse_port_class_init() and lasips2_mouse_port_realize()
  2022-06-29 12:40 ` [PATCH 22/40] lasips2: introduce lasips2_mouse_port_class_init() and lasips2_mouse_port_realize() Mark Cave-Ayland
@ 2022-07-04 13:25   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:25 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Introduce a new lasips2_mouse_port_class_init() function which uses a new
> lasips2_mouse_port_realize() function to initialise the PS2 mouse device.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 23/40] lasips2: rename LASIPS2Port irq field to birq
  2022-06-29 12:40 ` [PATCH 23/40] lasips2: rename LASIPS2Port irq field to birq Mark Cave-Ayland
@ 2022-07-04 13:25   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:25 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> The existing boolean irq field in LASIPS2Port will soon be replaced by a proper
> qemu_irq, so rename the field to birq to allow the upcoming qemu_irq to use the
> irq name.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---

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

thanks
-- PMM


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

* Re: [PATCH 24/40] lasips2: introduce port IRQ and new lasips2_port_init() function
  2022-06-29 12:40 ` [PATCH 24/40] lasips2: introduce port IRQ and new lasips2_port_init() function Mark Cave-Ayland
@ 2022-07-04 13:26   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:26 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Introduce a new lasips2_port_init() QOM init function for the LASIPS2_PORT type
> and use it to initialise a new gpio for use as a port IRQ. Add a new qemu_irq
> representing the gpio as a new irq field within LASIPS2Port.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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

thanks
-- PMM


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

* Re: [PATCH 25/40] lasips2: introduce LASIPS2PortDeviceClass for the LASIPS2_PORT device
  2022-06-29 12:40 ` [PATCH 25/40] lasips2: introduce LASIPS2PortDeviceClass for the LASIPS2_PORT device Mark Cave-Ayland
@ 2022-07-04 13:26   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:26 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This will soon be used to store the reference to the LASIPS2_PORT parent device
> for LASIPS2_KBD_PORT and LASIPS2_MOUSE_PORT.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---

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

thanks
-- PMM


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

* Re: [PATCH 26/40] lasips2: add named input gpio to port for downstream PS2 device IRQ
  2022-06-29 12:40 ` [PATCH 26/40] lasips2: add named input gpio to port for downstream PS2 device IRQ Mark Cave-Ayland
@ 2022-07-04 13:27   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:27 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> The named input gpio is to be connected to the IRQ output of the downstream
> PS2 device and used to drive the port IRQ. Initialise the named input gpio
> in lasips2_port_init() and add new lasips2_port_class_init() and
> lasips2_port_realize() functions to connect the PS2 device output gpio to
> the new named input gpio.
>
> Note that the reference to lasips2_port_realize() is stored in
> LASIPS2PortDeviceClass but not yet used.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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

thanks
-- PMM


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

* Re: [PATCH 27/40] lasips2: add named input gpio to handle incoming port IRQs
  2022-06-29 12:40 ` [PATCH 27/40] lasips2: add named input gpio to handle incoming port IRQs Mark Cave-Ayland
@ 2022-07-04 13:27   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:27 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> The LASIPS2 device named input gpio is soon to be connected to the port output
> IRQs. Add a new int_status field to LASIPS2State which is a bitmap representing
> the port input IRQ status.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/input/lasips2.c         | 15 +++++++++++++++
>  include/hw/input/lasips2.h |  1 +
>  2 files changed, 16 insertions(+)
>
> diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
> index ec1661a8f1..013d891af6 100644
> --- a/hw/input/lasips2.c
> +++ b/hw/input/lasips2.c
> @@ -125,6 +125,19 @@ static void lasips2_update_irq(LASIPS2State *s)
>                           s->mouse_port.parent_obj.birq);
>  }
>
> +static void lasips2_set_irq(void *opaque, int n, int level)
> +{
> +    LASIPS2State *s = LASIPS2(opaque);
> +
> +    if (level) {
> +        s->int_status |= BIT(n);
> +    } else {
> +        s->int_status &= ~BIT(n);
> +    }
> +
> +    lasips2_update_irq(s);
> +}
> +
>  static void lasips2_reg_write(void *opaque, hwaddr addr, uint64_t val,
>                                unsigned size)
>  {
> @@ -303,6 +316,8 @@ static void lasips2_init(Object *obj)
>                              "ps2-kbd-input-irq", 1);
>      qdev_init_gpio_in_named(DEVICE(obj), lasips2_set_mouse_irq,
>                              "ps2-mouse-input-irq", 1);
> +    qdev_init_gpio_in_named(DEVICE(obj), lasips2_set_irq,
> +                            "lasips2-port-input-irq", 2);
>  }
>
>  static void lasips2_class_init(ObjectClass *klass, void *data)
> diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
> index 35e0aa26eb..b79febf64b 100644
> --- a/include/hw/input/lasips2.h
> +++ b/include/hw/input/lasips2.h
> @@ -69,6 +69,7 @@ struct LASIPS2State {
>
>      LASIPS2KbdPort kbd_port;
>      LASIPS2MousePort mouse_port;
> +    uint8_t int_status;
>      qemu_irq irq;

Doesn't this new data field need to be migrated in a vmstate ?

>  };
>

-- PMM


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

* Re: [PATCH 28/40] lasips2: switch to using port-based IRQs
  2022-06-29 12:40 ` [PATCH 28/40] lasips2: switch to using port-based IRQs Mark Cave-Ayland
@ 2022-07-04 13:28   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:28 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Now we can implement port-based IRQs by wiring the PS2 device IRQs to the
> LASI2Port named input gpios rather than directly to the LASIPS2 device, and
> generate the LASIPS2 output IRQ from the int_status bitmap representing the
> individual port IRQs instead of the birq boolean.
>
> This enables us to remove the separate PS2 keyboard and PS2 mouse named input
> gpios from the LASIPS2 device and simplify the register implementation to
> drive the port IRQ using qemu_set_irq() rather than accessing the LASIPS2
> device IRQs directly. As a consequence the IRQ level logic in lasips2_set_irq()
> can also be simplified accordingly.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/input/lasips2.c         | 59 ++++++++++++--------------------------
>  include/hw/input/lasips2.h |  7 ++---
>  2 files changed, 20 insertions(+), 46 deletions(-)
>
> diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
> index 013d891af6..5ceb38c1af 100644
> --- a/hw/input/lasips2.c
> +++ b/hw/input/lasips2.c
> @@ -42,10 +42,8 @@ static const VMStateDescription vmstate_lasips2 = {
>      .fields = (VMStateField[]) {
>          VMSTATE_UINT8(kbd_port.parent_obj.control, LASIPS2State),
>          VMSTATE_UINT8(kbd_port.parent_obj.id, LASIPS2State),
> -        VMSTATE_BOOL(kbd_port.parent_obj.birq, LASIPS2State),
>          VMSTATE_UINT8(mouse_port.parent_obj.control, LASIPS2State),
>          VMSTATE_UINT8(mouse_port.parent_obj.id, LASIPS2State),
> -        VMSTATE_BOOL(mouse_port.parent_obj.birq, LASIPS2State),
>          VMSTATE_END_OF_LIST()
>      }

You should bump the version number when you remove fields, so
that the error message on a mismatched-migration is clearer.


-- PMM


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

* Re: [PATCH 29/40] lasips2: rename LASIPS2Port parent pointer to lasips2
  2022-06-29 12:40 ` [PATCH 29/40] lasips2: rename LASIPS2Port parent pointer to lasips2 Mark Cave-Ayland
@ 2022-07-04 13:28   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:28 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This makes it clearer that the pointer is a reference to the LASIPS2 container
> device rather than an implied part of the QOM hierarchy.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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

thanks
-- PMM


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

* Re: [PATCH 30/40] lasips2: standardise on lp name for LASIPS2Port variables
  2022-06-29 12:40 ` [PATCH 30/40] lasips2: standardise on lp name for LASIPS2Port variables Mark Cave-Ayland
@ 2022-07-04 13:29   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:29 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This is shorter to type and keeps the naming convention consistent within the
> LASIPS2 device.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---

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

thanks
-- PMM


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

* Re: [PATCH 31/40] lasips2: switch register memory region to DEVICE_BIG_ENDIAN
  2022-06-29 12:40 ` [PATCH 31/40] lasips2: switch register memory region to DEVICE_BIG_ENDIAN Mark Cave-Ayland
@ 2022-07-04 13:29   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:29 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> The LASI device (and so also the LASIPS2 device) are only used for the HPPA
> B160L machine which is a big endian architecture.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/input/lasips2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
> index 09d909c843..7bf6077b58 100644
> --- a/hw/input/lasips2.c
> +++ b/hw/input/lasips2.c
> @@ -245,7 +245,7 @@ static const MemoryRegionOps lasips2_reg_ops = {
>          .min_access_size = 1,
>          .max_access_size = 4,
>      },
> -    .endianness = DEVICE_NATIVE_ENDIAN,
> +    .endianness = DEVICE_BIG_ENDIAN,
>  };
>
>  static void lasips2_realize(DeviceState *dev, Error **errp)
> --
> 2.30.2
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 32/40] lasips2: don't use legacy ps2_kbd_init() function
  2022-06-29 12:40 ` [PATCH 32/40] lasips2: don't use legacy ps2_kbd_init() function Mark Cave-Ayland
@ 2022-07-04 13:29   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:29 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Instantiate the PS2 keyboard device within LASIPS2KbdPort using
> object_initialize_child() in lasips2_kbd_port_init() and realize it in
> lasips2_kbd_port_realize() accordingly.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---

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

thanks
-- PMM


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

* Re: [PATCH 33/40] lasips2: don't use legacy ps2_mouse_init() function
  2022-06-29 12:40 ` [PATCH 33/40] lasips2: don't use legacy ps2_mouse_init() function Mark Cave-Ayland
@ 2022-07-04 13:30   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:30 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Instantiate the PS2 mouse device within LASIPS2MousePort using
> object_initialize_child() in lasips2_mouse_port_init() and realize it in
> lasips2_mouse_port_realize() accordingly.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---

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

thanks
-- PMM


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

* Re: [PATCH 35/40] pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the I8042_MMIO device
  2022-06-29 12:40 ` [PATCH 35/40] pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the I8042_MMIO device Mark Cave-Ayland
@ 2022-07-04 13:35   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:35 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This enables us to register the VMStateDescription using the DeviceClass vmsd
> property rather than having to call vmstate_register() from i8042_mmio_realize().
>
> Note that this is a migration break for the MIPS jazz machine which is the only
> user of the I8042_MMIO device.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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

thanks
-- PMM


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

* Re: [PATCH 36/40] pckbd: don't use legacy ps2_kbd_init() function
  2022-06-29 12:40 ` [PATCH 36/40] pckbd: don't use legacy ps2_kbd_init() function Mark Cave-Ayland
@ 2022-07-04 13:36   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:36 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Instantiate the PS2 keyboard device within KBDState using
> object_initialize_child() in i8042_initfn() and i8042_mmio_init() and realize
> it in i8042_realizefn() and i8042_mmio_realize() accordingly.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---

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

thanks
-- PMM


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

* Re: [PATCH 37/40] ps2: remove unused legacy ps2_kbd_init() function
  2022-06-29 12:40 ` [PATCH 37/40] ps2: remove unused " Mark Cave-Ayland
@ 2022-07-04 13:37   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:37 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Now that the legacy ps2_kbd_init() function is no longer used, it can be completely
> removed along with its associated trace-event.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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

thanks
-- PMM


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

* Re: [PATCH 38/40] pckbd: don't use legacy ps2_mouse_init() function
  2022-06-29 12:40 ` [PATCH 38/40] pckbd: don't use legacy ps2_mouse_init() function Mark Cave-Ayland
@ 2022-07-04 13:37   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:37 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:42, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Instantiate the PS2 mouse device within KBDState using
> object_initialize_child() in i8042_initfn() and i8042_mmio_init() and realize
> it in i8042_realizefn() and i8042_mmio_realize() accordingly.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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

thanks
-- PMM


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

* Re: [PATCH 39/40] ps2: remove unused legacy ps2_mouse_init() function
  2022-06-29 12:40 ` [PATCH 39/40] ps2: remove unused " Mark Cave-Ayland
@ 2022-07-04 13:37   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:37 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:42, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Now that the legacy ps2_mouse_init() function is no longer used, it can be completely
> removed along with its associated trace-event.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---

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

thanks
-- PMM


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

* Re: [PATCH 40/40] pckbd: remove legacy i8042_mm_init() function
  2022-06-29 12:40 ` [PATCH 40/40] pckbd: remove legacy i8042_mm_init() function Mark Cave-Ayland
@ 2022-07-04 13:38   ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:38 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:42, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> This legacy function is only used during the initialisation of the MIPS magnum
> machine, so inline its functionality directly into mips_jazz_init() and then
> remove it.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

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

thanks
-- PMM


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

* Re: [PATCH 34/40] lasips2: update VMStateDescription for LASIPS2 device
  2022-06-29 12:40 ` [PATCH 34/40] lasips2: update VMStateDescription for LASIPS2 device Mark Cave-Ayland
@ 2022-07-04 13:38   ` Peter Maydell
  2022-07-05  6:48     ` Mark Cave-Ayland
  0 siblings, 1 reply; 84+ messages in thread
From: Peter Maydell @ 2022-07-04 13:38 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Since this series has already introduced a migration break for the HPPA B160L
> machine, we can use this opportunity to improve the VMStateDescription for
> the LASIPS2 device.
>
> Add the new int_status field to the VMStateDescription and remodel the ports
> as separate VMSTATE_STRUCT instances.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/input/lasips2.c | 25 +++++++++++++++++++------
>  1 file changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
> index e602e3c986..ea7c07a2ba 100644
> --- a/hw/input/lasips2.c
> +++ b/hw/input/lasips2.c
> @@ -35,15 +35,28 @@
>  #include "qapi/error.h"
>
>
> +static const VMStateDescription vmstate_lasips2_port = {
> +    .name = "lasips2-port",
> +    .version_id = 1,
> +    .minimum_version_id = 1,
> +    .fields = (VMStateField[]) {
> +        VMSTATE_UINT8(control, LASIPS2Port),
> +        VMSTATE_UINT8(buf, LASIPS2Port),
> +        VMSTATE_BOOL(loopback_rbne, LASIPS2Port),
> +        VMSTATE_END_OF_LIST()
> +    }
> +};
> +
>  static const VMStateDescription vmstate_lasips2 = {
>      .name = "lasips2",
> -    .version_id = 0,
> -    .minimum_version_id = 0,
> +    .version_id = 1,
> +    .minimum_version_id = 1,
>      .fields = (VMStateField[]) {
> -        VMSTATE_UINT8(kbd_port.parent_obj.control, LASIPS2State),
> -        VMSTATE_UINT8(kbd_port.parent_obj.id, LASIPS2State),
> -        VMSTATE_UINT8(mouse_port.parent_obj.control, LASIPS2State),
> -        VMSTATE_UINT8(mouse_port.parent_obj.id, LASIPS2State),
> +        VMSTATE_UINT8(int_status, LASIPS2State),
> +        VMSTATE_STRUCT(kbd_port.parent_obj, LASIPS2State, 1,
> +                       vmstate_lasips2_port, LASIPS2Port),
> +        VMSTATE_STRUCT(mouse_port.parent_obj, LASIPS2State, 1,
> +                       vmstate_lasips2_port, LASIPS2Port),
>          VMSTATE_END_OF_LIST()
>      }
>  };

The set of things we were migrating and the set of
things we now migrate don't seem to line up ?

-- PMM


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

* Re: [PATCH 34/40] lasips2: update VMStateDescription for LASIPS2 device
  2022-07-04 13:38   ` Peter Maydell
@ 2022-07-05  6:48     ` Mark Cave-Ayland
  2022-07-05  8:18       ` Peter Maydell
  0 siblings, 1 reply; 84+ messages in thread
From: Mark Cave-Ayland @ 2022-07-05  6:48 UTC (permalink / raw)
  To: Peter Maydell
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On 04/07/2022 14:38, Peter Maydell wrote:

> On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
> <mark.cave-ayland@ilande.co.uk> wrote:
>>
>> Since this series has already introduced a migration break for the HPPA B160L
>> machine, we can use this opportunity to improve the VMStateDescription for
>> the LASIPS2 device.
>>
>> Add the new int_status field to the VMStateDescription and remodel the ports
>> as separate VMSTATE_STRUCT instances.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>>   hw/input/lasips2.c | 25 +++++++++++++++++++------
>>   1 file changed, 19 insertions(+), 6 deletions(-)
>>
>> diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
>> index e602e3c986..ea7c07a2ba 100644
>> --- a/hw/input/lasips2.c
>> +++ b/hw/input/lasips2.c
>> @@ -35,15 +35,28 @@
>>   #include "qapi/error.h"
>>
>>
>> +static const VMStateDescription vmstate_lasips2_port = {
>> +    .name = "lasips2-port",
>> +    .version_id = 1,
>> +    .minimum_version_id = 1,
>> +    .fields = (VMStateField[]) {
>> +        VMSTATE_UINT8(control, LASIPS2Port),
>> +        VMSTATE_UINT8(buf, LASIPS2Port),
>> +        VMSTATE_BOOL(loopback_rbne, LASIPS2Port),
>> +        VMSTATE_END_OF_LIST()
>> +    }
>> +};
>> +
>>   static const VMStateDescription vmstate_lasips2 = {
>>       .name = "lasips2",
>> -    .version_id = 0,
>> -    .minimum_version_id = 0,
>> +    .version_id = 1,
>> +    .minimum_version_id = 1,
>>       .fields = (VMStateField[]) {
>> -        VMSTATE_UINT8(kbd_port.parent_obj.control, LASIPS2State),
>> -        VMSTATE_UINT8(kbd_port.parent_obj.id, LASIPS2State),
>> -        VMSTATE_UINT8(mouse_port.parent_obj.control, LASIPS2State),
>> -        VMSTATE_UINT8(mouse_port.parent_obj.id, LASIPS2State),
>> +        VMSTATE_UINT8(int_status, LASIPS2State),
>> +        VMSTATE_STRUCT(kbd_port.parent_obj, LASIPS2State, 1,
>> +                       vmstate_lasips2_port, LASIPS2Port),
>> +        VMSTATE_STRUCT(mouse_port.parent_obj, LASIPS2State, 1,
>> +                       vmstate_lasips2_port, LASIPS2Port),
>>           VMSTATE_END_OF_LIST()
>>       }
>>   };
> 
> The set of things we were migrating and the set of
> things we now migrate don't seem to line up ?

Yeah I should probably have documented this better in the commit message. The 
existing VMStateDescription isn't correct since it misses both the buf and 
loopback_rbne fields which are accessed across port reads and writes, and the port id 
is not required because it is hardcoded to 0 for the keyboard port and 1 for the 
mouse port.

Rather than have the extra code churn throughout the series, I went for doing the 
minimum to vmstate_lasips2 to make the patch compile and then fix up everything 
(including add the new int_status bitmap) in this one patch. I think this is fine 
since as we're introducing a migration break in the series, there are no concerns 
over backward compatibility.

Would an updated description for this commit message be sufficient? A quick skim over 
the emails indicates that the only queries during review were related to the handling 
of the VMStateDescription.


ATB,

Mark.


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

* Re: [PATCH 34/40] lasips2: update VMStateDescription for LASIPS2 device
  2022-07-05  6:48     ` Mark Cave-Ayland
@ 2022-07-05  8:18       ` Peter Maydell
  0 siblings, 0 replies; 84+ messages in thread
From: Peter Maydell @ 2022-07-05  8:18 UTC (permalink / raw)
  To: Mark Cave-Ayland
  Cc: richard.henderson, deller, svens, mst, pbonzini, hpoussin,
	aleksandar.rikalo, f4bug, qemu-devel, qemu-arm

On Tue, 5 Jul 2022 at 07:48, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> On 04/07/2022 14:38, Peter Maydell wrote:
>
> > On Wed, 29 Jun 2022 at 13:41, Mark Cave-Ayland
> > <mark.cave-ayland@ilande.co.uk> wrote:
> >>
> >> Since this series has already introduced a migration break for the HPPA B160L
> >> machine, we can use this opportunity to improve the VMStateDescription for
> >> the LASIPS2 device.
> >>
> >> Add the new int_status field to the VMStateDescription and remodel the ports
> >> as separate VMSTATE_STRUCT instances.
> >>
> >> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> >> ---
> >>   hw/input/lasips2.c | 25 +++++++++++++++++++------
> >>   1 file changed, 19 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
> >> index e602e3c986..ea7c07a2ba 100644
> >> --- a/hw/input/lasips2.c
> >> +++ b/hw/input/lasips2.c
> >> @@ -35,15 +35,28 @@
> >>   #include "qapi/error.h"
> >>
> >>
> >> +static const VMStateDescription vmstate_lasips2_port = {
> >> +    .name = "lasips2-port",
> >> +    .version_id = 1,
> >> +    .minimum_version_id = 1,
> >> +    .fields = (VMStateField[]) {
> >> +        VMSTATE_UINT8(control, LASIPS2Port),
> >> +        VMSTATE_UINT8(buf, LASIPS2Port),
> >> +        VMSTATE_BOOL(loopback_rbne, LASIPS2Port),
> >> +        VMSTATE_END_OF_LIST()
> >> +    }
> >> +};
> >> +
> >>   static const VMStateDescription vmstate_lasips2 = {
> >>       .name = "lasips2",
> >> -    .version_id = 0,
> >> -    .minimum_version_id = 0,
> >> +    .version_id = 1,
> >> +    .minimum_version_id = 1,
> >>       .fields = (VMStateField[]) {
> >> -        VMSTATE_UINT8(kbd_port.parent_obj.control, LASIPS2State),
> >> -        VMSTATE_UINT8(kbd_port.parent_obj.id, LASIPS2State),
> >> -        VMSTATE_UINT8(mouse_port.parent_obj.control, LASIPS2State),
> >> -        VMSTATE_UINT8(mouse_port.parent_obj.id, LASIPS2State),
> >> +        VMSTATE_UINT8(int_status, LASIPS2State),
> >> +        VMSTATE_STRUCT(kbd_port.parent_obj, LASIPS2State, 1,
> >> +                       vmstate_lasips2_port, LASIPS2Port),
> >> +        VMSTATE_STRUCT(mouse_port.parent_obj, LASIPS2State, 1,
> >> +                       vmstate_lasips2_port, LASIPS2Port),
> >>           VMSTATE_END_OF_LIST()
> >>       }
> >>   };
> >
> > The set of things we were migrating and the set of
> > things we now migrate don't seem to line up ?
>
> Yeah I should probably have documented this better in the commit message. The
> existing VMStateDescription isn't correct since it misses both the buf and
> loopback_rbne fields which are accessed across port reads and writes, and the port id
> is not required because it is hardcoded to 0 for the keyboard port and 1 for the
> mouse port.
>
> Rather than have the extra code churn throughout the series, I went for doing the
> minimum to vmstate_lasips2 to make the patch compile and then fix up everything
> (including add the new int_status bitmap) in this one patch. I think this is fine
> since as we're introducing a migration break in the series, there are no concerns
> over backward compatibility.
>
> Would an updated description for this commit message be sufficient? A quick skim over
> the emails indicates that the only queries during review were related to the handling
> of the VMStateDescription.

Yeah, if you comment this in the relevant commit messages that should be
good enough.

-- PMM


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

end of thread, other threads:[~2022-07-05  8:34 UTC | newest]

Thread overview: 84+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 12:39 [PATCH 00/40] PS2 device QOMification - part 2 Mark Cave-Ayland
2022-06-29 12:39 ` [PATCH 01/40] pl050: move PL050State from pl050.c to new pl050.h header file Mark Cave-Ayland
2022-07-04 13:12   ` Peter Maydell
2022-06-29 12:39 ` [PATCH 02/40] pl050: rename pl050_keyboard_init() to pl050_kbd_init() Mark Cave-Ayland
2022-07-04 13:12   ` Peter Maydell
2022-06-29 12:39 ` [PATCH 03/40] pl050: change PL050State dev pointer from void to PS2State Mark Cave-Ayland
2022-07-04 13:14   ` Peter Maydell
2022-06-29 12:39 ` [PATCH 04/40] pl050: introduce new PL050_KBD_DEVICE QOM type Mark Cave-Ayland
2022-07-04 13:15   ` Peter Maydell
2022-06-29 12:39 ` [PATCH 05/40] pl050: introduce new PL050_MOUSE_DEVICE " Mark Cave-Ayland
2022-07-04 13:15   ` Peter Maydell
2022-06-29 12:39 ` [PATCH 06/40] pl050: move logic from pl050_realize() to pl050_init() Mark Cave-Ayland
2022-07-04 13:16   ` Peter Maydell
2022-06-29 12:39 ` [PATCH 07/40] pl050: introduce PL050DeviceClass for the PL050 device Mark Cave-Ayland
2022-07-04 13:17   ` Peter Maydell
2022-06-29 12:39 ` [PATCH 08/40] pl050: introduce pl050_kbd_class_init() and pl050_kbd_realize() Mark Cave-Ayland
2022-07-04 13:17   ` Peter Maydell
2022-06-29 12:39 ` [PATCH 09/40] pl050: introduce pl050_mouse_class_init() and pl050_mouse_realize() Mark Cave-Ayland
2022-07-04 13:18   ` Peter Maydell
2022-06-29 12:39 ` [PATCH 10/40] pl050: don't use legacy ps2_kbd_init() function Mark Cave-Ayland
2022-07-04 13:20   ` Peter Maydell
2022-06-29 12:39 ` [PATCH 11/40] pl050: don't use legacy ps2_mouse_init() function Mark Cave-Ayland
2022-07-04 13:20   ` Peter Maydell
2022-06-29 12:39 ` [PATCH 12/40] lasips2: don't use vmstate_register() in lasips2_realize() Mark Cave-Ayland
2022-07-04 13:20   ` Peter Maydell
2022-06-29 12:39 ` [PATCH 13/40] lasips2: remove the qdev base property and the lasips2_properties array Mark Cave-Ayland
2022-07-04 13:21   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 14/40] lasips2: remove legacy lasips2_initfn() function Mark Cave-Ayland
2022-07-04 13:22   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 15/40] lasips2: change LASIPS2State dev pointer from void to PS2State Mark Cave-Ayland
2022-07-04 13:22   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 16/40] lasips2: QOMify LASIPS2Port Mark Cave-Ayland
2022-07-04 13:23   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 17/40] lasips2: introduce new LASIPS2_KBD_PORT QOM type Mark Cave-Ayland
2022-07-04 13:22   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 18/40] lasips2: introduce new LASIPS2_MOUSE_PORT " Mark Cave-Ayland
2022-07-04 13:23   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 19/40] lasips2: move keyboard port initialisation to new lasips2_kbd_port_init() function Mark Cave-Ayland
2022-07-04 13:24   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 20/40] lasips2: move mouse port initialisation to new lasips2_mouse_port_init() function Mark Cave-Ayland
2022-07-04 13:25   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 21/40] lasips2: introduce lasips2_kbd_port_class_init() and lasips2_kbd_port_realize() Mark Cave-Ayland
2022-07-04 13:25   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 22/40] lasips2: introduce lasips2_mouse_port_class_init() and lasips2_mouse_port_realize() Mark Cave-Ayland
2022-07-04 13:25   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 23/40] lasips2: rename LASIPS2Port irq field to birq Mark Cave-Ayland
2022-07-04 13:25   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 24/40] lasips2: introduce port IRQ and new lasips2_port_init() function Mark Cave-Ayland
2022-07-04 13:26   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 25/40] lasips2: introduce LASIPS2PortDeviceClass for the LASIPS2_PORT device Mark Cave-Ayland
2022-07-04 13:26   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 26/40] lasips2: add named input gpio to port for downstream PS2 device IRQ Mark Cave-Ayland
2022-07-04 13:27   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 27/40] lasips2: add named input gpio to handle incoming port IRQs Mark Cave-Ayland
2022-07-04 13:27   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 28/40] lasips2: switch to using port-based IRQs Mark Cave-Ayland
2022-07-04 13:28   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 29/40] lasips2: rename LASIPS2Port parent pointer to lasips2 Mark Cave-Ayland
2022-07-04 13:28   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 30/40] lasips2: standardise on lp name for LASIPS2Port variables Mark Cave-Ayland
2022-07-04 13:29   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 31/40] lasips2: switch register memory region to DEVICE_BIG_ENDIAN Mark Cave-Ayland
2022-07-04 13:29   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 32/40] lasips2: don't use legacy ps2_kbd_init() function Mark Cave-Ayland
2022-07-04 13:29   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 33/40] lasips2: don't use legacy ps2_mouse_init() function Mark Cave-Ayland
2022-07-04 13:30   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 34/40] lasips2: update VMStateDescription for LASIPS2 device Mark Cave-Ayland
2022-07-04 13:38   ` Peter Maydell
2022-07-05  6:48     ` Mark Cave-Ayland
2022-07-05  8:18       ` Peter Maydell
2022-06-29 12:40 ` [PATCH 35/40] pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the I8042_MMIO device Mark Cave-Ayland
2022-07-04 13:35   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 36/40] pckbd: don't use legacy ps2_kbd_init() function Mark Cave-Ayland
2022-07-04 13:36   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 37/40] ps2: remove unused " Mark Cave-Ayland
2022-07-04 13:37   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 38/40] pckbd: don't use legacy ps2_mouse_init() function Mark Cave-Ayland
2022-07-04 13:37   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 39/40] ps2: remove unused " Mark Cave-Ayland
2022-07-04 13:37   ` Peter Maydell
2022-06-29 12:40 ` [PATCH 40/40] pckbd: remove legacy i8042_mm_init() function Mark Cave-Ayland
2022-07-04 13:38   ` Peter Maydell
2022-07-01 19:37 ` [PATCH 00/40] PS2 device QOMification - part 2 Helge Deller

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.