diff --git a/drivers/arm/gic/v3/gicv3_helpers.c b/drivers/arm/gic/v3/gicv3_helpers.c index b27debfa7..62ae0d276 100644 --- a/drivers/arm/gic/v3/gicv3_helpers.c +++ b/drivers/arm/gic/v3/gicv3_helpers.c @@ -35,11 +35,22 @@ uintptr_t gicv3_get_multichip_base(uint32_t spi_id, uintptr_t gicd_base) *****************************************************************************/ void gicv3_rdistif_mark_core_awake(uintptr_t gicr_base) { + uint32_t waker = gicr_read_waker(gicr_base); + + /* Only try to mark it as awake when it is asleep. */ + if ((waker & WAKER_PS_BIT) == 0U) { + return; + } + /* - * The WAKER_PS_BIT should be changed to 0 - * only when WAKER_CA_BIT is 1. + * ProcessorSleep must only be changed when ChildrenAsleep is 1. + * If PS is 1 and CA isn't, wait for that to happen, but warn. */ - assert((gicr_read_waker(gicr_base) & WAKER_CA_BIT) != 0U); + if ((waker & WAKER_CA_BIT) == 0U) { + WARN("GICR_WAKER.ChildrenAsleep unexpectedly set, waiting...\n"); + while ((gicr_read_waker(gicr_base) & WAKER_CA_BIT) == 0U) { + } + } /* Mark the connected core as awake */ gicr_write_waker(gicr_base, gicr_read_waker(gicr_base) & ~WAKER_PS_BIT);