[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 25/29] target/ppc: Decrementer fix BookE semantics
From: |
Daniel Henrique Barboza |
Subject: |
[PULL 25/29] target/ppc: Decrementer fix BookE semantics |
Date: |
Sat, 10 Jun 2023 10:31:28 -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>
---
hw/ppc/ppc.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index d80b0adc6c..1b1220c423 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -811,11 +811,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.
@@ -823,8 +819,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.40.1
- [PULL 15/29] target/ppc: Move ppcemb_tlb_search() to mmu_common.c, (continued)
- [PULL 15/29] target/ppc: Move ppcemb_tlb_search() to mmu_common.c, Daniel Henrique Barboza, 2023/06/10
- [PULL 16/29] target/ppc: Remove some unneded line breaks, Daniel Henrique Barboza, 2023/06/10
- [PULL 17/29] target/ppc: Simplify ppcemb_tlb_search(), Daniel Henrique Barboza, 2023/06/10
- [PULL 18/29] target/ppc: Change ppcemb_tlb_check() to return bool, Daniel Henrique Barboza, 2023/06/10
- [PULL 19/29] target/ppc: Eliminate goto in mmubooke_check_tlb(), Daniel Henrique Barboza, 2023/06/10
- [PULL 20/29] target/ppc: Fix lqarx to set cpu_reserve, Daniel Henrique Barboza, 2023/06/10
- [PULL 22/29] target/ppc: Remove larx/stcx. memory barrier semantics, Daniel Henrique Barboza, 2023/06/10
- [PULL 23/29] target/ppc: Rework store conditional to avoid branch, Daniel Henrique Barboza, 2023/06/10
- [PULL 21/29] target/ppc: Ensure stcx size matches larx, Daniel Henrique Barboza, 2023/06/10
- [PULL 24/29] target/ppc: Fix decrementer time underflow and infinite timer loop, Daniel Henrique Barboza, 2023/06/10
- [PULL 25/29] target/ppc: Decrementer fix BookE semantics,
Daniel Henrique Barboza <=
- [PULL 26/29] hw/ppc/openpic: Do not open-code ROUND_UP() macro, Daniel Henrique Barboza, 2023/06/10
- [PULL 27/29] tests/avocado/tuxrun_baselines: Fix ppc64 tests for binaries without slirp, Daniel Henrique Barboza, 2023/06/10
- [PULL 28/29] target/ppc: Implement gathering irq statistics, Daniel Henrique Barboza, 2023/06/10
- [PULL 29/29] hw/ppc/Kconfig: MAC_NEWWORLD should always select USB_OHCI_PCI, Daniel Henrique Barboza, 2023/06/10
- Re: [PULL 00/29] ppc queue, Richard Henderson, 2023/06/10