diff options
author | Peter Crosthwaite <peter.crosthwaite@xilinx.com> | 2014-06-18 18:36:37 -0700 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2014-06-21 16:40:14 +0800 |
commit | 999e5aa5cec71d7138c4b5271092f59ca85f9f6b (patch) | |
tree | 0ac62b583727594c4100bd697de19e694cf3c0a8 /hw/block/m25p80.c | |
parent | fc1084aad72297cb6dbccf4c78473b5390ff6c87 (diff) |
block: m25p80: Support read only bdrvs.
By just never doing write-backs. This is completely invisible to the
guest, as the entire storage area is implemented as device state (at
realize time the entire drive is read in).
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/block/m25p80.c')
-rw-r--r-- | hw/block/m25p80.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index e4ef733cc1..5893773f0c 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -291,7 +291,7 @@ static void flash_sync_page(Flash *s, int page) int bdrv_sector, nb_sectors; QEMUIOVector iov; - if (!s->bdrv) { + if (!s->bdrv || bdrv_is_read_only(s->bdrv)) { return; } @@ -309,7 +309,7 @@ static inline void flash_sync_area(Flash *s, int64_t off, int64_t len) int64_t start, end, nb_sectors; QEMUIOVector iov; - if (!s->bdrv) { + if (!s->bdrv || bdrv_is_read_only(s->bdrv)) { return; } @@ -627,10 +627,6 @@ static int m25p80_init(SSISlave *ss) if (dinfo && dinfo->bdrv) { DB_PRINT_L(0, "Binding to IF_MTD drive\n"); s->bdrv = dinfo->bdrv; - if (bdrv_is_read_only(s->bdrv)) { - fprintf(stderr, "Can't use a read-only drive"); - return 1; - } /* FIXME: Move to late init */ if (bdrv_read(s->bdrv, 0, s->storage, DIV_ROUND_UP(s->size, |