Skip to content

Commit c74e88e

Browse files
Vasant Hegdestewartsmith
authored andcommitted
FSP: Add check to detect FSP R/R inside fsp_sync_msg()
OPAL sends MBOX message to FSP and updates message state from fsp_msg_queued -> fsp_msg_sent. fsp_sync_msg() queues message and waits until we get response from FSP. During FSP R/R we move outstanding MBOX messages from msgq to rr_queue including inflight message (fsp_reset_cmdclass()). But we are not resetting inflight message state. In extreme croner case where we sent message to FSP via fsp_sync_msg() path and FSP R/R happens before getting respose from FSP, then we will endup waiting in fsp_sync_msg() until everything becomes normal. This patch adds fsp_in_rr() check to fsp_sync_msg() and return error to caller if FSP is in R/R. CC: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Acked-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
1 parent 23d759f commit c74e88e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

hw/fsp/fsp.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,8 @@ void fsp_cancelmsg(struct fsp_msg *msg)
282282
{
283283
bool need_unlock = false;
284284
struct fsp_cmdclass* cmdclass = fsp_get_cmdclass(msg);
285-
struct fsp *fsp = fsp_get_active();
286285

287-
if (fsp->state != fsp_mbx_rr) {
286+
if (!fsp_in_rr()) {
288287
prerror("FSP: Message cancel allowed only when"
289288
"FSP is in reset\n");
290289
return;
@@ -1745,6 +1744,11 @@ int fsp_sync_msg(struct fsp_msg *msg, bool autofree)
17451744
goto bail;
17461745

17471746
while(fsp_msg_busy(msg)) {
1747+
if (fsp_in_rr()) {
1748+
fsp_cancelmsg(msg);
1749+
rc = -1;
1750+
goto bail;
1751+
}
17481752
cpu_relax();
17491753
opal_run_pollers();
17501754
}
@@ -2033,6 +2037,11 @@ int fsp_fatal_msg(struct fsp_msg *msg)
20332037
return rc;
20342038

20352039
while(fsp_msg_busy(msg)) {
2040+
if (fsp_in_rr()) {
2041+
fsp_cancelmsg(msg);
2042+
return -1;
2043+
}
2044+
20362045
cpu_relax();
20372046
fsp_opal_poll(NULL);
20382047
}

0 commit comments

Comments
 (0)