mbox series

[v2,00/21] hw/vfio: Build various objects once

Message ID 20250308230917.18907-1-philmd@linaro.org (mailing list archive)
Headers show
Series hw/vfio: Build various objects once | expand

Message

Philippe Mathieu-Daudé March 8, 2025, 11:08 p.m. UTC
By doing the following changes:
- Clean some headers up
- Replace compile-time CONFIG_KVM check by kvm_enabled()
- Replace compile-time CONFIG_IOMMUFD check by iommufd_builtin()
we can build less vfio objects.

Since v1:
- Added R-b tags
- Introduce type_is_registered()
- Split builtin check VS meson changes (rth)
- Consider IGD

Philippe Mathieu-Daudé (21):
  hw/vfio/common: Include missing 'system/tcg.h' header
  hw/vfio/spapr: Do not include <linux/kvm.h>
  hw/vfio: Compile some common objects once
  hw/vfio: Compile more objects once
  hw/vfio: Compile iommufd.c once
  system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h'
  hw/vfio: Compile display.c once
  system/kvm: Expose kvm_irqchip_[add,remove]_change_notifier()
  hw/vfio/pci: Convert CONFIG_KVM check to runtime one
  qom: Introduce type_is_registered()
  hw/vfio/igd: Define TYPE_VFIO_PCI_IGD_LPC_BRIDGE
  hw/vfio/igd: Check CONFIG_VFIO_IGD at runtime using vfio_igd_builtin()
  hw/vfio/igd: Compile once
  system/iommufd: Introduce iommufd_builtin() helper
  hw/vfio/pci: Check CONFIG_IOMMUFD at runtime using iommufd_builtin()
  hw/vfio/pci: Compile once
  hw/vfio/ap: Check CONFIG_IOMMUFD at runtime using iommufd_builtin()
  hw/vfio/ccw: Check CONFIG_IOMMUFD at runtime using iommufd_builtin()
  hw/vfio/s390x: Compile AP and CCW once
  hw/vfio/platform: Check CONFIG_IOMMUFD at runtime using
    iommufd_builtin
  hw/vfio/platform: Compile once

 docs/devel/vfio-iommufd.rst  |  2 +-
 hw/vfio/pci-quirks.h         |  8 +++++
 include/exec/ram_addr.h      |  3 --
 include/qom/object.h         |  8 +++++
 include/system/hostmem.h     |  3 ++
 include/system/iommufd.h     |  6 ++++
 include/system/kvm.h         |  8 ++---
 target/s390x/kvm/kvm_s390x.h |  2 +-
 hw/ppc/spapr_caps.c          |  1 +
 hw/s390x/s390-virtio-ccw.c   |  1 +
 hw/vfio/ap.c                 | 27 ++++++++---------
 hw/vfio/ccw.c                | 27 ++++++++---------
 hw/vfio/common.c             |  1 +
 hw/vfio/igd-stubs.c          | 20 +++++++++++++
 hw/vfio/igd.c                |  4 +--
 hw/vfio/iommufd.c            |  1 -
 hw/vfio/migration.c          |  1 -
 hw/vfio/pci-quirks.c         |  9 +++---
 hw/vfio/pci.c                | 57 +++++++++++++++++-------------------
 hw/vfio/platform.c           | 25 ++++++++--------
 hw/vfio/spapr.c              |  4 +--
 qom/object.c                 |  5 ++++
 hw/vfio/meson.build          | 35 +++++++++++++---------
 23 files changed, 152 insertions(+), 106 deletions(-)
 create mode 100644 hw/vfio/igd-stubs.c

Comments

Cédric Le Goater March 10, 2025, 8:03 a.m. UTC | #1
On 3/9/25 00:08, Philippe Mathieu-Daudé wrote:
> By doing the following changes:
> - Clean some headers up
> - Replace compile-time CONFIG_KVM check by kvm_enabled()
> - Replace compile-time CONFIG_IOMMUFD check by iommufd_builtin()
> we can build less vfio objects.
> 
> Since v1:
> - Added R-b tags
> - Introduce type_is_registered()
> - Split builtin check VS meson changes (rth)
> - Consider IGD
> 
> Philippe Mathieu-Daudé (21):
>    hw/vfio/common: Include missing 'system/tcg.h' header
>    hw/vfio/spapr: Do not include <linux/kvm.h>
>    hw/vfio: Compile some common objects once
>    hw/vfio: Compile more objects once
>    hw/vfio: Compile iommufd.c once
>    system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h'
>    hw/vfio: Compile display.c once
>    system/kvm: Expose kvm_irqchip_[add,remove]_change_notifier()
>    hw/vfio/pci: Convert CONFIG_KVM check to runtime one
>    qom: Introduce type_is_registered()
>    hw/vfio/igd: Define TYPE_VFIO_PCI_IGD_LPC_BRIDGE
>    hw/vfio/igd: Check CONFIG_VFIO_IGD at runtime using vfio_igd_builtin()
>    hw/vfio/igd: Compile once
>    system/iommufd: Introduce iommufd_builtin() helper
>    hw/vfio/pci: Check CONFIG_IOMMUFD at runtime using iommufd_builtin()
>    hw/vfio/pci: Compile once
>    hw/vfio/ap: Check CONFIG_IOMMUFD at runtime using iommufd_builtin()
>    hw/vfio/ccw: Check CONFIG_IOMMUFD at runtime using iommufd_builtin()
>    hw/vfio/s390x: Compile AP and CCW once
>    hw/vfio/platform: Check CONFIG_IOMMUFD at runtime using
>      iommufd_builtin
>    hw/vfio/platform: Compile once
> 
>   docs/devel/vfio-iommufd.rst  |  2 +-
>   hw/vfio/pci-quirks.h         |  8 +++++
>   include/exec/ram_addr.h      |  3 --
>   include/qom/object.h         |  8 +++++
>   include/system/hostmem.h     |  3 ++
>   include/system/iommufd.h     |  6 ++++
>   include/system/kvm.h         |  8 ++---
>   target/s390x/kvm/kvm_s390x.h |  2 +-
>   hw/ppc/spapr_caps.c          |  1 +
>   hw/s390x/s390-virtio-ccw.c   |  1 +
>   hw/vfio/ap.c                 | 27 ++++++++---------
>   hw/vfio/ccw.c                | 27 ++++++++---------
>   hw/vfio/common.c             |  1 +
>   hw/vfio/igd-stubs.c          | 20 +++++++++++++
>   hw/vfio/igd.c                |  4 +--
>   hw/vfio/iommufd.c            |  1 -
>   hw/vfio/migration.c          |  1 -
>   hw/vfio/pci-quirks.c         |  9 +++---
>   hw/vfio/pci.c                | 57 +++++++++++++++++-------------------
>   hw/vfio/platform.c           | 25 ++++++++--------
>   hw/vfio/spapr.c              |  4 +--
>   qom/object.c                 |  5 ++++
>   hw/vfio/meson.build          | 35 +++++++++++++---------
>   23 files changed, 152 insertions(+), 106 deletions(-)
>   create mode 100644 hw/vfio/igd-stubs.c
> 

Patches 1-9 still look ok and could be merged through the vfio tree
if maintainers ack patch 6 and 8.

The rest, depending on type_is_registered(), would be nice to have,
but since there are conflicts and soft freeze is scheduled for
tomorrow, we would probably have to wait QEMU 10.1.

Thanks,

C.
Philippe Mathieu-Daudé March 10, 2025, 1:38 p.m. UTC | #2
On 10/3/25 09:03, Cédric Le Goater wrote:
> On 3/9/25 00:08, Philippe Mathieu-Daudé wrote:
>> By doing the following changes:
>> - Clean some headers up
>> - Replace compile-time CONFIG_KVM check by kvm_enabled()
>> - Replace compile-time CONFIG_IOMMUFD check by iommufd_builtin()
>> we can build less vfio objects.
>>
>> Since v1:
>> - Added R-b tags
>> - Introduce type_is_registered()
>> - Split builtin check VS meson changes (rth)
>> - Consider IGD
>>
>> Philippe Mathieu-Daudé (21):
>>    hw/vfio/common: Include missing 'system/tcg.h' header
>>    hw/vfio/spapr: Do not include <linux/kvm.h>
>>    hw/vfio: Compile some common objects once
>>    hw/vfio: Compile more objects once
>>    hw/vfio: Compile iommufd.c once
>>    system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h'
>>    hw/vfio: Compile display.c once
>>    system/kvm: Expose kvm_irqchip_[add,remove]_change_notifier()
>>    hw/vfio/pci: Convert CONFIG_KVM check to runtime one
>>    qom: Introduce type_is_registered()
>>    hw/vfio/igd: Define TYPE_VFIO_PCI_IGD_LPC_BRIDGE
>>    hw/vfio/igd: Check CONFIG_VFIO_IGD at runtime using vfio_igd_builtin()
>>    hw/vfio/igd: Compile once
>>    system/iommufd: Introduce iommufd_builtin() helper
>>    hw/vfio/pci: Check CONFIG_IOMMUFD at runtime using iommufd_builtin()
>>    hw/vfio/pci: Compile once
>>    hw/vfio/ap: Check CONFIG_IOMMUFD at runtime using iommufd_builtin()
>>    hw/vfio/ccw: Check CONFIG_IOMMUFD at runtime using iommufd_builtin()
>>    hw/vfio/s390x: Compile AP and CCW once
>>    hw/vfio/platform: Check CONFIG_IOMMUFD at runtime using
>>      iommufd_builtin
>>    hw/vfio/platform: Compile once
>>
>>   docs/devel/vfio-iommufd.rst  |  2 +-
>>   hw/vfio/pci-quirks.h         |  8 +++++
>>   include/exec/ram_addr.h      |  3 --
>>   include/qom/object.h         |  8 +++++
>>   include/system/hostmem.h     |  3 ++
>>   include/system/iommufd.h     |  6 ++++
>>   include/system/kvm.h         |  8 ++---
>>   target/s390x/kvm/kvm_s390x.h |  2 +-
>>   hw/ppc/spapr_caps.c          |  1 +
>>   hw/s390x/s390-virtio-ccw.c   |  1 +
>>   hw/vfio/ap.c                 | 27 ++++++++---------
>>   hw/vfio/ccw.c                | 27 ++++++++---------
>>   hw/vfio/common.c             |  1 +
>>   hw/vfio/igd-stubs.c          | 20 +++++++++++++
>>   hw/vfio/igd.c                |  4 +--
>>   hw/vfio/iommufd.c            |  1 -
>>   hw/vfio/migration.c          |  1 -
>>   hw/vfio/pci-quirks.c         |  9 +++---
>>   hw/vfio/pci.c                | 57 +++++++++++++++++-------------------
>>   hw/vfio/platform.c           | 25 ++++++++--------
>>   hw/vfio/spapr.c              |  4 +--
>>   qom/object.c                 |  5 ++++
>>   hw/vfio/meson.build          | 35 +++++++++++++---------
>>   23 files changed, 152 insertions(+), 106 deletions(-)
>>   create mode 100644 hw/vfio/igd-stubs.c
>>
> 
> Patches 1-9 still look ok and could be merged through the vfio tree
> if maintainers ack patch 6 and 8.
> 
> The rest, depending on type_is_registered(), would be nice to have,
> but since there are conflicts and soft freeze is scheduled for
> tomorrow, we would probably have to wait QEMU 10.1.

No particular rush for the 10.0 release.