aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2025-01-14 21:46:48 +1000
committerReza Arbab <arbab@linux.ibm.com>2025-01-24 12:26:16 -0600
commitf5645b30a66bc63e51fb2e7d2ea2ffecc8688f6e (patch)
treec17caf973fcff9b74aa2695a5e74f79a408ccb46
parentc7c569f9cb477fc5587907da4cc8b2bfaa8181b4 (diff)
downloadskiboot-f5645b30a66bc63e51fb2e7d2ea2ffecc8688f6e.zip
skiboot-f5645b30a66bc63e51fb2e7d2ea2ffecc8688f6e.tar.gz
skiboot-f5645b30a66bc63e51fb2e7d2ea2ffecc8688f6e.tar.bz2
hw/sbe-p9: Better handle SBE timer rate-limiting
SBE timer messages are rate-limited so as not to flood the SBE. 2 timer updates are permitted before the next timer interrupt. The problem with this is that any subsequent sooner timers will not reprogram the interrupt earlier so will be arbitrarily delayed. Change this code to allow 3 updates, and have the 3rd update program the SBE to the minimum expiry time, which gives rate-limiting without compromising timer accuracy. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
-rw-r--r--hw/sbe-p9.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c
index ec2ad3d..bc9a635 100644
--- a/hw/sbe-p9.c
+++ b/hw/sbe-p9.c
@@ -96,7 +96,7 @@ static uint64_t sbe_timer_def_tb;
* We can update inflight timer if new timer request is lesser than inflight
* one. Limit such updates so that SBE gets time to handle FIFO side requests.
*/
-#define SBE_TIMER_UPDATE_MAX 2
+#define SBE_TIMER_UPDATE_MAX 3
static uint32_t timer_update_cnt = 0;
/* Timer control message */
@@ -805,6 +805,10 @@ static void p9_sbe_timer_schedule(void)
u32 tick_us = SBE_TIMER_DEFAULT_US;
u64 tb_cnt, now = mftb();
+ /* Stop sending timer update chipop until inflight timer expires */
+ if (timer_update_cnt == SBE_TIMER_UPDATE_MAX)
+ return;
+
if (sbe_timer_in_progress) {
if (sbe_timer_target >= sbe_last_gen_stamp)
return;
@@ -817,12 +821,8 @@ static void p9_sbe_timer_schedule(void)
return;
}
- /* Stop sending timer update chipop until inflight timer expires */
- if (timer_update_cnt > SBE_TIMER_UPDATE_MAX)
- return;
timer_update_cnt++;
-
- if (now < sbe_timer_target) {
+ if (timer_update_cnt < SBE_TIMER_UPDATE_MAX && now < sbe_timer_target) {
/* Calculate how many microseconds from now, rounded up */
if ((sbe_timer_target - now) > sbe_timer_def_tb) {
tb_cnt = sbe_timer_target - now + usecs_to_tb(1) - 1;