[Skiboot] [PATCH 1/2] opal-api: Add OPAL call OPAL_TRIGGER_XSTOP to invoke xstop

Mahesh Jagannath Salgaonkar mahesh at linux.vnet.ibm.com
Thu Jul 23 15:46:42 AEST 2015


On 07/20/2015 11:02 PM, Vipin K Parashar wrote:
> This patch adds a new OPAL call OPAL_TRIGGER_XSTOP which will
> be used to invoke xstop. This call invokes xstop by writing to a
> XSCOM register. XSCOM address and FIR bit details are obtained
> via device-tree property 'ibm,sw-checkstop-fir', which contains
> two cells. First cell contains XSCOM address while second cell
> contains FIR bit number. No input parameter is required. Machine
> enters xstop state upon completion of this call.
> 
> Signed-off-by: Vipin K Parashar <vipin at linux.vnet.ibm.com>
> ---
>  hw/xscom.c         | 29 +++++++++++++++++++++++++++++
>  include/opal-api.h |  3 ++-
>  2 files changed, 31 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/xscom.c b/hw/xscom.c
> index 9d3523c..22e9a8a 100644
> --- a/hw/xscom.c
> +++ b/hw/xscom.c
> @@ -53,6 +53,9 @@ DEFINE_LOG_ENTRY(OPAL_RC_XSCOM_RESET, OPAL_PLATFORM_ERR_EVT, OPAL_XSCOM,
>  		OPAL_CEC_HARDWARE, OPAL_PREDICTIVE_ERR_GENERAL,
>  		OPAL_NA, NULL);
> 
> +/* xscom details to trigger xstop */
> +static uint64_t xstop_xscom_addr, xstop_fir_bit;
> +
>  /*
>   * Locking notes:
>   *
> @@ -483,9 +486,25 @@ static void xscom_init_chip_info(struct proc_chip *chip)
>  	chip->ec_level |= (val >> 8) & 0xf;
>  }
> 
> +/*
> +* This function triggers xstop by writing to XSCOM.
> +* Machine would enter xstop state post completion of this.
> +*/
> +static int64_t opal_trigger_xstop(void)
> +{
> +	int rc = OPAL_UNSUPPORTED;
> +
> +	if (xstop_xscom_addr)
> +		rc = xscom_writeme(xstop_xscom_addr, (0x1ull << xstop_fir_bit));
> +
> +	return rc;
> +}
> +opal_call(OPAL_TRIGGER_XSTOP, opal_trigger_xstop, 0);
> +
>  void xscom_init(void)
>  {
>  	struct dt_node *xn;
> +	const struct dt_property *p;
> 
>  	dt_for_each_compatible(dt_root, xn, "ibm,xscom") {
>  		uint32_t gcid = dt_get_chip_id(xn);
> @@ -521,6 +540,16 @@ void xscom_init(void)
>  		       chip->ec_level >> 4,
>  		       chip->ec_level & 0xf);
>  	}
> +
> +	/* Collect details to trigger xstop via XSCOM write */
> +	p = dt_find_property(dt_root, "ibm,sw-checkstop-fir");
> +	if (p) {
> +		xstop_xscom_addr = dt_property_get_cell(p, 0);
> +		xstop_fir_bit = dt_property_get_cell(p, 1);
> +		prlog(PR_DEBUG, "XSTOP XSCOM addr = 0x%llx, FIR bit = %lld\n",
> +					xstop_xscom_addr, xstop_fir_bit);

Should we delete the property after saving the values and not expose to
Linux host which may be misused by Linux users ?

Any suggestions ??

Thanks,
-Mahesh.



More information about the Skiboot mailing list