[Skiboot] [PATCH] opal-prd: Add support for runtime OCC reset in ZZ

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Tue Sep 5 00:32:13 AEST 2017


On 08/31/2017 01:56 PM, Shilpasri G Bhat wrote:
> This patch handles OCC_RESET runtime events in host opal-prd and also
> provides support for calling 'hostinterface->wakeup()' which is
> required for doing the reset operation.
>
> Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
> ---
> - This is based on top of
>   https://lists.ozlabs.org/pipermail/skiboot/2017-August/008585.html
>   which handles special wakeup in P9.
>
>  core/hostservices.c          | 28 +++++++++++++++--------
>  external/opal-prd/opal-prd.c | 51 +++++++++++++++++++++++++++++++++++++++++-
>  external/opal-prd/thunk.S    |  2 +-
>  hw/occ.c                     | 53 +++++++++++++++++++++++++++++++++++++++++++-
>  hw/prd.c                     |  8 +++++++
>  include/opal-api.h           | 10 +++++++++
>  include/skiboot.h            |  2 ++
>  7 files changed, 142 insertions(+), 12 deletions(-)
>

.../...

> diff --git a/external/opal-prd/thunk.S b/external/opal-prd/thunk.S
> index cca5890..ee3d7c3 100644
> --- a/external/opal-prd/thunk.S
> +++ b/external/opal-prd/thunk.S
> @@ -183,7 +183,7 @@ hinterface:
>  	DISABLED_THUNK(hservice_lid_load)
>  	DISABLED_THUNK(hservice_lid_unload)
>  	CALLBACK_THUNK(hservice_get_reserved_mem)
> -	DISABLED_THUNK(hservice_wakeup)
> +	CALLBACK_THUNK(hservice_wakeup)

And you should detect service processor type and disable wakeup interface on BMC 
system.
(similar to pnor_read call. See run_prd_daemon()).

> diff --git a/hw/occ.c b/hw/occ.c
> index 78c6a6a..a53ac92 100644
> --- a/hw/occ.c
> +++ b/hw/occ.c
> @@ -1837,6 +1837,46 @@ out:
>  	return rc;
>  }
>
> +u32 last_seq_id;
> +
> +int fsp_occ_reset_status(u64 chipid, s64 status)
> +{
> +	struct fsp_msg *stat;
> +	int rc = OPAL_NO_MEM;
> +
> +	if (status == 0) {

How about something like below :
	if (status == 0)
		ret = 0;
	else
		ret = 0xfe00 | (chip->pcid & 0xff);

And then just call fsp_mkmsg. That way you can avoid duplicate code.

-Vasant

> +		stat = fsp_mkmsg(FSP_CMD_RESET_OCC_STAT, 2, 0, last_seq_id);
> +		if (!stat)
> +			return rc;
> +
> +		rc = fsp_queue_msg(stat, fsp_freemsg);
> +		if (rc) {
> +			fsp_freemsg(stat);
> +			log_simple_error(&e_info(OPAL_RC_OCC_RESET),
> +				"OCC: Error %d queueing FSP OCC RESET STATUS message\n",
> +				rc);
> +		}
> +	} else {
> +		struct proc_chip *chip = get_chip(chipid);
> +
> +		if (!chip)
> +			return OPAL_PARAMETER;
> +
> +		stat = fsp_mkmsg(FSP_CMD_RESET_OCC_STAT, 2,
> +				 0xfe00 | (chip->pcid & 0xff), last_seq_id);
> +		if (!stat)
> +			return rc;
> +		rc = fsp_queue_msg(stat, fsp_freemsg);
> +		if (rc) {
> +			fsp_freemsg(stat);
> +			log_simple_error(&e_info(OPAL_RC_OCC_RESET),
> +			  "OCC: Error %d queueing FSP OCC RESET STATUS message\n",
> +				rc);
> +		}
> +	}
> +	return rc;
> +}




More information about the Skiboot mailing list