[PATCH 00/50] PS2 device QOMification - part 1

Mark Cave-Ayland posted 50 patches 1 year, 11 months ago
There is a newer version of this series
hw/hppa/machine.c          |  11 +-
hw/input/lasips2.c         | 110 +++++---
hw/input/pckbd.c           | 321 ++++++++++++++++--------
hw/input/pl050.c           |  50 ++--
hw/input/ps2.c             | 500 +++++++++++++++++++++----------------
hw/mips/jazz.c             |  11 +-
include/hw/input/i8042.h   |  54 +++-
include/hw/input/lasips2.h |  27 +-
include/hw/input/ps2.h     |  79 +++++-
9 files changed, 775 insertions(+), 388 deletions(-)
[PATCH 00/50] PS2 device QOMification - part 1
Posted by Mark Cave-Ayland 1 year, 11 months ago
This series came about when looking at improving the LASI PS2 device for
the HPPA machine: there were improvements that I was keen to make, but
was restricted because the PS2 device(s) weren't QOMified.

Trying to do everything in a single patchset would be a very large series
indeed, so here is part 1 of the series which does the basic QOMification
process and consists of:

- QOMifying the basic PS2, PS2 keyboard and PS2 mouse types

- Moving any functionality that exists in a global device init function
  directly into the relevant device, so that all device behaviour is
  configured using qdev properties and QOM

- Introducing a new I8042_MMIO type for use by the MIPS magnum machine

- Switch all PS2 devices to use qdev gpios for IRQs instead of using the
  update_irq() callback function along with the update_arg opaque

Once this work has been done, a follow-up part 2 series will finish the
remainder of the work which involves i) improving the QOM object model
now QOMification is complete and ii) removing the legacy global device
init functions for PS2 and related devices.

Testing for this series has comprised of booting a machine with each type
of PS2 device and confirming that i) the machine responds to keypresses
when using a graphical console and ii) completing a successful migration
from a machine with this series applies back to a machine running latest
git master. The test machines I used were:

- qemu-system-x86_64 -M pc for the I8042 device
- qemu-system-hppa for the LASIPS2 device
- qemu-system-arm -M versatilepb for the PL050 device
- qemu-system-mips64el -M magnum for the I8042_MMIO device

Finally the QOM tree changes caused by QOMification of the PS2 devices
trigger a failure due to a bug in the bios-tables-test qtest for subtest
/x86_64/acpi/q35/viot. This can be fixed by applying the series at
https://lists.gnu.org/archive/html/qemu-devel/2022-05/msg04266.html
"hw/acpi/viot: generate stable VIOT ACPI tables" first.

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


Mark Cave-Ayland (50):
  ps2: checkpatch fixes
  ps2: QOMify PS2State
  ps2: QOMify PS2KbdState
  ps2: QOMify PS2MouseState
  ps2: move QOM type definitions from ps2.c to ps2.h
  ps2: improve function prototypes in ps2.c and ps2.h
  ps2: introduce PS2DeviceClass
  ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon
    ps2_common_reset()
  ps2: remove duplicate setting of scancode_set in ps2_kbd_init()
  ps2: implement ps2_kbd_realize() and use it to register
    ps2_keyboard_handler
  ps2: implement ps2_mouse_realize() and use it to register
    ps2_mouse_handler
  ps2: don't use vmstate_register() in ps2_kbd_init()
  ps2: don't use vmstate_register() in ps2_mouse_init()
  pl050: checkpatch fixes
  pl050: split pl050_update_irq() into separate pl050_set_irq() and
    pl050_update_irq() functions
  lasips2: spacing fixes
  lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq()
  pckbd: checkpatch fixes
  pckbd: move KBDState from pckbd.c to i8042.h
  pckbd: move ISAKBDState from pckbd.c to i8042.h
  pckbd: introduce new I8042_MMIO QOM type
  pckbd: implement i8042_mmio_reset() for I8042_MMIO device
  pckbd: add mask qdev property to I8042_MMIO device
  pckbd: add size qdev property to I8042_MMIO device
  pckbd: implement i8042_mmio_realize() function
  pckbd: implement i8042_mmio_init() function
  pckbd: alter i8042_mm_init() to return a I8042_MMIO device
  pckbd: move mapping of I8042_MMIO registers to MIPS magnum machine
  pckbd: more vmstate_register() from i8042_mm_init() to
    i8042_mmio_realize()
  pckbd: move ps2_kbd_init() and ps2_mouse_init() to
    i8042_mmio_realize()
  ps2: make ps2_raise_irq() function static
  ps2: use ps2_raise_irq() instead of calling update_irq() directly
  ps2: introduce ps2_lower_irq() instead of calling update_irq()
    directly
  ps2: add gpio for output IRQ and optionally use it in ps2_raise_irq()
    and ps2_lower_irq()
  pckbd: replace irq_kbd and irq_mouse with qemu_irq array in KBDState
  pl050: switch over from update_irq() function to PS2 device gpio
  lasips2: QOMify LASIPS2State
  lasips2: move lasips2 QOM types from lasips2.c to lasips2.h
  lasips2: rename lasips2_init() to lasips2_initfn() and update it to
    return the LASIPS2 device
  lasips2: implement lasips2_init() function
  lasips2: move mapping of LASIPS2 registers to HPPA machine
  lasips2: move initialisation of PS2 ports from lasi_initfn() to
    lasi_init()
  lasips2: add base property
  lasips2: implement lasips2_realize()
  lasips2: use qdev gpio for output IRQ
  lasips2: switch over from update_irq() function to PS2 device gpio
  pckbd: switch I8042_MMIO device from update_irq() function to PS2
    device gpio
  pckbd: add i8042_reset() function to I8042 device
  pckbd: switch I8042 device from update_irq() function to PS2 device
    gpio
  ps2: remove update_irq() function and update_arg parameter

 hw/hppa/machine.c          |  11 +-
 hw/input/lasips2.c         | 110 +++++---
 hw/input/pckbd.c           | 321 ++++++++++++++++--------
 hw/input/pl050.c           |  50 ++--
 hw/input/ps2.c             | 500 +++++++++++++++++++++----------------
 hw/mips/jazz.c             |  11 +-
 include/hw/input/i8042.h   |  54 +++-
 include/hw/input/lasips2.h |  27 +-
 include/hw/input/ps2.h     |  79 +++++-
 9 files changed, 775 insertions(+), 388 deletions(-)

-- 
2.20.1
Re: [PATCH 00/50] PS2 device QOMification - part 1
Posted by Philippe Mathieu-Daudé via 1 year, 11 months ago
On 22/5/22 20:17, Mark Cave-Ayland wrote:

> Mark Cave-Ayland (50):
>    ps2: checkpatch fixes
>    ps2: QOMify PS2State
>    ps2: QOMify PS2KbdState
>    ps2: QOMify PS2MouseState
>    ps2: move QOM type definitions from ps2.c to ps2.h
>    ps2: improve function prototypes in ps2.c and ps2.h
>    ps2: introduce PS2DeviceClass
>    ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon
>      ps2_common_reset()
>    ps2: remove duplicate setting of scancode_set in ps2_kbd_init()
>    ps2: implement ps2_kbd_realize() and use it to register
>      ps2_keyboard_handler
>    ps2: implement ps2_mouse_realize() and use it to register
>      ps2_mouse_handler
>    ps2: don't use vmstate_register() in ps2_kbd_init()
>    ps2: don't use vmstate_register() in ps2_mouse_init()
>    pl050: checkpatch fixes
>    pl050: split pl050_update_irq() into separate pl050_set_irq() and
>      pl050_update_irq() functions
>    lasips2: spacing fixes
>    lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq()
>    pckbd: checkpatch fixes
>    pckbd: move KBDState from pckbd.c to i8042.h
>    pckbd: move ISAKBDState from pckbd.c to i8042.h

Patches 1-20:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Re: [PATCH 00/50] PS2 device QOMification - part 1
Posted by Mark Cave-Ayland 1 year, 10 months ago
On 22/05/2022 19:17, Mark Cave-Ayland wrote:

> This series came about when looking at improving the LASI PS2 device for
> the HPPA machine: there were improvements that I was keen to make, but
> was restricted because the PS2 device(s) weren't QOMified.
> 
> Trying to do everything in a single patchset would be a very large series
> indeed, so here is part 1 of the series which does the basic QOMification
> process and consists of:
> 
> - QOMifying the basic PS2, PS2 keyboard and PS2 mouse types
> 
> - Moving any functionality that exists in a global device init function
>    directly into the relevant device, so that all device behaviour is
>    configured using qdev properties and QOM
> 
> - Introducing a new I8042_MMIO type for use by the MIPS magnum machine
> 
> - Switch all PS2 devices to use qdev gpios for IRQs instead of using the
>    update_irq() callback function along with the update_arg opaque
> 
> Once this work has been done, a follow-up part 2 series will finish the
> remainder of the work which involves i) improving the QOM object model
> now QOMification is complete and ii) removing the legacy global device
> init functions for PS2 and related devices.
> 
> Testing for this series has comprised of booting a machine with each type
> of PS2 device and confirming that i) the machine responds to keypresses
> when using a graphical console and ii) completing a successful migration
> from a machine with this series applies back to a machine running latest
> git master. The test machines I used were:
> 
> - qemu-system-x86_64 -M pc for the I8042 device
> - qemu-system-hppa for the LASIPS2 device
> - qemu-system-arm -M versatilepb for the PL050 device
> - qemu-system-mips64el -M magnum for the I8042_MMIO device
> 
> Finally the QOM tree changes caused by QOMification of the PS2 devices
> trigger a failure due to a bug in the bios-tables-test qtest for subtest
> /x86_64/acpi/q35/viot. This can be fixed by applying the series at
> https://lists.gnu.org/archive/html/qemu-devel/2022-05/msg04266.html
> "hw/acpi/viot: generate stable VIOT ACPI tables" first.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> 
> 
> Mark Cave-Ayland (50):
>    ps2: checkpatch fixes
>    ps2: QOMify PS2State
>    ps2: QOMify PS2KbdState
>    ps2: QOMify PS2MouseState
>    ps2: move QOM type definitions from ps2.c to ps2.h
>    ps2: improve function prototypes in ps2.c and ps2.h
>    ps2: introduce PS2DeviceClass
>    ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon
>      ps2_common_reset()
>    ps2: remove duplicate setting of scancode_set in ps2_kbd_init()
>    ps2: implement ps2_kbd_realize() and use it to register
>      ps2_keyboard_handler
>    ps2: implement ps2_mouse_realize() and use it to register
>      ps2_mouse_handler
>    ps2: don't use vmstate_register() in ps2_kbd_init()
>    ps2: don't use vmstate_register() in ps2_mouse_init()
>    pl050: checkpatch fixes
>    pl050: split pl050_update_irq() into separate pl050_set_irq() and
>      pl050_update_irq() functions
>    lasips2: spacing fixes
>    lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq()
>    pckbd: checkpatch fixes
>    pckbd: move KBDState from pckbd.c to i8042.h
>    pckbd: move ISAKBDState from pckbd.c to i8042.h
>    pckbd: introduce new I8042_MMIO QOM type
>    pckbd: implement i8042_mmio_reset() for I8042_MMIO device
>    pckbd: add mask qdev property to I8042_MMIO device
>    pckbd: add size qdev property to I8042_MMIO device
>    pckbd: implement i8042_mmio_realize() function
>    pckbd: implement i8042_mmio_init() function
>    pckbd: alter i8042_mm_init() to return a I8042_MMIO device
>    pckbd: move mapping of I8042_MMIO registers to MIPS magnum machine
>    pckbd: more vmstate_register() from i8042_mm_init() to
>      i8042_mmio_realize()
>    pckbd: move ps2_kbd_init() and ps2_mouse_init() to
>      i8042_mmio_realize()
>    ps2: make ps2_raise_irq() function static
>    ps2: use ps2_raise_irq() instead of calling update_irq() directly
>    ps2: introduce ps2_lower_irq() instead of calling update_irq()
>      directly
>    ps2: add gpio for output IRQ and optionally use it in ps2_raise_irq()
>      and ps2_lower_irq()
>    pckbd: replace irq_kbd and irq_mouse with qemu_irq array in KBDState
>    pl050: switch over from update_irq() function to PS2 device gpio
>    lasips2: QOMify LASIPS2State
>    lasips2: move lasips2 QOM types from lasips2.c to lasips2.h
>    lasips2: rename lasips2_init() to lasips2_initfn() and update it to
>      return the LASIPS2 device
>    lasips2: implement lasips2_init() function
>    lasips2: move mapping of LASIPS2 registers to HPPA machine
>    lasips2: move initialisation of PS2 ports from lasi_initfn() to
>      lasi_init()
>    lasips2: add base property
>    lasips2: implement lasips2_realize()
>    lasips2: use qdev gpio for output IRQ
>    lasips2: switch over from update_irq() function to PS2 device gpio
>    pckbd: switch I8042_MMIO device from update_irq() function to PS2
>      device gpio
>    pckbd: add i8042_reset() function to I8042 device
>    pckbd: switch I8042 device from update_irq() function to PS2 device
>      gpio
>    ps2: remove update_irq() function and update_arg parameter
> 
>   hw/hppa/machine.c          |  11 +-
>   hw/input/lasips2.c         | 110 +++++---
>   hw/input/pckbd.c           | 321 ++++++++++++++++--------
>   hw/input/pl050.c           |  50 ++--
>   hw/input/ps2.c             | 500 +++++++++++++++++++++----------------
>   hw/mips/jazz.c             |  11 +-
>   include/hw/input/i8042.h   |  54 +++-
>   include/hw/input/lasips2.h |  27 +-
>   include/hw/input/ps2.h     |  79 +++++-
>   9 files changed, 775 insertions(+), 388 deletions(-)

Ping? I've had an R-B from Phil for patches 1-20 along with a Tested-by from Helge 
for the entire series, but that still leaves the last 30 patches unreviewed...


ATB,

Mark.
Re: [PATCH 00/50] PS2 device QOMification - part 1
Posted by Philippe Mathieu-Daudé via 1 year, 10 months ago
On 7/6/22 17:54, Mark Cave-Ayland wrote:
> On 22/05/2022 19:17, Mark Cave-Ayland wrote:
> 
>> This series came about when looking at improving the LASI PS2 device for
>> the HPPA machine: there were improvements that I was keen to make, but
>> was restricted because the PS2 device(s) weren't QOMified.
>>
>> Trying to do everything in a single patchset would be a very large series
>> indeed, so here is part 1 of the series which does the basic QOMification
>> process and consists of:
>>
>> - QOMifying the basic PS2, PS2 keyboard and PS2 mouse types
>>
>> - Moving any functionality that exists in a global device init function
>>    directly into the relevant device, so that all device behaviour is
>>    configured using qdev properties and QOM
>>
>> - Introducing a new I8042_MMIO type for use by the MIPS magnum machine
>>
>> - Switch all PS2 devices to use qdev gpios for IRQs instead of using the
>>    update_irq() callback function along with the update_arg opaque
>>
>> Once this work has been done, a follow-up part 2 series will finish the
>> remainder of the work which involves i) improving the QOM object model
>> now QOMification is complete and ii) removing the legacy global device
>> init functions for PS2 and related devices.
>>
>> Testing for this series has comprised of booting a machine with each type
>> of PS2 device and confirming that i) the machine responds to keypresses
>> when using a graphical console and ii) completing a successful migration
>> from a machine with this series applies back to a machine running latest
>> git master. The test machines I used were:
>>
>> - qemu-system-x86_64 -M pc for the I8042 device
>> - qemu-system-hppa for the LASIPS2 device
>> - qemu-system-arm -M versatilepb for the PL050 device
>> - qemu-system-mips64el -M magnum for the I8042_MMIO device
>>
>> Finally the QOM tree changes caused by QOMification of the PS2 devices
>> trigger a failure due to a bug in the bios-tables-test qtest for subtest
>> /x86_64/acpi/q35/viot. This can be fixed by applying the series at
>> https://lists.gnu.org/archive/html/qemu-devel/2022-05/msg04266.html
>> "hw/acpi/viot: generate stable VIOT ACPI tables" first.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>
>>
>> Mark Cave-Ayland (50):
>>    ps2: checkpatch fixes
>>    ps2: QOMify PS2State
>>    ps2: QOMify PS2KbdState
>>    ps2: QOMify PS2MouseState
>>    ps2: move QOM type definitions from ps2.c to ps2.h
>>    ps2: improve function prototypes in ps2.c and ps2.h
>>    ps2: introduce PS2DeviceClass
>>    ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon
>>      ps2_common_reset()
>>    ps2: remove duplicate setting of scancode_set in ps2_kbd_init()
>>    ps2: implement ps2_kbd_realize() and use it to register
>>      ps2_keyboard_handler
>>    ps2: implement ps2_mouse_realize() and use it to register
>>      ps2_mouse_handler
>>    ps2: don't use vmstate_register() in ps2_kbd_init()
>>    ps2: don't use vmstate_register() in ps2_mouse_init()
>>    pl050: checkpatch fixes
>>    pl050: split pl050_update_irq() into separate pl050_set_irq() and
>>      pl050_update_irq() functions
>>    lasips2: spacing fixes
>>    lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq()
>>    pckbd: checkpatch fixes
>>    pckbd: move KBDState from pckbd.c to i8042.h
>>    pckbd: move ISAKBDState from pckbd.c to i8042.h

> Ping? I've had an R-B from Phil for patches 1-20 along with a Tested-by 
> from Helge for the entire series, but that still leaves the last 30 
> patches unreviewed...

I'm queuing patches 1-20 (fixing the typo in patch 9) via mips-next,
and will review v2.

Re: [PATCH 00/50] PS2 device QOMification - part 1
Posted by Mark Cave-Ayland 1 year, 10 months ago
On 10/06/2022 16:35, Philippe Mathieu-Daudé wrote:

> On 7/6/22 17:54, Mark Cave-Ayland wrote:
>> On 22/05/2022 19:17, Mark Cave-Ayland wrote:
>>
>>> This series came about when looking at improving the LASI PS2 device for
>>> the HPPA machine: there were improvements that I was keen to make, but
>>> was restricted because the PS2 device(s) weren't QOMified.
>>>
>>> Trying to do everything in a single patchset would be a very large series
>>> indeed, so here is part 1 of the series which does the basic QOMification
>>> process and consists of:
>>>
>>> - QOMifying the basic PS2, PS2 keyboard and PS2 mouse types
>>>
>>> - Moving any functionality that exists in a global device init function
>>>    directly into the relevant device, so that all device behaviour is
>>>    configured using qdev properties and QOM
>>>
>>> - Introducing a new I8042_MMIO type for use by the MIPS magnum machine
>>>
>>> - Switch all PS2 devices to use qdev gpios for IRQs instead of using the
>>>    update_irq() callback function along with the update_arg opaque
>>>
>>> Once this work has been done, a follow-up part 2 series will finish the
>>> remainder of the work which involves i) improving the QOM object model
>>> now QOMification is complete and ii) removing the legacy global device
>>> init functions for PS2 and related devices.
>>>
>>> Testing for this series has comprised of booting a machine with each type
>>> of PS2 device and confirming that i) the machine responds to keypresses
>>> when using a graphical console and ii) completing a successful migration
>>> from a machine with this series applies back to a machine running latest
>>> git master. The test machines I used were:
>>>
>>> - qemu-system-x86_64 -M pc for the I8042 device
>>> - qemu-system-hppa for the LASIPS2 device
>>> - qemu-system-arm -M versatilepb for the PL050 device
>>> - qemu-system-mips64el -M magnum for the I8042_MMIO device
>>>
>>> Finally the QOM tree changes caused by QOMification of the PS2 devices
>>> trigger a failure due to a bug in the bios-tables-test qtest for subtest
>>> /x86_64/acpi/q35/viot. This can be fixed by applying the series at
>>> https://lists.gnu.org/archive/html/qemu-devel/2022-05/msg04266.html
>>> "hw/acpi/viot: generate stable VIOT ACPI tables" first.
>>>
>>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>>
>>>
>>> Mark Cave-Ayland (50):
>>>    ps2: checkpatch fixes
>>>    ps2: QOMify PS2State
>>>    ps2: QOMify PS2KbdState
>>>    ps2: QOMify PS2MouseState
>>>    ps2: move QOM type definitions from ps2.c to ps2.h
>>>    ps2: improve function prototypes in ps2.c and ps2.h
>>>    ps2: introduce PS2DeviceClass
>>>    ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon
>>>      ps2_common_reset()
>>>    ps2: remove duplicate setting of scancode_set in ps2_kbd_init()
>>>    ps2: implement ps2_kbd_realize() and use it to register
>>>      ps2_keyboard_handler
>>>    ps2: implement ps2_mouse_realize() and use it to register
>>>      ps2_mouse_handler
>>>    ps2: don't use vmstate_register() in ps2_kbd_init()
>>>    ps2: don't use vmstate_register() in ps2_mouse_init()
>>>    pl050: checkpatch fixes
>>>    pl050: split pl050_update_irq() into separate pl050_set_irq() and
>>>      pl050_update_irq() functions
>>>    lasips2: spacing fixes
>>>    lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq()
>>>    pckbd: checkpatch fixes
>>>    pckbd: move KBDState from pckbd.c to i8042.h
>>>    pckbd: move ISAKBDState from pckbd.c to i8042.h
> 
>> Ping? I've had an R-B from Phil for patches 1-20 along with a Tested-by from Helge 
>> for the entire series, but that still leaves the last 30 patches unreviewed...
> 
> I'm queuing patches 1-20 (fixing the typo in patch 9) via mips-next,
> and will review v2.

Hi Phil,

I've also got a local fix that needs to be squashed into one of these early patches, 
so could you drop this series for now? As well as this extra fix (thanks Asan!) it 
will make it easier to rebase and update the series according to Peter's review comments.


ATB,

Mark.

Re: [PATCH 00/50] PS2 device QOMification - part 1
Posted by Philippe Mathieu-Daudé via 1 year, 10 months ago
On Fri, Jun 10, 2022 at 5:43 PM Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> On 10/06/2022 16:35, Philippe Mathieu-Daudé wrote:
>
> > On 7/6/22 17:54, Mark Cave-Ayland wrote:
> >> On 22/05/2022 19:17, Mark Cave-Ayland wrote:
> >>
> >>> This series came about when looking at improving the LASI PS2 device for
> >>> the HPPA machine: there were improvements that I was keen to make, but
> >>> was restricted because the PS2 device(s) weren't QOMified.
> >>>
> >>> Trying to do everything in a single patchset would be a very large series
> >>> indeed, so here is part 1 of the series which does the basic QOMification
> >>> process and consists of:
> >>>
> >>> - QOMifying the basic PS2, PS2 keyboard and PS2 mouse types
> >>>
> >>> - Moving any functionality that exists in a global device init function
> >>>    directly into the relevant device, so that all device behaviour is
> >>>    configured using qdev properties and QOM
> >>>
> >>> - Introducing a new I8042_MMIO type for use by the MIPS magnum machine
> >>>
> >>> - Switch all PS2 devices to use qdev gpios for IRQs instead of using the
> >>>    update_irq() callback function along with the update_arg opaque
> >>>
> >>> Once this work has been done, a follow-up part 2 series will finish the
> >>> remainder of the work which involves i) improving the QOM object model
> >>> now QOMification is complete and ii) removing the legacy global device
> >>> init functions for PS2 and related devices.
> >>>
> >>> Testing for this series has comprised of booting a machine with each type
> >>> of PS2 device and confirming that i) the machine responds to keypresses
> >>> when using a graphical console and ii) completing a successful migration
> >>> from a machine with this series applies back to a machine running latest
> >>> git master. The test machines I used were:
> >>>
> >>> - qemu-system-x86_64 -M pc for the I8042 device
> >>> - qemu-system-hppa for the LASIPS2 device
> >>> - qemu-system-arm -M versatilepb for the PL050 device
> >>> - qemu-system-mips64el -M magnum for the I8042_MMIO device
> >>>
> >>> Finally the QOM tree changes caused by QOMification of the PS2 devices
> >>> trigger a failure due to a bug in the bios-tables-test qtest for subtest
> >>> /x86_64/acpi/q35/viot. This can be fixed by applying the series at
> >>> https://lists.gnu.org/archive/html/qemu-devel/2022-05/msg04266.html
> >>> "hw/acpi/viot: generate stable VIOT ACPI tables" first.
> >>>
> >>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> >>>
> >>>
> >>> Mark Cave-Ayland (50):
> >>>    ps2: checkpatch fixes
> >>>    ps2: QOMify PS2State
> >>>    ps2: QOMify PS2KbdState
> >>>    ps2: QOMify PS2MouseState
> >>>    ps2: move QOM type definitions from ps2.c to ps2.h
> >>>    ps2: improve function prototypes in ps2.c and ps2.h
> >>>    ps2: introduce PS2DeviceClass
> >>>    ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon
> >>>      ps2_common_reset()
> >>>    ps2: remove duplicate setting of scancode_set in ps2_kbd_init()
> >>>    ps2: implement ps2_kbd_realize() and use it to register
> >>>      ps2_keyboard_handler
> >>>    ps2: implement ps2_mouse_realize() and use it to register
> >>>      ps2_mouse_handler
> >>>    ps2: don't use vmstate_register() in ps2_kbd_init()
> >>>    ps2: don't use vmstate_register() in ps2_mouse_init()
> >>>    pl050: checkpatch fixes
> >>>    pl050: split pl050_update_irq() into separate pl050_set_irq() and
> >>>      pl050_update_irq() functions
> >>>    lasips2: spacing fixes
> >>>    lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq()
> >>>    pckbd: checkpatch fixes
> >>>    pckbd: move KBDState from pckbd.c to i8042.h
> >>>    pckbd: move ISAKBDState from pckbd.c to i8042.h
> >
> >> Ping? I've had an R-B from Phil for patches 1-20 along with a Tested-by from Helge
> >> for the entire series, but that still leaves the last 30 patches unreviewed...
> >
> > I'm queuing patches 1-20 (fixing the typo in patch 9) via mips-next,
> > and will review v2.
>
> Hi Phil,
>
> I've also got a local fix that needs to be squashed into one of these early patches,
> so could you drop this series for now? As well as this extra fix (thanks Asan!) it
> will make it easier to rebase and update the series according to Peter's review comments.

Sure, patches removed from mips-next queue.

> ATB,
>
> Mark.
Re: [PATCH 00/50] PS2 device QOMification - part 1
Posted by Helge Deller 1 year, 11 months ago
Hi Mark,

On 5/22/22 20:17, Mark Cave-Ayland wrote:
> This series came about when looking at improving the LASI PS2 device for
> the HPPA machine: there were improvements that I was keen to make, but
> was restricted because the PS2 device(s) weren't QOMified.
>
> Trying to do everything in a single patchset would be a very large series
> indeed, so here is part 1 of the series which does the basic QOMification
> process and consists of:
>
> - QOMifying the basic PS2, PS2 keyboard and PS2 mouse types
>
> - Moving any functionality that exists in a global device init function
>   directly into the relevant device, so that all device behaviour is
>   configured using qdev properties and QOM
>
> - Introducing a new I8042_MMIO type for use by the MIPS magnum machine
>
> - Switch all PS2 devices to use qdev gpios for IRQs instead of using the
>   update_irq() callback function along with the update_arg opaque
>
> Once this work has been done, a follow-up part 2 series will finish the
> remainder of the work which involves i) improving the QOM object model
> now QOMification is complete and ii) removing the legacy global device
> init functions for PS2 and related devices.
>
> Testing for this series has comprised of booting a machine with each type
> of PS2 device and confirming that i) the machine responds to keypresses
> when using a graphical console and ii) completing a successful migration
> from a machine with this series applies back to a machine running latest
> git master. The test machines I used were:
>
> - qemu-system-x86_64 -M pc for the I8042 device
> - qemu-system-hppa for the LASIPS2 device
> - qemu-system-arm -M versatilepb for the PL050 device
> - qemu-system-mips64el -M magnum for the I8042_MMIO device
>
> Finally the QOM tree changes caused by QOMification of the PS2 devices
> trigger a failure due to a bug in the bios-tables-test qtest for subtest
> /x86_64/acpi/q35/viot. This can be fixed by applying the series at
> https://lists.gnu.org/archive/html/qemu-devel/2022-05/msg04266.html
> "hw/acpi/viot: generate stable VIOT ACPI tables" first.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Thanks a lot for this QOMifying and cleanup work!
I've sucessfully tested it with qemu-system-hppa for HP-UX 10 and 11.

You may add either or both of:

Acked-by: Helge Deller <deller@gmx.de>
Tested-by: Helge Deller <deller@gmx.de>

Thank you!
Helge


>
>
> Mark Cave-Ayland (50):
>   ps2: checkpatch fixes
>   ps2: QOMify PS2State
>   ps2: QOMify PS2KbdState
>   ps2: QOMify PS2MouseState
>   ps2: move QOM type definitions from ps2.c to ps2.h
>   ps2: improve function prototypes in ps2.c and ps2.h
>   ps2: introduce PS2DeviceClass
>   ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon
>     ps2_common_reset()
>   ps2: remove duplicate setting of scancode_set in ps2_kbd_init()
>   ps2: implement ps2_kbd_realize() and use it to register
>     ps2_keyboard_handler
>   ps2: implement ps2_mouse_realize() and use it to register
>     ps2_mouse_handler
>   ps2: don't use vmstate_register() in ps2_kbd_init()
>   ps2: don't use vmstate_register() in ps2_mouse_init()
>   pl050: checkpatch fixes
>   pl050: split pl050_update_irq() into separate pl050_set_irq() and
>     pl050_update_irq() functions
>   lasips2: spacing fixes
>   lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq()
>   pckbd: checkpatch fixes
>   pckbd: move KBDState from pckbd.c to i8042.h
>   pckbd: move ISAKBDState from pckbd.c to i8042.h
>   pckbd: introduce new I8042_MMIO QOM type
>   pckbd: implement i8042_mmio_reset() for I8042_MMIO device
>   pckbd: add mask qdev property to I8042_MMIO device
>   pckbd: add size qdev property to I8042_MMIO device
>   pckbd: implement i8042_mmio_realize() function
>   pckbd: implement i8042_mmio_init() function
>   pckbd: alter i8042_mm_init() to return a I8042_MMIO device
>   pckbd: move mapping of I8042_MMIO registers to MIPS magnum machine
>   pckbd: more vmstate_register() from i8042_mm_init() to
>     i8042_mmio_realize()
>   pckbd: move ps2_kbd_init() and ps2_mouse_init() to
>     i8042_mmio_realize()
>   ps2: make ps2_raise_irq() function static
>   ps2: use ps2_raise_irq() instead of calling update_irq() directly
>   ps2: introduce ps2_lower_irq() instead of calling update_irq()
>     directly
>   ps2: add gpio for output IRQ and optionally use it in ps2_raise_irq()
>     and ps2_lower_irq()
>   pckbd: replace irq_kbd and irq_mouse with qemu_irq array in KBDState
>   pl050: switch over from update_irq() function to PS2 device gpio
>   lasips2: QOMify LASIPS2State
>   lasips2: move lasips2 QOM types from lasips2.c to lasips2.h
>   lasips2: rename lasips2_init() to lasips2_initfn() and update it to
>     return the LASIPS2 device
>   lasips2: implement lasips2_init() function
>   lasips2: move mapping of LASIPS2 registers to HPPA machine
>   lasips2: move initialisation of PS2 ports from lasi_initfn() to
>     lasi_init()
>   lasips2: add base property
>   lasips2: implement lasips2_realize()
>   lasips2: use qdev gpio for output IRQ
>   lasips2: switch over from update_irq() function to PS2 device gpio
>   pckbd: switch I8042_MMIO device from update_irq() function to PS2
>     device gpio
>   pckbd: add i8042_reset() function to I8042 device
>   pckbd: switch I8042 device from update_irq() function to PS2 device
>     gpio
>   ps2: remove update_irq() function and update_arg parameter
>
>  hw/hppa/machine.c          |  11 +-
>  hw/input/lasips2.c         | 110 +++++---
>  hw/input/pckbd.c           | 321 ++++++++++++++++--------
>  hw/input/pl050.c           |  50 ++--
>  hw/input/ps2.c             | 500 +++++++++++++++++++++----------------
>  hw/mips/jazz.c             |  11 +-
>  include/hw/input/i8042.h   |  54 +++-
>  include/hw/input/lasips2.h |  27 +-
>  include/hw/input/ps2.h     |  79 +++++-
>  9 files changed, 775 insertions(+), 388 deletions(-)
>
Re: [PATCH 00/50] PS2 device QOMification - part 1
Posted by Mark Cave-Ayland 1 year, 10 months ago
On 24/05/2022 19:25, Helge Deller wrote:

> Hi Mark,
> 
> On 5/22/22 20:17, Mark Cave-Ayland wrote:
>> This series came about when looking at improving the LASI PS2 device for
>> the HPPA machine: there were improvements that I was keen to make, but
>> was restricted because the PS2 device(s) weren't QOMified.
>>
>> Trying to do everything in a single patchset would be a very large series
>> indeed, so here is part 1 of the series which does the basic QOMification
>> process and consists of:
>>
>> - QOMifying the basic PS2, PS2 keyboard and PS2 mouse types
>>
>> - Moving any functionality that exists in a global device init function
>>    directly into the relevant device, so that all device behaviour is
>>    configured using qdev properties and QOM
>>
>> - Introducing a new I8042_MMIO type for use by the MIPS magnum machine
>>
>> - Switch all PS2 devices to use qdev gpios for IRQs instead of using the
>>    update_irq() callback function along with the update_arg opaque
>>
>> Once this work has been done, a follow-up part 2 series will finish the
>> remainder of the work which involves i) improving the QOM object model
>> now QOMification is complete and ii) removing the legacy global device
>> init functions for PS2 and related devices.
>>
>> Testing for this series has comprised of booting a machine with each type
>> of PS2 device and confirming that i) the machine responds to keypresses
>> when using a graphical console and ii) completing a successful migration
>> from a machine with this series applies back to a machine running latest
>> git master. The test machines I used were:
>>
>> - qemu-system-x86_64 -M pc for the I8042 device
>> - qemu-system-hppa for the LASIPS2 device
>> - qemu-system-arm -M versatilepb for the PL050 device
>> - qemu-system-mips64el -M magnum for the I8042_MMIO device
>>
>> Finally the QOM tree changes caused by QOMification of the PS2 devices
>> trigger a failure due to a bug in the bios-tables-test qtest for subtest
>> /x86_64/acpi/q35/viot. This can be fixed by applying the series at
>> https://lists.gnu.org/archive/html/qemu-devel/2022-05/msg04266.html
>> "hw/acpi/viot: generate stable VIOT ACPI tables" first.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> 
> Thanks a lot for this QOMifying and cleanup work!
> I've sucessfully tested it with qemu-system-hppa for HP-UX 10 and 11.

Thanks for testing! As mentioned in the cover letter, in part 1 it's just a very 
basic conversion for now to keep the size of the series down - part 2 is where the 
magic happens :)

> You may add either or both of:
> 
> Acked-by: Helge Deller <deller@gmx.de>
> Tested-by: Helge Deller <deller@gmx.de>
> 
> Thank you!
> Helge
> 
> 
>>
>>
>> Mark Cave-Ayland (50):
>>    ps2: checkpatch fixes
>>    ps2: QOMify PS2State
>>    ps2: QOMify PS2KbdState
>>    ps2: QOMify PS2MouseState
>>    ps2: move QOM type definitions from ps2.c to ps2.h
>>    ps2: improve function prototypes in ps2.c and ps2.h
>>    ps2: introduce PS2DeviceClass
>>    ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon
>>      ps2_common_reset()
>>    ps2: remove duplicate setting of scancode_set in ps2_kbd_init()
>>    ps2: implement ps2_kbd_realize() and use it to register
>>      ps2_keyboard_handler
>>    ps2: implement ps2_mouse_realize() and use it to register
>>      ps2_mouse_handler
>>    ps2: don't use vmstate_register() in ps2_kbd_init()
>>    ps2: don't use vmstate_register() in ps2_mouse_init()
>>    pl050: checkpatch fixes
>>    pl050: split pl050_update_irq() into separate pl050_set_irq() and
>>      pl050_update_irq() functions
>>    lasips2: spacing fixes
>>    lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq()
>>    pckbd: checkpatch fixes
>>    pckbd: move KBDState from pckbd.c to i8042.h
>>    pckbd: move ISAKBDState from pckbd.c to i8042.h
>>    pckbd: introduce new I8042_MMIO QOM type
>>    pckbd: implement i8042_mmio_reset() for I8042_MMIO device
>>    pckbd: add mask qdev property to I8042_MMIO device
>>    pckbd: add size qdev property to I8042_MMIO device
>>    pckbd: implement i8042_mmio_realize() function
>>    pckbd: implement i8042_mmio_init() function
>>    pckbd: alter i8042_mm_init() to return a I8042_MMIO device
>>    pckbd: move mapping of I8042_MMIO registers to MIPS magnum machine
>>    pckbd: more vmstate_register() from i8042_mm_init() to
>>      i8042_mmio_realize()
>>    pckbd: move ps2_kbd_init() and ps2_mouse_init() to
>>      i8042_mmio_realize()
>>    ps2: make ps2_raise_irq() function static
>>    ps2: use ps2_raise_irq() instead of calling update_irq() directly
>>    ps2: introduce ps2_lower_irq() instead of calling update_irq()
>>      directly
>>    ps2: add gpio for output IRQ and optionally use it in ps2_raise_irq()
>>      and ps2_lower_irq()
>>    pckbd: replace irq_kbd and irq_mouse with qemu_irq array in KBDState
>>    pl050: switch over from update_irq() function to PS2 device gpio
>>    lasips2: QOMify LASIPS2State
>>    lasips2: move lasips2 QOM types from lasips2.c to lasips2.h
>>    lasips2: rename lasips2_init() to lasips2_initfn() and update it to
>>      return the LASIPS2 device
>>    lasips2: implement lasips2_init() function
>>    lasips2: move mapping of LASIPS2 registers to HPPA machine
>>    lasips2: move initialisation of PS2 ports from lasi_initfn() to
>>      lasi_init()
>>    lasips2: add base property
>>    lasips2: implement lasips2_realize()
>>    lasips2: use qdev gpio for output IRQ
>>    lasips2: switch over from update_irq() function to PS2 device gpio
>>    pckbd: switch I8042_MMIO device from update_irq() function to PS2
>>      device gpio
>>    pckbd: add i8042_reset() function to I8042 device
>>    pckbd: switch I8042 device from update_irq() function to PS2 device
>>      gpio
>>    ps2: remove update_irq() function and update_arg parameter
>>
>>   hw/hppa/machine.c          |  11 +-
>>   hw/input/lasips2.c         | 110 +++++---
>>   hw/input/pckbd.c           | 321 ++++++++++++++++--------
>>   hw/input/pl050.c           |  50 ++--
>>   hw/input/ps2.c             | 500 +++++++++++++++++++++----------------
>>   hw/mips/jazz.c             |  11 +-
>>   include/hw/input/i8042.h   |  54 +++-
>>   include/hw/input/lasips2.h |  27 +-
>>   include/hw/input/ps2.h     |  79 +++++-
>>   9 files changed, 775 insertions(+), 388 deletions(-)


ATB,

Mark.