aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2018-10-09 00:32:29 -0700
committerStewart Smith <stewart@linux.ibm.com>2018-10-31 16:49:21 +1100
commitf976e7788a3b0bace1014c58a957c2db329d0d43 (patch)
tree78c27dcbb85d642f24b83ba7fecd6ade16ea8ea6
parentc8edac1b2f32894ad3dee4ce680c3594dda8654c (diff)
downloadskiboot-f976e7788a3b0bace1014c58a957c2db329d0d43.zip
skiboot-f976e7788a3b0bace1014c58a957c2db329d0d43.tar.gz
skiboot-f976e7788a3b0bace1014c58a957c2db329d0d43.tar.bz2
core/flash: Only lock around flashes update in flash_register()
[ Upstream commit 3aa5394f4da1ae9c95ab2d061d28b4db8298de20 ] Previously in flash_register() held flash_lock across ffs_init(), which calls through the blocklevel layer to read the flash. This is unhelpful with the IPMI HIOMAP protocol transport as LPC interrupts have not yet been enabled and we are relying on polling to progress. The held lock stalls the boot as we take the nopoll path in time_wait() while completing ipmi_queue_msg_sync() in libflash/ipmi-flash.c Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
-rw-r--r--core/flash.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/core/flash.c b/core/flash.c
index e3be576..d420017 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -400,13 +400,9 @@ int flash_register(struct blocklevel_device *bl)
prlog(PR_INFO, "FLASH: registering flash device %s "
"(size 0x%llx, blocksize 0x%x)\n",
name ?: "(unnamed)", size, block_size);
-
- lock(&flash_lock);
-
flash = malloc(sizeof(struct flash));
if (!flash) {
prlog(PR_ERR, "FLASH: Error allocating flash structure\n");
- unlock(&flash_lock);
return OPAL_RESOURCE;
}
@@ -417,8 +413,6 @@ int flash_register(struct blocklevel_device *bl)
flash->block_size = block_size;
flash->id = num_flashes();
- list_add(&flashes, &flash->list);
-
rc = ffs_init(0, flash->size, bl, &ffs, 1);
if (rc) {
/**
@@ -439,6 +433,8 @@ int flash_register(struct blocklevel_device *bl)
if (ffs)
ffs_close(ffs);
+ lock(&flash_lock);
+ list_add(&flashes, &flash->list);
unlock(&flash_lock);
return OPAL_SUCCESS;