hw/sbe-p9: Limit SBE timer to 10s
The SBE in P10 has a maximum expiry limit of just over 10s, so limit
SBE timers to 10s. If the desired timeout is longer than 10s,
additional SBE timers will be scheduled as the 10s timers are
serviced.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c
index 5e83ac8..6140453 100644
--- a/hw/sbe-p9.c
+++ b/hw/sbe-p9.c
@@ -90,6 +90,8 @@
*/
#define SBE_TIMER_MIN_US_P9 500
+#define SBE_TIMER_MAX_US 10000000
+
static uint64_t sbe_timer_min_us;
static uint64_t sbe_timer_min_tb;
@@ -827,8 +829,11 @@
if ((sbe_timer_target - now) > sbe_timer_min_tb) {
tb_cnt = sbe_timer_target - now + usecs_to_tb(1) - 1;
tick_us = tb_to_usecs(tb_cnt);
+ if (tick_us > SBE_TIMER_MAX_US)
+ tick_us = SBE_TIMER_MAX_US;
}
}
+
sbe_current_timer_tb = now + usecs_to_tb(tick_us);
/* Clear sequence number. p9_sbe_queue_msg will add new sequene ID */