mbox series

[RFC,PATCH-for-8.0,00/10] hw/virtio: Build most objects as target independent units

Message ID 20221212230517.28872-1-philmd@linaro.org
Headers show
Series hw/virtio: Build most objects as target independent units | expand

Message

Philippe Mathieu-Daudé Dec. 12, 2022, 11:05 p.m. UTC
Currently the inlined virtio_access_is_big_endian() function
"hw/virtio/virtio-access.h" which is used by all I/O accesses
force any virtio device to be built as target-dependent object.

This series isolates the few VirtIO target specific bits, trying
to not impact the performance (a function is un-inlined once
not in the hot path).

At the end only 6 files remain in the target specific source set,
all other files are built once.

On a Linux/x86_64 host when building QEMU configured with
--disable-user, before this series a "make clean all" builds
7713 objects, after it only build 6831... I don't think my maths
are correct, because that would save building a few hundreds objects.

RFC because only build-tested.

Regards,

Phil.

Philippe Mathieu-Daudé (10):
  hw/virtio: Add missing "hw/core/cpu.h" include
  hw/virtio: Rename virtio_ss[] -> specific_virtio_ss[]
  hw/virtio: Constify qmp_virtio_feature_map_t[]
  hw/virtio: Extract config read/write accessors to virtio-config.c
  hw/virtio: Extract QMP related code virtio-qmp.c
  hw/virtio: Cache access_is_big_endian value in VirtIODevice state
  hw/virtio: Directly access cached VirtIODevice::access_is_big_endian
  hw/virtio: Un-inline virtio_access_is_big_endian()
  hw/virtio: Extract vhost_user_ram_slots_max() to vhost-user-target.c
  hw/virtio: Make most of virtio devices target-independent

 hw/9pfs/meson.build               |   2 +-
 hw/block/dataplane/meson.build    |   2 +-
 hw/block/meson.build              |   4 +-
 hw/char/meson.build               |   2 +-
 hw/net/meson.build                |   2 +-
 hw/virtio/meson.build             |  45 +-
 hw/virtio/vhost-user-target.c     |  29 ++
 hw/virtio/vhost-user.c            |  26 +-
 hw/virtio/virtio-config.c         | 224 +++++++++
 hw/virtio/virtio-qmp.c            | 631 +++++++++++++++++++++++
 hw/virtio/virtio-qmp.h            |  20 +
 hw/virtio/virtio.c                | 799 +-----------------------------
 include/hw/virtio/vhost-user.h    |   7 +
 include/hw/virtio/virtio-access.h |  63 +--
 include/hw/virtio/virtio.h        |   1 +
 15 files changed, 974 insertions(+), 883 deletions(-)
 create mode 100644 hw/virtio/vhost-user-target.c
 create mode 100644 hw/virtio/virtio-config.c
 create mode 100644 hw/virtio/virtio-qmp.c
 create mode 100644 hw/virtio/virtio-qmp.h