[Skiboot] [PATCH v3 2/3] core/timer: Add support for platform specific heartbeat

Michael Neuling mikey at neuling.org
Fri Jul 22 10:48:06 AEST 2016


On Thu, 2016-07-21 at 17:10 +1000, Chris Smart wrote:
> The timer code currently has a default and a special check for FSP
> machines or those with SLW timer facility.
> 
> This patch adds support for platform quirk to set the timer.
> 
> Signed-off-by: Chris Smart <chris at distroguy.com>


Acked-by: Michael Neuling <mikey at neuling.org>

> ---
> 
> Changes since v2:
>  - Address concerns raised by Mr Neuling
>  - timer replaces with "time"
>  - fix commit subject line
> 
>  core/timer.c       | 16 ++++++++++------
>  include/platform.h |  4 ++++
>  2 files changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/core/timer.c b/core/timer.c
> index 8bfba4a6dc3b..6e141de5028e 100644
> --- a/core/timer.c
> +++ b/core/timer.c
> @@ -245,22 +245,26 @@ void check_timers(bool from_interrupt)
>  
>  void late_init_timers(void)
>  {
> +	int heartbeat = HEARTBEAT_DEFAULT_MS;
> +
>  	/* Add a property requesting the OS to call opal_poll_event() at
>  	 * a specified interval in order for us to run our background
>  	 * low priority pollers.
>  	 *
> +	 * If a platform quirk exists, use that, else use the default.
> +	 *
>  	 * If we have an SLW timer facility, we run this 10 times slower,
>  	 * we could possibly completely get rid of it.
>  	 *
>  	 * We use a value in milliseconds, we don't want this to ever be
>  	 * faster than that.
>  	 */
> -	if (slw_timer_ok() || fsp_present()) {
> -		dt_add_property_cells(opal_node, "ibm,heartbeat-ms",
> -				      HEARTBEAT_DEFAULT_MS * 10);
> -	} else {
> -		dt_add_property_cells(opal_node, "ibm,heartbeat-ms",
> -				      HEARTBEAT_DEFAULT_MS);
> +	if (platform.heartbeat_time) {
> +		heartbeat = platform.heartbeat_time();
> +	}else if (slw_timer_ok() || fsp_present()) {
> +		heartbeat = HEARTBEAT_DEFAULT_MS * 10;
>  	}
> +
> +	dt_add_property_cells(opal_node, "ibm,heartbeat-ms", heartbeat);
>  }
>  #endif
> diff --git a/include/platform.h b/include/platform.h
> index d07994fda709..062a94185b11 100644
> --- a/include/platform.h
> +++ b/include/platform.h
> @@ -159,6 +159,10 @@ struct platform {
>  	 */
>  	int64_t		(*sensor_read)(uint32_t sensor_hndl, int token,
>  				       uint32_t *sensor_data);
> +	/*
> +	 * Return the heartbeat time
> +	 */
> +	int		(*heartbeat_time)(void);
>  
>  	/*
>  	 * OPAL terminate


More information about the Skiboot mailing list