qemu/pci: make pci not depend on msix
Making pci device cleanup msix automatically makes pci.c depend on msix.c, which is IMO messy. Since devices do msix_init it's easy and natural for them to also do msix_uninit. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
05fcfada5e
commit
0f457d91c4
2
hw/pci.c
2
hw/pci.c
@ -26,7 +26,6 @@
|
|||||||
#include "monitor.h"
|
#include "monitor.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "sysemu.h"
|
#include "sysemu.h"
|
||||||
#include "msix.h"
|
|
||||||
|
|
||||||
//#define DEBUG_PCI
|
//#define DEBUG_PCI
|
||||||
#ifdef DEBUG_PCI
|
#ifdef DEBUG_PCI
|
||||||
@ -442,7 +441,6 @@ static int pci_unregister_device(DeviceState *dev)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
msix_uninit(pci_dev);
|
|
||||||
pci_unregister_io_regions(pci_dev);
|
pci_unregister_io_regions(pci_dev);
|
||||||
|
|
||||||
qemu_free_irqs(pci_dev->irq);
|
qemu_free_irqs(pci_dev->irq);
|
||||||
|
@ -454,12 +454,17 @@ static int virtio_blk_init_pci(PCIDevice *pci_dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int virtio_exit_pci(PCIDevice *pci_dev)
|
||||||
|
{
|
||||||
|
return msix_uninit(pci_dev);
|
||||||
|
}
|
||||||
|
|
||||||
static int virtio_blk_exit_pci(PCIDevice *pci_dev)
|
static int virtio_blk_exit_pci(PCIDevice *pci_dev)
|
||||||
{
|
{
|
||||||
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
|
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
|
||||||
|
|
||||||
drive_uninit(proxy->dinfo);
|
drive_uninit(proxy->dinfo);
|
||||||
return 0;
|
return virtio_exit_pci(pci_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtio_console_init_pci(PCIDevice *pci_dev)
|
static int virtio_console_init_pci(PCIDevice *pci_dev)
|
||||||
@ -538,6 +543,7 @@ static PCIDeviceInfo virtio_info[] = {
|
|||||||
.qdev.name = "virtio-net-pci",
|
.qdev.name = "virtio-net-pci",
|
||||||
.qdev.size = sizeof(VirtIOPCIProxy),
|
.qdev.size = sizeof(VirtIOPCIProxy),
|
||||||
.init = virtio_net_init_pci,
|
.init = virtio_net_init_pci,
|
||||||
|
.exit = virtio_exit_pci,
|
||||||
.qdev.props = (Property[]) {
|
.qdev.props = (Property[]) {
|
||||||
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors,
|
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors,
|
||||||
NIC_NVECTORS_UNSPECIFIED),
|
NIC_NVECTORS_UNSPECIFIED),
|
||||||
@ -548,6 +554,7 @@ static PCIDeviceInfo virtio_info[] = {
|
|||||||
.qdev.name = "virtio-console-pci",
|
.qdev.name = "virtio-console-pci",
|
||||||
.qdev.size = sizeof(VirtIOPCIProxy),
|
.qdev.size = sizeof(VirtIOPCIProxy),
|
||||||
.init = virtio_console_init_pci,
|
.init = virtio_console_init_pci,
|
||||||
|
.exit = virtio_exit_pci,
|
||||||
.qdev.props = (Property[]) {
|
.qdev.props = (Property[]) {
|
||||||
DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
|
DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
@ -557,6 +564,7 @@ static PCIDeviceInfo virtio_info[] = {
|
|||||||
.qdev.name = "virtio-balloon-pci",
|
.qdev.name = "virtio-balloon-pci",
|
||||||
.qdev.size = sizeof(VirtIOPCIProxy),
|
.qdev.size = sizeof(VirtIOPCIProxy),
|
||||||
.init = virtio_balloon_init_pci,
|
.init = virtio_balloon_init_pci,
|
||||||
|
.exit = virtio_exit_pci,
|
||||||
.qdev.reset = virtio_pci_reset,
|
.qdev.reset = virtio_pci_reset,
|
||||||
},{
|
},{
|
||||||
/* end of list */
|
/* end of list */
|
||||||
|
Loading…
Reference in New Issue
Block a user