fix(scmi): induce a delay in monitoring SCMI channel status

Reading the SCMI mailbox status in polling mode causes a burst of bus
accesses. On certain platforms, this would not be ideal as the shared
bus on the CPU subsystem might cause contentions across all the CPUs.
So allow platforms to specify a delay to be introduced while polling.

Change-Id: Ib90ad7b5954854071cfd543f4a27a178dde3d5c6
Signed-off-by: Pranav Madhu <pranav.madhu@arm.com>
This commit is contained in:
Pranav Madhu 2024-01-18 18:55:18 +05:30
parent 3447ba1f04
commit af1ac2d7db
2 changed files with 9 additions and 4 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -9,6 +9,7 @@
#include <arch_helpers.h>
#include <common/debug.h>
#include <drivers/arm/css/scmi.h>
#include <drivers/delay_timer.h>
#include "scmi_private.h"
@ -60,8 +61,10 @@ void scmi_send_sync_command(scmi_channel_t *ch)
dmbsy();
/* Wait for channel to be free */
while (!SCMI_IS_CHANNEL_FREE(mbx_mem->status))
;
while (!SCMI_IS_CHANNEL_FREE(mbx_mem->status)) {
if (ch->info->delay != 0)
udelay(ch->info->delay);
}
/*
* Ensure that any read to the SCMI payload area is done after reading

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -123,6 +123,8 @@ typedef struct scmi_channel_plat_info {
void (*ring_doorbell)(struct scmi_channel_plat_info *plat_info);
/* cookie is unused now. But added for future enhancements. */
void *cookie;
/* Delay in micro-seconds while polling the channel status. */
uint32_t delay;
} scmi_channel_plat_info_t;