All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 1/2] hw/block: m25p80: Don't write to flash if write is disabled
@ 2020-12-23  2:00 Bin Meng
  2020-12-23  2:00 ` [PATCH v5 2/2] hw/block: m25p80: Implement AAI-WP command support for SST flashes Bin Meng
  2021-01-05  3:50 ` [PATCH v5 1/2] hw/block: m25p80: Don't write to flash if write is disabled Bin Meng
  0 siblings, 2 replies; 5+ messages in thread
From: Bin Meng @ 2020-12-23  2:00 UTC (permalink / raw)
  To: Alistair Francis, Francisco Iglesias, Philippe Mathieu-Daudé,
	Kevin Wolf, Max Reitz, qemu-block, qemu-devel
  Cc: Bin Meng

From: Bin Meng <bin.meng@windriver.com>

When write is disabled, the write to flash should be avoided
in flash_write8().

Fixes: 82a2499011a7 ("m25p80: Initial implementation of SPI flash device")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>

---

(no changes since v2)

Changes in v2:
- new patch: honor write enable flag in flash write

 hw/block/m25p80.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index c45afdd..29598b4 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -600,6 +600,7 @@ void flash_write8(Flash *s, uint32_t addr, uint8_t data)
 
     if (!s->write_enable) {
         qemu_log_mask(LOG_GUEST_ERROR, "M25P80: write with write protect!\n");
+        return;
     }
 
     if ((prev ^ data) & data) {
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-05 21:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-23  2:00 [PATCH v5 1/2] hw/block: m25p80: Don't write to flash if write is disabled Bin Meng
2020-12-23  2:00 ` [PATCH v5 2/2] hw/block: m25p80: Implement AAI-WP command support for SST flashes Bin Meng
2020-12-23 13:18   ` Francisco Iglesias
2021-01-05  3:50 ` [PATCH v5 1/2] hw/block: m25p80: Don't write to flash if write is disabled Bin Meng
2021-01-05 21:13   ` Alistair Francis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.