qom: resolve type name conflicts, avoid target_info() in class_init or type_init
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest12 patches 15 repliesIn review
- v112 patches 15 repliesSuperseded
Changes in v2 from the cover letter
- 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
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/12 | target-info: add target_loongarch()include/ target-info.c | +12 | 0 replies | |
| 2/12 | hw/loongarch/virt: select virt machine types with is_availablehw/ | +3 | 0 replies | |
| 3/12 | target-info: add target_xtensa()include/ target-info.c | +18 | 0 replies | |
| 4/12 | hw/xtensa: expand DEFINE_MACHINE in virt.chw/ | +16 | 1 reply | |
| 5/12 | hw/xtensa/virt: select virt machine types with is_availablehw/ | +2 | 0 replies | |
| 6/12 | target/arm: register separate max-v8 CPU types for arm and aarch64target/ target/ target/ | +14 | 9 replies | |
| 7/12 | hw/scsi/scsi-disk: register s390x scsi-hd and scsi-cd variantshw/ | +38 | 1 reply | |
| 8/12 | hw/virtio/virtio-pci: pass is_available through VirtioPCIDeviceTypeInfohw/ include/ | +5 | 0 replies | |
| 9/12 | hw/virtio: register s390x virtio-blk-pci and virtio-net-pci variantshw/ hw/ hw/ | +57 | 3 replies | |
| 10/12 | target-info: add target_base_i386()include/ target-info.c | +18 | 0 replies | |
| 11/12 | hw/virtio/virtio-mem: register legacy-guest variant with is_availablehw/ include/ | +34 | 1 reply | |
| 12/12 | hw/microblaze: defer PetaLogix endianness default until inithw/ | +8 | 0 replies |
Reviews trailers per patch
6 of 12 patches have a Reviewed-by or Acked-by.
| Patch | Pierrick Bouvier |
|---|---|
| 1/12 | R-b |
| 2/12 | R-b |
| 3/12 | R-b |
| 4/12 | |
| 5/12 | R-b |
| 6/12 | R-b |
| 7/12 | |
| 8/12 | |
| 9/12 | |
| 10/12 | |
| 11/12 | |
| 12/12 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 00/12] qom: resolve type name conflicts, avoid target_info() in class_init or type_init
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/[email protected]/
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(-)
Signature · 1 line
2.55.0.windows.3