[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 66/67] ppc: Prevent inifnite loop in decrementer auto
From: |
David Gibson |
Subject: |
[Qemu-devel] [PULL 66/67] ppc: Prevent inifnite loop in decrementer auto-reload. |
Date: |
Thu, 12 Jan 2017 13:03:26 +1100 |
From: Roman Kapl <address@hidden>
If the DECAR register is set to 0, QEMU tries to reload the decrementer with
zero in an inifinite loop. According to PPC documentation, the decrementer is
triggered on 1->0 transition, so avoid reloading the decrementer if if is
already zero.
The problem does not manifest under Linux, but it is valid to set DECAR to zero
(and may make sense as part of decrementer initialization when interrupts are
disabled).
Signed-off-by: Roman Kapl <address@hidden>
[dwg: Fixed style nit]
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/ppc_booke.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c
index ab8d026..60baffa 100644
--- a/hw/ppc/ppc_booke.c
+++ b/hw/ppc/ppc_booke.c
@@ -198,8 +198,12 @@ static void booke_decr_cb(void *opaque)
booke_update_irq(cpu);
if (env->spr[SPR_BOOKE_TCR] & TCR_ARE) {
- /* Auto Reload */
- cpu_ppc_store_decr(env, env->spr[SPR_BOOKE_DECAR]);
+ /* Do not reload 0, it is already there. It would just trigger
+ * the timer again and lead to infinite loop */
+ if (env->spr[SPR_BOOKE_DECAR] != 0) {
+ /* Auto Reload */
+ cpu_ppc_store_decr(env, env->spr[SPR_BOOKE_DECAR]);
+ }
}
}
--
2.9.3
- [Qemu-devel] [PULL 17/67] ppc: Clean up and QOMify hypercall emulation, (continued)
- [Qemu-devel] [PULL 17/67] ppc: Clean up and QOMify hypercall emulation, David Gibson, 2017/01/11
- [Qemu-devel] [PULL 35/67] ppc: Rewrite ppc_get_compat_smt_threads(), David Gibson, 2017/01/11
- [Qemu-devel] [PULL 39/67] libqos: fix spapr qpci_map(), David Gibson, 2017/01/11
- [Qemu-devel] [PULL 44/67] hw/ppc: QOM'ify ppce500_spin.c, David Gibson, 2017/01/11
- [Qemu-devel] [PULL 43/67] hw/ppc: QOM'ify e500.c, David Gibson, 2017/01/11
- [Qemu-devel] [PULL 67/67] ppc: Fix a warning in bcdcfz code and improve BCD_DIG_BYTE macro, David Gibson, 2017/01/11
- [Qemu-devel] [PULL 50/67] prep: add IBM RS/6000 7020 (40p) machine emulation, David Gibson, 2017/01/11
- [Qemu-devel] [PULL 65/67] target-ppc: Add xscvqpdp instruction, David Gibson, 2017/01/11
- [Qemu-devel] [PULL 52/67] target-ppc: Replace isden by float64_is_zero_or_denormal, David Gibson, 2017/01/11
- [Qemu-devel] [PULL 48/67] prep: add PReP System I/O, David Gibson, 2017/01/11
- [Qemu-devel] [PULL 66/67] ppc: Prevent inifnite loop in decrementer auto-reload.,
David Gibson <=
- [Qemu-devel] [PULL 53/67] target-ppc: Rename helper_compute_fprf to helper_compute_fprf_float64, David Gibson, 2017/01/11
- [Qemu-devel] [PULL 55/67] target-ppc: Use correct precision for FPRF setting, David Gibson, 2017/01/11
- [Qemu-devel] [PULL 63/67] target-ppc: Add xsaddqp instructions, David Gibson, 2017/01/11
- [Qemu-devel] [PULL 54/67] target-ppc: Add xscvdphp, xscvhpdp, David Gibson, 2017/01/11
- [Qemu-devel] [PULL 61/67] pseries: Rewrite CAS PVR compatibility logic, David Gibson, 2017/01/11
- Re: [Qemu-devel] [PULL 00/67] ppc-for-2.9 queue 20170112, no-reply, 2017/01/11
- Re: [Qemu-devel] [PULL 00/67] ppc-for-2.9 queue 20170112, Peter Maydell, 2017/01/13