All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/12] qom: resolve type name conflicts, avoid target_info() in class_init or type_init
@ 2026-10-31 16:39 Yonggang Luo
  2026-10-31 16:39 ` [PATCH v2 01/12] target-info: add target_loongarch() Yonggang Luo
                   ` (11 more replies)
  0 siblings, 12 replies; 28+ messages in thread
From: Yonggang Luo @ 2026-10-31 16:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Paolo Bonzini, qemu-arm, Song Gao,
	Matthew Rosato, Philippe Mathieu-Daude, David Hildenbrand,
	Philippe Mathieu-Daudé, Fam Zheng, Max Filippov, qemu-s390x,
	Jiaxun Yang, Edgar E. Iglesias, Eric Farman, Peter Maydell,
	Cornelia Huck, Pierrick Bouvier

The goal is a single binary that links several targets, where every QOM type is
registered once for all of them. Types that share a name go into one bucket per
name, each variant tagged with the targets it serves, and the selected target
picks the variant at lookup time. For that to work, registering a type and
building its class must not depend on which target is selected.

Today some class_init and type_init functions call target_info(), directly or
through helpers such as target_s390x(). The result is fixed for the one target
selected when the class is built, so the other targets never get their own form
of that type.

max-v8 called target_aarch64() from its type_init to pick an instance
initializer. scsi-hd, scsi-cd, virtio-blk-pci, virtio-net-pci and virtio-mem
called target_s390x() or target_arch() from class_init to add properties. The
PetaLogix machine called target_big_endian() from class_init to set the default
endianness.

Instead, each target-specific form becomes its own TypeInfo under the same name.
Its is_available callback says which target it belongs to. Today QOM registers
only the one that matches; a bucket can later keep all of them. LoongArch and
Xtensa virt machines are handled the same way, since both share the virt-machine
name. PetaLogix keeps one type: its endianness default is "unspecified" until
the machine starts. A few target_*() helpers are added for the new callbacks.

v1: https://lore.kernel.org/qemu-devel/20261028201557.2688-1-luoyonggang@gmail.com/

Changes v1 -> v2:

- Drop target_not_s390x() from target-info. v1 exported it for scsi-disk,
  virtio-blk-pci, and virtio-net-pci. Each file keeps a static copy
- Drop target_not_base_i386() from target-info. Keep target_base_i386(), and a
  static target_not_base_i386() in virtio-mem
- Split hw/xtensa/virt: select virt machine types with is_available out of the
  DEFINE_MACHINE expansion, so later only that small patch needs a revert

Yonggang Luo (12):
  target-info: add target_loongarch()
  hw/loongarch/virt: select virt machine types with is_available
  target-info: add target_xtensa()
  hw/xtensa: expand DEFINE_MACHINE in virt.c
  hw/xtensa/virt: select virt machine types with is_available
  target/arm: register separate max-v8 CPU types for arm and aarch64
  hw/scsi/scsi-disk: register s390x scsi-hd and scsi-cd variants
  hw/virtio/virtio-pci: pass is_available through
    VirtioPCIDeviceTypeInfo
  hw/virtio: register s390x virtio-blk-pci and virtio-net-pci variants
  target-info: add target_base_i386()
  hw/virtio/virtio-mem: register legacy-guest variant with is_available
  hw/microblaze: defer PetaLogix endianness default until init

 hw/loongarch/virt.c                      |  3 ++
 hw/microblaze/petalogix_s3adsp1800_mmu.c | 11 +++--
 hw/pci/pci.c                             | 13 +++---
 hw/scsi/scsi-disk.c                      | 48 +++++++++++++++++-----
 hw/virtio/virtio-blk-pci.c               | 27 +++++++++++-
 hw/virtio/virtio-mem.c                   | 52 +++++++++++++++---------
 hw/virtio/virtio-net-pci.c               | 27 +++++++++++-
 hw/virtio/virtio-pci.c                   |  4 ++
 hw/xtensa/virt.c                         | 20 ++++++++-
 include/hw/virtio/virtio-mem.h           |  2 +
 include/hw/virtio/virtio-pci.h           |  1 +
 include/qemu/target-info.h               | 21 ++++++++++
 target-info.c                            | 27 ++++++++++++
 target/arm/cpu.c                         |  1 +
 target/arm/cpu.h                         |  1 +
 target/arm/tcg/cpu-max-v8.c              | 16 ++++++--
 16 files changed, 225 insertions(+), 49 deletions(-)

-- 
2.55.0.windows.3



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

end of thread, other threads:[~2026-11-05 14:17 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-31 16:39 [PATCH v2 00/12] qom: resolve type name conflicts, avoid target_info() in class_init or type_init Yonggang Luo
2026-10-31 16:39 ` [PATCH v2 01/12] target-info: add target_loongarch() Yonggang Luo
2026-10-31 16:39 ` [PATCH v2 02/12] hw/loongarch/virt: select virt machine types with is_available Yonggang Luo
2026-10-31 16:39 ` [PATCH v2 03/12] target-info: add target_xtensa() Yonggang Luo
2026-10-31 16:39 ` [PATCH v2 04/12] hw/xtensa: expand DEFINE_MACHINE in virt.c Yonggang Luo
2026-11-01  3:15   ` Yonggang Luo
2026-10-31 16:40 ` [PATCH v2 05/12] hw/xtensa/virt: select virt machine types with is_available Yonggang Luo
2026-10-31 16:40 ` [PATCH v2 06/12] target/arm: register separate max-v8 CPU types for arm and aarch64 Yonggang Luo
2026-11-05 10:55   ` Daniel P. Berrangé
2026-11-05 11:14     ` Yonggang Luo
2026-11-05 12:42       ` Daniel P. Berrangé
2026-11-05 13:25         ` Yonggang Luo
2026-11-05 14:16           ` Daniel P. Berrangé
2026-11-05 13:45         ` Peter Maydell
2026-11-05 13:48           ` Daniel P. Berrangé
2026-11-05 13:56             ` Peter Maydell
2026-11-05 14:03               ` Daniel P. Berrangé
2026-10-31 16:40 ` [PATCH v2 07/12] hw/scsi/scsi-disk: register s390x scsi-hd and scsi-cd variants Yonggang Luo
2026-11-05 11:02   ` Daniel P. Berrangé
2026-10-31 16:40 ` [PATCH v2 08/12] hw/virtio/virtio-pci: pass is_available through VirtioPCIDeviceTypeInfo Yonggang Luo
2026-10-31 16:40 ` [PATCH v2 09/12] hw/virtio: register s390x virtio-blk-pci and virtio-net-pci variants Yonggang Luo
2026-11-05 11:03   ` Daniel P. Berrangé
2026-11-05 11:20     ` Yonggang Luo
2026-11-05 11:38       ` Daniel P. Berrangé
2026-10-31 16:40 ` [PATCH v2 10/12] target-info: add target_base_i386() Yonggang Luo
2026-10-31 16:40 ` [PATCH v2 11/12] hw/virtio/virtio-mem: register legacy-guest variant with is_available Yonggang Luo
2026-11-05 11:07   ` Daniel P. Berrangé
2026-10-31 16:40 ` [PATCH v2 12/12] hw/microblaze: defer PetaLogix endianness default until init Yonggang Luo

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.