[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 4/5] pci: Allow pci_device_save() to return erro
From: |
Alex Williamson |
Subject: |
[Qemu-devel] [RFC PATCH 4/5] pci: Allow pci_device_save() to return error |
Date: |
Tue, 05 Oct 2010 14:35:51 -0600 |
User-agent: |
StGIT/0.14.3 |
Carry the vmsd pre_save error reporting through pci_device_save().
Signed-off-by: Alex Williamson <address@hidden>
---
hw/grackle_pci.c | 4 +---
hw/gt64xxx.c | 3 +--
hw/ivshmem.c | 5 ++++-
hw/openpic.c | 4 +---
hw/pci.c | 8 ++++++--
hw/pci.h | 2 +-
hw/piix4.c | 3 +--
hw/ppc4xx_pci.c | 6 ++++--
hw/ppce500_pci.c | 6 ++++--
hw/unin_pci.c | 4 +---
10 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/hw/grackle_pci.c b/hw/grackle_pci.c
index f6905fb..c7164c5 100644
--- a/hw/grackle_pci.c
+++ b/hw/grackle_pci.c
@@ -61,9 +61,7 @@ static int pci_grackle_save(QEMUFile* f, void *opaque)
{
PCIDevice *d = opaque;
- pci_device_save(d, f);
-
- return 0;
+ return pci_device_save(d, f);
}
static int pci_grackle_load(QEMUFile* f, void *opaque, int version_id)
diff --git a/hw/gt64xxx.c b/hw/gt64xxx.c
index 7d8c3b3..21a0e57 100644
--- a/hw/gt64xxx.c
+++ b/hw/gt64xxx.c
@@ -1089,8 +1089,7 @@ static void gt64120_reset(void *opaque)
static int gt64120_save(QEMUFile* f, void *opaque)
{
PCIDevice *d = opaque;
- pci_device_save(d, f);
- return 0;
+ return pci_device_save(d, f);
}
static int gt64120_load(QEMUFile* f, void *opaque, int version_id)
diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index f0cfed5..07a9fef 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -619,6 +619,7 @@ static void ivshmem_setup_msi(IVShmemState * s) {
static int ivshmem_save(QEMUFile* f, void *opaque)
{
IVShmemState *proxy = opaque;
+ int ret;
IVSHMEM_DPRINTF("ivshmem_save\n");
@@ -626,7 +627,9 @@ static int ivshmem_save(QEMUFile* f, void *opaque)
return -EINVAL;
}
- pci_device_save(&proxy->dev, f);
+ if ((ret = pci_device_save(&proxy->dev, f))) {
+ return ret;
+ }
if (ivshmem_has_feature(proxy, IVSHMEM_MSI)) {
msix_save(&proxy->dev, f);
diff --git a/hw/openpic.c b/hw/openpic.c
index 4ca4ba3..4537239 100644
--- a/hw/openpic.c
+++ b/hw/openpic.c
@@ -1102,9 +1102,7 @@ static int openpic_save(QEMUFile* f, void *opaque)
}
#endif
- pci_device_save(&opp->pci_dev, f);
-
- return 0;
+ return pci_device_save(&opp->pci_dev, f);
}
static void openpic_load_IRQ_queue(QEMUFile* f, IRQ_queue_t *q)
diff --git a/hw/pci.c b/hw/pci.c
index 15416dd..dc42844 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -434,16 +434,20 @@ static inline const VMStateDescription
*pci_get_vmstate(PCIDevice *s)
return pci_is_express(s) ? &vmstate_pcie_device : &vmstate_pci_device;
}
-void pci_device_save(PCIDevice *s, QEMUFile *f)
+int pci_device_save(PCIDevice *s, QEMUFile *f)
{
+ int ret;
/* Clear interrupt status bit: it is implicit
* in irq_state which we are saving.
* This makes us compatible with old devices
* which never set or clear this bit. */
s->config[PCI_STATUS] &= ~PCI_STATUS_INTERRUPT;
- vmstate_save_state(f, pci_get_vmstate(s), s);
+ if ((ret = vmstate_save_state(f, pci_get_vmstate(s), s))) {
+ return ret;
+ }
/* Restore the interrupt status bit. */
pci_update_irq_status(s);
+ return 0;
}
int pci_device_load(PCIDevice *s, QEMUFile *f)
diff --git a/hw/pci.h b/hw/pci.h
index 3d23f03..bb9ad79 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -198,7 +198,7 @@ uint32_t pci_default_read_config(PCIDevice *d,
uint32_t address, int len);
void pci_default_write_config(PCIDevice *d,
uint32_t address, uint32_t val, int len);
-void pci_device_save(PCIDevice *s, QEMUFile *f);
+int pci_device_save(PCIDevice *s, QEMUFile *f);
int pci_device_load(PCIDevice *s, QEMUFile *f);
typedef void (*pci_set_irq_fn)(void *opaque, int irq_num, int level);
diff --git a/hw/piix4.c b/hw/piix4.c
index 5209061..9f560ac 100644
--- a/hw/piix4.c
+++ b/hw/piix4.c
@@ -71,8 +71,7 @@ static void piix4_reset(void *opaque)
static int piix_save(QEMUFile* f, void *opaque)
{
PCIDevice *d = opaque;
- pci_device_save(d, f);
- return 0;
+ return pci_device_save(d, f);
}
static int piix_load(QEMUFile* f, void *opaque, int version_id)
diff --git a/hw/ppc4xx_pci.c b/hw/ppc4xx_pci.c
index 7507d08..2998149 100644
--- a/hw/ppc4xx_pci.c
+++ b/hw/ppc4xx_pci.c
@@ -301,9 +301,11 @@ static void ppc4xx_pci_set_irq(void *opaque, int irq_num,
int level)
static int ppc4xx_pci_save(QEMUFile *f, void *opaque)
{
PPC4xxPCIState *controller = opaque;
- int i;
+ int i, ret;
- pci_device_save(controller->pci_dev, f);
+ if ((ret = pci_device_save(controller->pci_dev, f))) {
+ return ret;
+ }
for (i = 0; i < PPC4xx_PCI_NR_PMMS; i++) {
qemu_put_be32s(f, &controller->pmm[i].la);
diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c
index 9babe05..57c20dc 100644
--- a/hw/ppce500_pci.c
+++ b/hw/ppce500_pci.c
@@ -219,9 +219,11 @@ static void mpc85xx_pci_set_irq(void *opaque, int irq_num,
int level)
static int ppce500_pci_save(QEMUFile *f, void *opaque)
{
PPCE500PCIState *controller = opaque;
- int i;
+ int i, ret;
- pci_device_save(controller->pci_dev, f);
+ if ((ret = pci_device_save(controller->pci_dev, f))) {
+ return ret;
+ }
for (i = 0; i < PPCE500_PCI_NR_POBS; i++) {
qemu_put_be32s(f, &controller->pob[i].potar);
diff --git a/hw/unin_pci.c b/hw/unin_pci.c
index ca15a00..28b9836 100644
--- a/hw/unin_pci.c
+++ b/hw/unin_pci.c
@@ -67,9 +67,7 @@ static int pci_unin_save(QEMUFile* f, void *opaque)
{
PCIDevice *d = opaque;
- pci_device_save(d, f);
-
- return 0;
+ return pci_device_save(d, f);
}
static int pci_unin_load(QEMUFile* f, void *opaque, int version_id)
- [Qemu-devel] [RFC PATCH 0/5] Save state error handling (kill off no_migrate), Alex Williamson, 2010/10/05
- [Qemu-devel] [RFC PATCH 2/5] savevm: Remove register_device_unmigratable(), Alex Williamson, 2010/10/05
- [Qemu-devel] [RFC PATCH 1/5] savevm: Allow SaveStateHandler() to return error, Alex Williamson, 2010/10/05
- [Qemu-devel] [RFC PATCH 3/5] savevm: Allow vmsd->pre_save to return error, Alex Williamson, 2010/10/05
- [Qemu-devel] [RFC PATCH 4/5] pci: Allow pci_device_save() to return error,
Alex Williamson <=
- [Qemu-devel] [RFC PATCH 5/5] virtio: Allow virtio_save() errors, Alex Williamson, 2010/10/05
- [Qemu-devel] Re: [RFC PATCH 0/5] Save state error handling (kill off no_migrate), Anthony Liguori, 2010/10/05