[v3,04/11] core/flash: Unlock around blocklevel calls in NVRAM accessors

Message ID 20181009073237.16251-5-andrew@aj.id.au
State Accepted
Headers show
Series
  • Add and integrate an IPMI flash implementation
Related show

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied

Commit Message

Andrew Jeffery Oct. 9, 2018, 7:32 a.m.
This ensures progress when we don't have interrupts available for IPMI.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 core/flash.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Patch

diff --git a/core/flash.c b/core/flash.c
index 15eb7443faac..83c1112636e6 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -118,8 +118,13 @@  static int flash_nvram_start_read(void *dst, uint32_t src, uint32_t len)
 		goto out;
 	}
 
+	nvram_flash->busy = true;
+	unlock(&flash_lock);
+
 	rc = blocklevel_read(nvram_flash->bl, nvram_offset + src, dst, len);
 
+	lock(&flash_lock);
+	nvram_flash->busy = false;
 out:
 	unlock(&flash_lock);
 	if (!rc)
@@ -147,8 +152,14 @@  static int flash_nvram_write(uint32_t dst, void *src, uint32_t len)
 		rc = OPAL_PARAMETER;
 		goto out;
 	}
+
+	nvram_flash->busy = true;
+	unlock(&flash_lock);
+
 	rc = blocklevel_write(nvram_flash->bl, nvram_offset + dst, src, len);
 
+	lock(&flash_lock);
+	nvram_flash->busy = false;
 out:
 	unlock(&flash_lock);
 	return rc;