All of lore.kernel.org
 help / color / mirror / Atom feed
* About the instance_finalize callback in VFIO PCI
@ 2023-03-20  9:31 Yang Zhong
  2023-03-21 17:30 ` Cédric Le Goater
  0 siblings, 1 reply; 9+ messages in thread
From: Yang Zhong @ 2023-03-20  9:31 UTC (permalink / raw)
  To: Alex Williamson, Paolo Bonzini; +Cc: qemu-devel, yang.zhong

Hello Alex and Paolo,

There is one instance_finalize callback definition in hw/vfio/pci.c, but
i find this callback(vfio_instance_finalize()) never be called during the
VM shutdown with close VM or "init 0" command in guest.

The Qemu related command:
   ......
   -device vfio-pci,host=d9:00.0
   ......

static const TypeInfo vfio_pci_dev_info = {
    .name = TYPE_VFIO_PCI,
    .parent = TYPE_PCI_DEVICE,
    .instance_size = sizeof(VFIOPCIDevice),
    .class_init = vfio_pci_dev_class_init,
    .instance_init = vfio_instance_init,
    .instance_finalize = vfio_instance_finalize,
    .interfaces = (InterfaceInfo[]) {
        { INTERFACE_PCIE_DEVICE },
        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
        { }
    },
};

If my test method is wrong, would you please tell me how to trigger to
this callback when VM shutdown? thanks.

By the way, i also debugged other instance_finalize callback functions,
if my understanding is right, all instance_finalize callback should be
called from object_unref(object) from qemu_cleanup(void) in
./softmmu/runstate.c. But there is no VFIO related object_unref() call in
this cleanup function, So the instance_finalize callback in vfio pci
should be useless? thanks!

Regards,
Yang



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

end of thread, other threads:[~2023-03-23  5:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-20  9:31 About the instance_finalize callback in VFIO PCI Yang Zhong
2023-03-21 17:30 ` Cédric Le Goater
2023-03-21 20:44   ` Paolo Bonzini
2023-03-22 12:39     ` Yang Zhong
2023-03-22 12:28   ` Yang Zhong
2023-03-22 12:56     ` Cédric Le Goater
2023-03-22 13:10       ` Yang Zhong
2023-03-22 18:22         ` Alex Williamson
2023-03-23  5:58           ` Yang Zhong

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.