[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 03/20] pseries: Fix bug with reset of VIO CRQs
From: |
Andreas Färber |
Subject: |
[Qemu-ppc] [PATCH 03/20] pseries: Fix bug with reset of VIO CRQs |
Date: |
Sun, 15 Apr 2012 20:38:47 +0200 |
From: David Gibson <address@hidden>
PAPR specifies a Command Response Queue (CRQ) mechanism used for virtual
IO, which we implement. However, we don't correctly clean up registered
CRQs when we reset the system.
This patch adds a reset handler to fix this bug. While we're at it, add
in some of the extra debug messages that were used to track the problem
down.
Signed-off-by: David Gibson <address@hidden>
[AF: Updated hcall_dprintf()s to not duplicate the function name]
Signed-off-by: Andreas Färber <address@hidden>
---
hw/spapr_vio.c | 33 +++++++++++++++++++++++++--------
1 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
index 1f67e64..0bf2c31 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -431,12 +431,13 @@ static target_ulong h_reg_crq(CPUPPCState *env,
sPAPREnvironment *spapr,
/* Check if device supports CRQs */
if (!dev->crq.SendFunc) {
+ hcall_dprintf("Device does not support CRQ\n");
return H_NOT_FOUND;
}
-
/* Already a queue ? */
if (dev->crq.qsize) {
+ hcall_dprintf("CRQ already registered\n");
return H_RESOURCE;
}
dev->crq.qladdr = queue_addr;
@@ -449,6 +450,17 @@ static target_ulong h_reg_crq(CPUPPCState *env,
sPAPREnvironment *spapr,
return H_SUCCESS;
}
+static target_ulong free_crq(VIOsPAPRDevice *dev)
+{
+ dev->crq.qladdr = 0;
+ dev->crq.qsize = 0;
+ dev->crq.qnext = 0;
+
+ dprintf("CRQ for dev 0x%" PRIx32 " freed\n", dev->reg);
+
+ return H_SUCCESS;
+}
+
static target_ulong h_free_crq(CPUPPCState *env, sPAPREnvironment *spapr,
target_ulong opcode, target_ulong *args)
{
@@ -460,13 +472,7 @@ static target_ulong h_free_crq(CPUPPCState *env,
sPAPREnvironment *spapr,
return H_PARAMETER;
}
- dev->crq.qladdr = 0;
- dev->crq.qsize = 0;
- dev->crq.qnext = 0;
-
- dprintf("CRQ for dev 0x" TARGET_FMT_lx " freed\n", reg);
-
- return H_SUCCESS;
+ return free_crq(dev);
}
static target_ulong h_send_crq(CPUPPCState *env, sPAPREnvironment *spapr,
@@ -642,6 +648,15 @@ static int spapr_vio_check_reg(VIOsPAPRDevice *sdev)
return 0;
}
+static void spapr_vio_busdev_reset(void *opaque)
+{
+ VIOsPAPRDevice *dev = (VIOsPAPRDevice *)opaque;
+
+ if (dev->crq.qsize) {
+ free_crq(dev);
+ }
+}
+
static int spapr_vio_busdev_init(DeviceState *qdev)
{
VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev;
@@ -670,6 +685,8 @@ static int spapr_vio_busdev_init(DeviceState *qdev)
rtce_init(dev);
+ qemu_register_reset(spapr_vio_busdev_reset, dev);
+
return pc->init(dev);
}
--
1.7.7
- [Qemu-ppc] [PULL] ppc patch queue 2012-04-15, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 01/20] PPC: Fix TLB invalidation bug within the PPC interrupt handler., Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 03/20] pseries: Fix bug with reset of VIO CRQs,
Andreas Färber <=
- [Qemu-ppc] [PATCH 04/20] pseries: Implement RTAS system-reboot call, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 05/20] pseries: Remove unused fields from VIOsPAPRBus structure, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 07/20] target-ppc: Drop cpu_ppc_close(), Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 11/20] target-ppc: QOM'ify CPU reset, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 09/20] target-ppc: QOM'ify CPU, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 12/20] target-ppc: Fix type casts for w64 (uintptr_t), Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 10/20] target-ppc: Start QOM'ifying CPU init, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 13/20] target-ppc: Init dcache and icache size for e500 user mode, Andreas Färber, 2012/04/15
- [Qemu-ppc] [PATCH 08/20] target-ppc: Add hooks for handling tcg and kvm limitations, Andreas Färber, 2012/04/15