[Skiboot] [PATCH v2 2/3] core/timer add support for platform heartbeat timers

Michael Neuling mikey at neuling.org
Thu Jul 21 16:21:09 AEST 2016


On Thu, 2016-07-21 at 15:58 +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>
> ---
>  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..86deae743672 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_timer) {
> +		heartbeat = platform.heartbeat_timer();
> +	}else if (slw_timer_ok() || fsp_present()) {

"} else"

I was thinking this would go in a platform call, but I guess it can't since
we can have the slw on bmc or fsp.

> +		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..72daf8c43296 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 timer for specific platforms.
> +	 */

"Return heartbeat time"

> +	int		(*heartbeat_timer)(void);

I'd be tempted to call this just heartbeat_time().  timer makes me think
it's returning something else.

Mikey

>  
>  	/*
>  	 * OPAL terminate


More information about the Skiboot mailing list