summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/pci.c11
-rw-r--r--hw/virtio-pci.c10
2 files changed, 14 insertions, 7 deletions
diff --git a/hw/pci.c b/hw/pci.c
index f612e5dde..4588305f6 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -26,7 +26,6 @@
#include "monitor.h"
#include "net.h"
#include "sysemu.h"
-#include "msix.h"
#include "qemu-kvm.h"
#include "hw/pc.h"
#include "device-assignment.h"
@@ -183,14 +182,15 @@ int pci_bus_num(PCIBus *s)
static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
{
PCIDevice *s = container_of(pv, PCIDevice, config);
- uint8_t config[size];
+ uint8_t config[PCI_CONFIG_SPACE_SIZE];
int i;
- qemu_get_buffer(f, config, size);
- for (i = 0; i < size; ++i)
+ assert(size == sizeof config);
+ qemu_get_buffer(f, config, sizeof config);
+ for (i = 0; i < sizeof config; ++i)
if ((config[i] ^ s->config[i]) & s->cmask[i] & ~s->wmask[i])
return -EINVAL;
- memcpy(s->config, config, size);
+ memcpy(s->config, config, sizeof config);
pci_update_mappings(s);
@@ -481,7 +481,6 @@ static int pci_unregister_device(DeviceState *dev)
if (ret)
return ret;
- msix_uninit(pci_dev);
pci_unregister_io_regions(pci_dev);
qemu_free_irqs(pci_dev->irq);
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 01782e580..e07a2a77e 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -454,12 +454,17 @@ static int virtio_blk_init_pci(PCIDevice *pci_dev)
return 0;
}
+static int virtio_exit_pci(PCIDevice *pci_dev)
+{
+ return msix_uninit(pci_dev);
+}
+
static int virtio_blk_exit_pci(PCIDevice *pci_dev)
{
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
drive_uninit(proxy->dinfo);
- return 0;
+ return virtio_exit_pci(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.size = sizeof(VirtIOPCIProxy),
.init = virtio_net_init_pci,
+ .exit = virtio_exit_pci,
.qdev.props = (Property[]) {
DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors,
NIC_NVECTORS_UNSPECIFIED),
@@ -548,6 +554,7 @@ static PCIDeviceInfo virtio_info[] = {
.qdev.name = "virtio-console-pci",
.qdev.size = sizeof(VirtIOPCIProxy),
.init = virtio_console_init_pci,
+ .exit = virtio_exit_pci,
.qdev.props = (Property[]) {
DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
DEFINE_PROP_END_OF_LIST(),
@@ -557,6 +564,7 @@ static PCIDeviceInfo virtio_info[] = {
.qdev.name = "virtio-balloon-pci",
.qdev.size = sizeof(VirtIOPCIProxy),
.init = virtio_balloon_init_pci,
+ .exit = virtio_exit_pci,
.qdev.reset = virtio_pci_reset,
},{
/* end of list */