diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2015-02-18 14:57:21 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-02-18 15:33:34 +1100 |
commit | a5ee9d40075dd6b73bff9daf91e5add6401babe5 (patch) | |
tree | 30a794179945a5d61a93878ec5d33faddc6e8692 /hw | |
parent | 3db397ea5892a8b348cf412739996731884561b3 (diff) | |
download | skiboot-a5ee9d40075dd6b73bff9daf91e5add6401babe5.zip skiboot-a5ee9d40075dd6b73bff9daf91e5add6401babe5.tar.gz skiboot-a5ee9d40075dd6b73bff9daf91e5add6401babe5.tar.bz2 |
fsp: Audit callers of opal_run_pollers
Use cpu_relax() and don't call it with a lock held
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/fsp/fsp-codeupdate.c | 17 | ||||
-rw-r--r-- | hw/fsp/fsp.c | 20 |
2 files changed, 24 insertions, 13 deletions
diff --git a/hw/fsp/fsp-codeupdate.c b/hw/fsp/fsp-codeupdate.c index b5e2622..33fd9e6 100644 --- a/hw/fsp/fsp-codeupdate.c +++ b/hw/fsp/fsp-codeupdate.c @@ -23,6 +23,8 @@ #include <ccan/endian/endian.h> #include <errorlog.h> #include <opal-api.h> +#include <fsp-elog.h> +#include <timebase.h> #include "fsp-codeupdate.h" @@ -455,14 +457,13 @@ void fsp_code_update_wait_vpd(bool is_boot) if (!fsp_present()) return; - prlog(PR_NOTICE, "CUPD: Waiting read marker LID completion...\n"); - - while(flash_state == FLASH_STATE_READING) - opal_run_pollers(); - - prlog(PR_NOTICE, "CUPD: Waiting in flight params completion...\n"); - while(in_flight_params) - opal_run_pollers(); + prlog(PR_NOTICE, "CUPD: Waiting read marker LID" + " and in flight parsm completion...\n"); + while (flash_state == FLASH_STATE_READING || in_flight_params) { + unlock(&flash_lock); + time_wait_ms(100); + lock(&flash_lock); + } if (is_boot) add_opal_firmware_version(); diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c index da68eef..21926b6 100644 --- a/hw/fsp/fsp.c +++ b/hw/fsp/fsp.c @@ -1643,8 +1643,10 @@ int fsp_sync_msg(struct fsp_msg *msg, bool autofree) if (rc) goto bail; - while(fsp_msg_busy(msg)) + while(fsp_msg_busy(msg)) { + cpu_relax(); opal_run_pollers(); + } switch(msg->state) { case fsp_msg_done: @@ -2064,19 +2066,25 @@ void fsp_opl(void) /* Send OPL */ ipl_state |= ipl_opl_sent; fsp_sync_msg(fsp_mkmsg(FSP_CMD_OPL, 0), true); - while(!(ipl_state & ipl_got_continue)) + while(!(ipl_state & ipl_got_continue)) { opal_run_pollers(); + cpu_relax(); + } /* Send continue ACK */ fsp_sync_msg(fsp_mkmsg(FSP_CMD_CONTINUE_ACK, 0), true); /* Wait for various FSP messages */ prlog(PR_INFO, "INIT: Waiting for FSP to advertize new role...\n"); - while(!(ipl_state & ipl_got_new_role)) + while(!(ipl_state & ipl_got_new_role)) { + cpu_relax(); opal_run_pollers(); + } prlog(PR_INFO, "INIT: Waiting for FSP to request capabilities...\n"); - while(!(ipl_state & ipl_got_caps)) + while(!(ipl_state & ipl_got_caps)) { + cpu_relax(); opal_run_pollers(); + } /* Initiate the timeout poller */ opal_add_poller(fsp_timeout_poll, NULL); @@ -2087,8 +2095,10 @@ void fsp_opl(void) /* Wait for FSP functional */ prlog(PR_INFO, "INIT: Waiting for FSP functional\n"); - while(!(ipl_state & ipl_got_fsp_functional)) + while(!(ipl_state & ipl_got_fsp_functional)) { + cpu_relax(); opal_run_pollers(); + } /* Tell FSP we are in running state */ prlog(PR_INFO, "INIT: Sending HV Functional: Runtime...\n"); |