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-10 18:09:26 -0500
commit3aa5394f4da1ae9c95ab2d061d28b4db8298de20 (patch)
tree5a219f01a061b368128a61f3e9eb50a351a4ee99
parent88579eba5fdebb2b2c65f3bc9fb1a3a7abbaf12f (diff)
downloadskiboot-3aa5394f4da1ae9c95ab2d061d28b4db8298de20.zip
skiboot-3aa5394f4da1ae9c95ab2d061d28b4db8298de20.tar.gz
skiboot-3aa5394f4da1ae9c95ab2d061d28b4db8298de20.tar.bz2
core/flash: Only lock around flashes update in flash_register()
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 8e7b90e..15eb744 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -406,13 +406,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;
}
@@ -423,8 +419,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) {
/**
@@ -445,6 +439,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;