All of lore.kernel.org
 help / color / mirror / Atom feed
* migration, PCIE ports, and parent_obj.parent_obj.parent_obj
@ 2026-10-26 16:11 Peter Maydell
  2026-10-26 16:19 ` Michael S. Tsirkin
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2026-10-26 16:11 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Peter Xu, Fabiano Rosas, Michael S. Tsirkin

In reviewing a new pcie host bridge, I noticed (because this new device
copied existing code) that the vmstate structs for pcie root ports do
this in their vmstate structs:

    .fields = (const VMStateField[]) {
        VMSTATE_PCI_DEVICE(parent_obj.parent_obj.parent_obj, PCIESlot),
        VMSTATE_STRUCT(parent_obj.parent_obj.parent_obj.exp.aer_log,
                       PCIESlot, 0, vmstate_pcie_aer_log, PCIEAERLog),
        VMSTATE_MSIX(parent_obj.parent_obj.parent_obj.parent_obj,
                     GenPCIERootPort),
        VMSTATE_END_OF_LIST()
    }

(this specific example is hw/pci-bridge/gen_pcie_root_port.c).

Devices shouldn't have to have ugly long chains of "parent_obj"
like this and shouldn't have to care what in their parents needs
migration; compare e.g. SCSI devices, which start with a
"VMSTATE_SCSI_DEVICE" that captures all the parent class's needs,
followed by only the state that the child added.

How can we get to something more like that for PCIE port classes?

thanks
-- PMM


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

end of thread, other threads:[~2026-10-26 20:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-26 16:11 migration, PCIE ports, and parent_obj.parent_obj.parent_obj Peter Maydell
2026-10-26 16:19 ` Michael S. Tsirkin
2026-10-26 17:38   ` Peter Xu
2026-10-26 19:10     ` Peter Maydell
2026-10-26 20:00       ` Peter Xu

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.