Skip to content

Commit

Permalink
fsp: Don't recurse pollers in ibm_fsp_terminate
Browse files Browse the repository at this point in the history
If we were to terminate in a poller, we'd call op_display() which
called pollers which hit the recursive poller warning, which ended
in not much fun at all.

This patch will skip the running of pollers and instead run
the FSP poller to set the op-panel display before attn.

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
(cherry picked from commit 9fcb109)
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
stewartsmith committed Nov 24, 2016
1 parent 7a6298e commit 1a0cd0a
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hw/fsp/fsp-op-panel.c
Expand Up @@ -40,7 +40,13 @@ static void fsp_op_display_fatal(uint32_t w0, uint32_t w1)

fsp_fillmsg(&op_msg, FSP_CMD_DISP_SRC_DIRECT, 3, 1, w0, w1);

fsp_sync_msg(&op_msg, false);
/*
* A special way to send a message: it doesn't run pollers.
* This means we can call it while in a poller, which we may
* well be in when we're terminating (and thus displaying a *fatal*
* message on the op-panel).
*/
fsp_fatal_msg(&op_msg);
}

void op_display(enum op_severity sev, enum op_module mod, uint16_t code)
Expand Down
31 changes: 31 additions & 0 deletions hw/fsp/fsp.c
Expand Up @@ -1689,6 +1689,7 @@ void fsp_interrupt(void)
unlock(&fsp_lock);
}


int fsp_sync_msg(struct fsp_msg *msg, bool autofree)
{
int rc;
Expand Down Expand Up @@ -1977,6 +1978,36 @@ static void fsp_opal_poll(void *data __unused)
}
}

int fsp_fatal_msg(struct fsp_msg *msg)
{
int rc = 0;

rc = fsp_queue_msg(msg, NULL);
if (rc)
return rc;

while(fsp_msg_busy(msg)) {
cpu_relax();
fsp_opal_poll(NULL);
}

switch(msg->state) {
case fsp_msg_done:
rc = 0;
break;
case fsp_msg_timeout:
rc = -1; /* XXX to improve */
break;
default:
rc = -1; /* Should not happen... (assert ?) */
}

if (msg->resp)
rc = (msg->resp->word1 >> 8) & 0xff;

return rc;
}

static bool fsp_init_one(const char *compat)
{
struct dt_node *fsp_node;
Expand Down
7 changes: 7 additions & 0 deletions include/fsp.h
Expand Up @@ -697,6 +697,13 @@ extern void fsp_cancelmsg(struct fsp_msg *msg);
extern int fsp_queue_msg(struct fsp_msg *msg,
void (*comp)(struct fsp_msg *msg)) __warn_unused_result;

/* Send a fatal message to FSP
*
* This will *not* run pollers.
* Use only when attempting to get the word out about how we died.
*/
extern int fsp_fatal_msg(struct fsp_msg *msg);

/* Synchronously send a command. If there's a response, the status is
* returned as a positive number. A negative result means an error
* sending the message.
Expand Down

0 comments on commit 1a0cd0a

Please sign in to comment.