[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 066/107] ppc: Prevent inifnite loop in decrementer au
From: |
David Gibson |
Subject: |
[Qemu-devel] [PULL 066/107] ppc: Prevent inifnite loop in decrementer auto-reload. |
Date: |
Thu, 2 Feb 2017 16:14:04 +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 044/107] hw/ppc: QOM'ify ppce500_spin.c, (continued)
- [Qemu-devel] [PULL 044/107] hw/ppc: QOM'ify ppce500_spin.c, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 045/107] hw/ppc: QOM'ify spapr_vio.c, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 034/107] ppc: Rewrite ppc_set_compat(), David Gibson, 2017/02/02
- [Qemu-devel] [PULL 027/107] target-ppc: implement lxvl instruction, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 026/107] target-ppc: Add xxperm and xxpermr instructions, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 047/107] target-ppc: Add xxinsertw instruction, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 037/107] qtest: add netfilter tests for ppc64, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 028/107] target-ppc: implement lxvll instruction, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 023/107] target-ppc: Implement bcd_is_valid function, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 036/107] ppc: Validate compatibility modes when setting, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 066/107] ppc: Prevent inifnite loop in decrementer auto-reload.,
David Gibson <=
- [Qemu-devel] [PULL 030/107] target-ppc: implement stxvll instructions, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 033/107] pseries: Add pseries-2.9 machine type, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 038/107] qtest: add display-vga-test to ppc64, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 068/107] target-ppc: xscvqpdp zero VSR, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 035/107] ppc: Rewrite ppc_get_compat_smt_threads(), David Gibson, 2017/02/02
- [Qemu-devel] [PULL 052/107] target-ppc: Replace isden by float64_is_zero_or_denormal, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 063/107] target-ppc: Add xsaddqp instructions, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 041/107] qtest: add ivshmem-test for ppc64, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 065/107] target-ppc: Add xscvqpdp instruction, David Gibson, 2017/02/02
- [Qemu-devel] [PULL 064/107] target-ppc: Add xscvdpqp instruction, David Gibson, 2017/02/02