From bd64f85b85814986af64b2f62849496d93beecc2 Mon Sep 17 00:00:00 2001 From: Ananth N Mavinakayanahalli Date: Thu, 30 Nov 2017 17:49:42 +0530 Subject: fsp: Bail out of HIR if FSP is resetting voluntarily a. Surveillance response times out and OPAL triggers a HIR b. Before the HIR process kicks in, OPAL gets a PSI interrupt indicating link down c. HIR process continues and OPAL tries to write to DRCR; PSI link inactive => xstop OPAL should confirm that the FSP is not already in reset in the HIR path. [V2] Handle the case where a second reset is triggered due to the two resets happening in succession. Signed-off-by: Ananth N Mavinakayanahalli Tested-by: Pridhiviraj Paidipeddi Reviewed-by: Vasant Hegde Signed-off-by: Stewart Smith --- hw/fsp/fsp.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'hw/fsp') diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c index 1179283..613108c 100644 --- a/hw/fsp/fsp.c +++ b/hw/fsp/fsp.c @@ -459,7 +459,16 @@ static bool fsp_crit_op_in_progress(struct fsp *fsp) /* Notify the FSP that it will be reset soon by writing to the DRCR */ static void fsp_prep_for_reset(struct fsp *fsp) { - u32 drcr = fsp_rreg(fsp, FSP_DRCR_REG); + u32 drcr; + + /* + * Its possible that the FSP went into reset by itself between the + * time the HIR is triggered and we get here. Check and bail out if so. + */ + if (fsp_in_rr()) + return; + + drcr = fsp_rreg(fsp, FSP_DRCR_REG); prlog(PR_TRACE, "FSP: Writing reset to DRCR\n"); drcr_last_print = drcr; @@ -472,6 +481,9 @@ static void fsp_hir_poll(struct fsp *fsp, struct psi *psi) { u32 drcr; + if (fsp_in_reset(fsp) || !(psi_check_link_active(psi))) + return; + switch (fsp->state) { case fsp_mbx_crit_op: if (fsp_crit_op_in_progress(fsp)) { @@ -1588,15 +1600,15 @@ static void __fsp_poll(bool interrupt) } iop = &fsp->iopath[fsp->active_iopath]; + /* Check for error state and handle R&R completion */ + fsp_handle_errors(fsp); + /* Handle host initiated resets */ if (fsp_in_hir(fsp)) { fsp_hir_poll(fsp, iop->psi); return; } - /* Check for error state and handle R&R completion */ - fsp_handle_errors(fsp); - /* * The above might have triggered and R&R, check that we * are still functional -- cgit v1.1