mbox series

[00/11] QOM'ify PIIX3 southbridge

Message ID 20220713081735.112016-1-shentey@gmail.com (mailing list archive)
Headers show
Series QOM'ify PIIX3 southbridge | expand

Message

Bernhard Beschow July 13, 2022, 8:17 a.m. UTC
Similar to PIIX4 this series QOM'ifies internal device creation for PIIX3.
This reduces the delta between the implementations of PIIX3 and PIIX4 and
therefore might allow to merge both implementations in the future.

There were two challenges in this series:

First, QEMU considers the ACPI and USB functions to be optional in PIIX3.
When instantiating those with object_initialize_child(), they need to be
unparented in the realize function to prevent an assertion (see respective
commit messages).

Second, the PIC used to be instantiated outside of the southbridge while
some sub functions require a PIC with populated qemu_irqs. This has been
solved by introducing a proxy PIC which furthermore allows PIIX3 to be
agnostic towards the virtualization technology used (KVM, TCG, Xen).

Testing done:
* make check
* make check-avocado
* Boot live CD:
  * qemu-system-x86_64 -M pc -m 2G -accel kvm -cpu host -cdrom manjaro-kde-21.3.2-220704-linux515.iso
  * qemu-system-x86_64 -M q35 -m 2G -accel kvm -cpu host -cdrom manjaro-kde-21.3.2-220704-linux515.iso

Bernhard Beschow (11):
  hw/i386/pc: QOM'ify DMA creation
  hw/i386/pc_piix: Allow for setting properties before realizing PIIX3
    southbridge
  hw/isa/piix3: QOM'ify USB controller creation
  hw/isa/piix3: QOM'ify ACPI controller creation
  hw/i386/pc: QOM'ify RTC creation
  hw/i386/pc: No need for rtc_state to be an out-parameter
  hw/intc/i8259: Introduce i8259 proxy "isa-pic"
  hw/isa/piix3: QOM'ify ISA PIC creation
  hw/isa/piix3: QOM'ify IDE controller creation
  hw/isa/piix3: Wire up ACPI interrupt internally
  hw/isa/piix3: Remove extra ';' outside of functions

 hw/i386/Kconfig               |  1 -
 hw/i386/pc.c                  | 17 ++++---
 hw/i386/pc_piix.c             | 70 ++++++++++++++++-------------
 hw/i386/pc_q35.c              |  3 +-
 hw/intc/i8259.c               | 27 +++++++++++
 hw/isa/Kconfig                |  1 +
 hw/isa/lpc_ich9.c             | 11 +++++
 hw/isa/piix3.c                | 84 ++++++++++++++++++++++++++++++++---
 include/hw/i386/ich9.h        |  2 +
 include/hw/i386/pc.h          |  2 +-
 include/hw/intc/i8259.h       | 14 ++++++
 include/hw/southbridge/piix.h | 16 ++++++-
 12 files changed, 201 insertions(+), 47 deletions(-)

Comments

Michael S. Tsirkin July 26, 2022, 2:53 p.m. UTC | #1
On Wed, Jul 13, 2022 at 10:17:24AM +0200, Bernhard Beschow wrote:
> Similar to PIIX4 this series QOM'ifies internal device creation for PIIX3.
> This reduces the delta between the implementations of PIIX3 and PIIX4 and
> therefore might allow to merge both implementations in the future.
> 
> There were two challenges in this series:
> 
> First, QEMU considers the ACPI and USB functions to be optional in PIIX3.
> When instantiating those with object_initialize_child(), they need to be
> unparented in the realize function to prevent an assertion (see respective
> commit messages).
> 
> Second, the PIC used to be instantiated outside of the southbridge while
> some sub functions require a PIC with populated qemu_irqs. This has been
> solved by introducing a proxy PIC which furthermore allows PIIX3 to be
> agnostic towards the virtualization technology used (KVM, TCG, Xen).

Thanks!
I think it's best to merge this after the 7.1 release.
I'll tag this but if possible pls also ping me after the release
to make sure I don't forget. Thanks!

> Testing done:
> * make check
> * make check-avocado
> * Boot live CD:
>   * qemu-system-x86_64 -M pc -m 2G -accel kvm -cpu host -cdrom manjaro-kde-21.3.2-220704-linux515.iso
>   * qemu-system-x86_64 -M q35 -m 2G -accel kvm -cpu host -cdrom manjaro-kde-21.3.2-220704-linux515.iso
> 
> Bernhard Beschow (11):
>   hw/i386/pc: QOM'ify DMA creation
>   hw/i386/pc_piix: Allow for setting properties before realizing PIIX3
>     southbridge
>   hw/isa/piix3: QOM'ify USB controller creation
>   hw/isa/piix3: QOM'ify ACPI controller creation
>   hw/i386/pc: QOM'ify RTC creation
>   hw/i386/pc: No need for rtc_state to be an out-parameter
>   hw/intc/i8259: Introduce i8259 proxy "isa-pic"
>   hw/isa/piix3: QOM'ify ISA PIC creation
>   hw/isa/piix3: QOM'ify IDE controller creation
>   hw/isa/piix3: Wire up ACPI interrupt internally
>   hw/isa/piix3: Remove extra ';' outside of functions
> 
>  hw/i386/Kconfig               |  1 -
>  hw/i386/pc.c                  | 17 ++++---
>  hw/i386/pc_piix.c             | 70 ++++++++++++++++-------------
>  hw/i386/pc_q35.c              |  3 +-
>  hw/intc/i8259.c               | 27 +++++++++++
>  hw/isa/Kconfig                |  1 +
>  hw/isa/lpc_ich9.c             | 11 +++++
>  hw/isa/piix3.c                | 84 ++++++++++++++++++++++++++++++++---
>  include/hw/i386/ich9.h        |  2 +
>  include/hw/i386/pc.h          |  2 +-
>  include/hw/intc/i8259.h       | 14 ++++++
>  include/hw/southbridge/piix.h | 16 ++++++-
>  12 files changed, 201 insertions(+), 47 deletions(-)
> 
> -- 
> 2.37.1
>
Bernhard Beschow July 26, 2022, 10:23 p.m. UTC | #2
Am 26. Juli 2022 16:53:03 MESZ schrieb "Michael S. Tsirkin" <mst@redhat.com>:
>On Wed, Jul 13, 2022 at 10:17:24AM +0200, Bernhard Beschow wrote:
>> Similar to PIIX4 this series QOM'ifies internal device creation for PIIX3.
>> This reduces the delta between the implementations of PIIX3 and PIIX4 and
>> therefore might allow to merge both implementations in the future.
>> 
>> There were two challenges in this series:
>> 
>> First, QEMU considers the ACPI and USB functions to be optional in PIIX3.
>> When instantiating those with object_initialize_child(), they need to be
>> unparented in the realize function to prevent an assertion (see respective
>> commit messages).
>> 
>> Second, the PIC used to be instantiated outside of the southbridge while
>> some sub functions require a PIC with populated qemu_irqs. This has been
>> solved by introducing a proxy PIC which furthermore allows PIIX3 to be
>> agnostic towards the virtualization technology used (KVM, TCG, Xen).
>
>Thanks!
>I think it's best to merge this after the 7.1 release.
>I'll tag this but if possible pls also ping me after the release
>to make sure I don't forget. Thanks!

Sure!
I'm extending the scope of this series to go all the way to consolidate the piix 3 + 4 southbridges which is why I didn't post a v2 yet. The extended series will also address Peter's comments.

Thanks,
Bernhard

P.S.:
I've got a working POC where PIIX4 rather than PIIX3 is used in the "pc" machine which also supports KVM accelleration: https://github.com/shentok/qemu/commits/pc-piix4

>
>> Testing done:
>> * make check
>> * make check-avocado
>> * Boot live CD:
>>   * qemu-system-x86_64 -M pc -m 2G -accel kvm -cpu host -cdrom manjaro-kde-21.3.2-220704-linux515.iso
>>   * qemu-system-x86_64 -M q35 -m 2G -accel kvm -cpu host -cdrom manjaro-kde-21.3.2-220704-linux515.iso
>> 
>> Bernhard Beschow (11):
>>   hw/i386/pc: QOM'ify DMA creation
>>   hw/i386/pc_piix: Allow for setting properties before realizing PIIX3
>>     southbridge
>>   hw/isa/piix3: QOM'ify USB controller creation
>>   hw/isa/piix3: QOM'ify ACPI controller creation
>>   hw/i386/pc: QOM'ify RTC creation
>>   hw/i386/pc: No need for rtc_state to be an out-parameter
>>   hw/intc/i8259: Introduce i8259 proxy "isa-pic"
>>   hw/isa/piix3: QOM'ify ISA PIC creation
>>   hw/isa/piix3: QOM'ify IDE controller creation
>>   hw/isa/piix3: Wire up ACPI interrupt internally
>>   hw/isa/piix3: Remove extra ';' outside of functions
>> 
>>  hw/i386/Kconfig               |  1 -
>>  hw/i386/pc.c                  | 17 ++++---
>>  hw/i386/pc_piix.c             | 70 ++++++++++++++++-------------
>>  hw/i386/pc_q35.c              |  3 +-
>>  hw/intc/i8259.c               | 27 +++++++++++
>>  hw/isa/Kconfig                |  1 +
>>  hw/isa/lpc_ich9.c             | 11 +++++
>>  hw/isa/piix3.c                | 84 ++++++++++++++++++++++++++++++++---
>>  include/hw/i386/ich9.h        |  2 +
>>  include/hw/i386/pc.h          |  2 +-
>>  include/hw/intc/i8259.h       | 14 ++++++
>>  include/hw/southbridge/piix.h | 16 ++++++-
>>  12 files changed, 201 insertions(+), 47 deletions(-)
>> 
>> -- 
>> 2.37.1
>> 
>