[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-7.2.7 06/62] target/ppc: Decrementer fix BookE semantics
From: |
Michael Tokarev |
Subject: |
[Stable-7.2.7 06/62] target/ppc: Decrementer fix BookE semantics |
Date: |
Thu, 9 Nov 2023 16:58:34 +0300 |
From: Nicholas Piggin <npiggin@gmail.com>
The decrementer store function has logic that short-cuts the timer if a
very small value is stored (0, 1, or 2) and raises an interrupt
directly. There are two problem with this on BookE.
First is that BookE says a decrementer interrupt should not be raised
on a store of 0, only of a decrement from 1. Second is that raising
the irq directly will bypass the auto-reload logic in the booke decr
timer function, breaking autoreload when 1 or 2 is stored.
Fix this by removing that small-value special case. It makes this
tricky logic even more difficult to reason about, and it hardly matters
for performance.
Cc: sdicaro@DDCI.com
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20230530131214.373524-2-npiggin@gmail.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
(cherry picked from commit 17dd1354c1d1aba9caf4af01e11aa7dbe128474f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index 5573ab467c..dfa3945454 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -843,11 +843,7 @@ static void __cpu_ppc_store_decr(PowerPCCPU *cpu, uint64_t
*nextp,
}
/*
- * Going from 2 -> 1, 1 -> 0 or 0 -> -1 is the event to generate a DEC
- * interrupt.
- *
- * If we get a really small DEC value, we can assume that by the time we
- * handled it we should inject an interrupt already.
+ * Going from 1 -> 0 or 0 -> -1 is the event to generate a DEC interrupt.
*
* On MSB level based DEC implementations the MSB always means the
interrupt
* is pending, so raise it on those.
@@ -855,8 +851,7 @@ static void __cpu_ppc_store_decr(PowerPCCPU *cpu, uint64_t
*nextp,
* On MSB edge based DEC implementations the MSB going from 0 -> 1 triggers
* an edge interrupt, so raise it here too.
*/
- if ((value < 3) ||
- ((tb_env->flags & PPC_DECR_UNDERFLOW_LEVEL) && signed_value < 0) ||
+ if (((tb_env->flags & PPC_DECR_UNDERFLOW_LEVEL) && signed_value < 0) ||
((tb_env->flags & PPC_DECR_UNDERFLOW_TRIGGERED) && signed_value < 0
&& signed_decr >= 0)) {
(*raise_excp)(cpu);
--
2.39.2
- [Stable-7.2.7 00/62] Patch Round-up for stable 7.2.7, freeze on 2023-11-19, Michael Tokarev, 2023/11/09
- [Stable-7.2.7 01/62] hw/ppc: Introduce functions for conversion between timebase and nanoseconds, Michael Tokarev, 2023/11/09
- [Stable-7.2.7 03/62] hw/ppc: Round up the decrementer interval when converting to ns, Michael Tokarev, 2023/11/09
- [Stable-7.2.7 02/62] host-utils: Add muldiv64_round_up, Michael Tokarev, 2023/11/09
- [Stable-7.2.7 04/62] hw/ppc: Avoid decrementer rounding errors, Michael Tokarev, 2023/11/09
- [Stable-7.2.7 05/62] target/ppc: Sign-extend large decrementer to 64-bits, Michael Tokarev, 2023/11/09
- [Stable-7.2.7 06/62] target/ppc: Decrementer fix BookE semantics,
Michael Tokarev <=
- [Stable-7.2.7 08/62] linux-user/hppa: clear the PSW 'N' bit when delivering signals, Michael Tokarev, 2023/11/09
- [Stable-7.2.7 10/62] hw/cxl: Fix CFMW config memory leak, Michael Tokarev, 2023/11/09
- [Stable-7.2.7 07/62] hw/ppc: Always store the decrementer value, Michael Tokarev, 2023/11/09
- [Stable-7.2.7 09/62] linux-user/hppa: lock both words of function descriptor, Michael Tokarev, 2023/11/09
- [Stable-7.2.7 11/62] target/arm: Don't skip MTE checks for LDRT/STRT at EL0, Michael Tokarev, 2023/11/09
- [Stable-7.2.7 15/62] ui/vnc: fix handling of VNC_FEATURE_XVP, Michael Tokarev, 2023/11/09
- [Stable-7.2.7 13/62] hw/scsi/scsi-disk: Disallow block sizes smaller than 512 [CVE-2023-42467], Michael Tokarev, 2023/11/09
- [Stable-7.2.7 17/62] esp: use correct type for esp_dma_enable() in sysbus_esp_gpio_demux(), Michael Tokarev, 2023/11/09
- [Stable-7.2.7 12/62] accel/tcg: mttcg remove false-negative halted assertion, Michael Tokarev, 2023/11/09
- [Stable-7.2.7 21/62] tests/tcg/i386: correct mask for VPERM2F128/VPERM2I128, Michael Tokarev, 2023/11/09