[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 18/20] pseries: Correctly use the device model reset h
From: |
Andreas Färber |
Subject: |
[Qemu-ppc] [PATCH 18/20] pseries: Correctly use the device model reset hooks |
Date: |
Sun, 15 Apr 2012 20:39:02 +0200 |
From: David Gibson <address@hidden>
Recently we added code to properly clean away VIO CRQs on reset However,
this directly uses qemu_register, rather than the existing device model
reset callbacks. This patch cleans this up by adding proper use of the
reset hook to the VIO bus model. The existing CRQ reset code is converted
to the new method.
Signed-off-by: David Gibson <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
hw/spapr_vio.c | 12 ++++++++----
hw/spapr_vio.h | 1 +
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
index 0bf2c31..fccf48b 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -648,13 +648,18 @@ static int spapr_vio_check_reg(VIOsPAPRDevice *sdev)
return 0;
}
-static void spapr_vio_busdev_reset(void *opaque)
+static void spapr_vio_busdev_reset(DeviceState *qdev)
{
- VIOsPAPRDevice *dev = (VIOsPAPRDevice *)opaque;
+ VIOsPAPRDevice *dev = DO_UPCAST(VIOsPAPRDevice, qdev, qdev);
+ VIOsPAPRDeviceClass *pc = VIO_SPAPR_DEVICE_GET_CLASS(dev);
if (dev->crq.qsize) {
free_crq(dev);
}
+
+ if (pc->reset) {
+ pc->reset(dev);
+ }
}
static int spapr_vio_busdev_init(DeviceState *qdev)
@@ -685,8 +690,6 @@ static int spapr_vio_busdev_init(DeviceState *qdev)
rtce_init(dev);
- qemu_register_reset(spapr_vio_busdev_reset, dev);
-
return pc->init(dev);
}
@@ -776,6 +779,7 @@ static void vio_spapr_device_class_init(ObjectClass *klass,
void *data)
{
DeviceClass *k = DEVICE_CLASS(klass);
k->init = spapr_vio_busdev_init;
+ k->reset = spapr_vio_busdev_reset;
k->bus_info = &spapr_vio_bus_info;
}
diff --git a/hw/spapr_vio.h b/hw/spapr_vio.h
index 626d04f..10ab359 100644
--- a/hw/spapr_vio.h
+++ b/hw/spapr_vio.h
@@ -64,6 +64,7 @@ typedef struct VIOsPAPRDeviceClass {
const char *dt_name, *dt_type, *dt_compatible;
target_ulong signal_mask;
int (*init)(VIOsPAPRDevice *dev);
+ void (*reset)(VIOsPAPRDevice *dev);
int (*devnode)(VIOsPAPRDevice *dev, void *fdt, int node_off);
} VIOsPAPRDeviceClass;
--
1.7.7
- [Qemu-ppc] [PATCH 12/20] target-ppc: Fix type casts for w64 (uintptr_t), (continued)
- [Qemu-ppc] [PATCH 15/20] pseries: Fix RTAS based config access, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 17/20] pseries: Remove old hcalls hook stub, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 20/20] pseries: Fix reset of VIO network device, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 18/20] pseries: Correctly use the device model reset hooks,
Andreas Färber <=
- [Qemu-ppc] [PATCH 14/20] target-ppc/machine.c: Drop unnecessary ifdefs, Andreas Färber, 2012/04/15
- Re: [Qemu-ppc] [Qemu-devel] [PULL] ppc patch queue 2012-04-15, Andreas Färber, 2012/04/15
- Re: [Qemu-ppc] [PULL] ppc patch queue 2012-04-15, Blue Swirl, 2012/04/15
- [Qemu-ppc] [PATCH 02/20] pseries: Clean up hcall_dprintf() debugging messages, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 06/20] pseries: Consolidate hack for RTAS display-character usage, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 19/20] pseries: Reset vscsi properly, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 16/20] pseries: Remove old debug leftovers from spapr_vscsi, Andreas Färber, 2012/04/15