diff options
author | Anthony Liguori <aliguori@amazon.com> | 2013-10-11 09:29:58 -0700 |
---|---|---|
committer | Anthony Liguori <aliguori@amazon.com> | 2013-10-11 09:29:58 -0700 |
commit | 33c6cae44eccea5e627c2dc5cbf31456db90fc38 (patch) | |
tree | 26f994c9f78144b2a6f12da686a2235d0df1dd21 /hw | |
parent | 39c153b80f890dc5f02465dc59992e195abd5f40 (diff) | |
parent | 34eeb82de65ce9f83081a3357b0afe80a6a1d86a (diff) | |
download | qemu-33c6cae44eccea5e627c2dc5cbf31456db90fc38.zip qemu-33c6cae44eccea5e627c2dc5cbf31456db90fc38.tar.gz qemu-33c6cae44eccea5e627c2dc5cbf31456db90fc38.tar.bz2 |
Merge remote-tracking branch 'kwolf/for-anthony' into staging
# By Max Reitz (30) and others
# Via Kevin Wolf
* kwolf/for-anthony: (61 commits)
qemu-iotests: Add test for inactive L2 overlap
qemu-io: Let "open" pass options to block driver
vmdk: Fix vmdk_parse_extents
blockdev: blockdev_init() error conversion
blockdev: Don't disable COR automatically with blockdev-add
blockdev: Remove 'media' parameter from blockdev_init()
qemu-iotests: Check autodel behaviour for device_del
blockdev: Remove IF_* check for read-only blockdev_init
blockdev: Move virtio-blk device creation to drive_init
blockdev: Move bus/unit/index processing to drive_init
blockdev: Move parsing of 'boot' option to drive_init
blockdev: Moving parsing of geometry options to drive_init
blockdev: Move parsing of 'if' option to drive_init
blockdev: Move parsing of 'media' option to drive_init
blockdev: Pass QDict to blockdev_init()
blockdev: Separate ID generation from DriveInfo creation
blockdev: 'blockdev-add' QMP command
blockdev: Introduce DriveInfo.enable_auto_del
qapi-types/visit.py: Inheritance for structs
qapi-types/visit.py: Pass whole expr dict for structs
...
Message-id: 1381503951-27985-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/block/m25p80.c | 5 | ||||
-rw-r--r-- | hw/block/xen_disk.c | 5 | ||||
-rw-r--r-- | hw/ide/ahci.c | 10 | ||||
-rw-r--r-- | hw/sd/milkymist-memcard.c | 4 | ||||
-rw-r--r-- | hw/sd/omap_mmc.c | 6 | ||||
-rw-r--r-- | hw/sd/pl181.c | 4 | ||||
-rw-r--r-- | hw/sd/pxa2xx_mmci.c | 3 | ||||
-rw-r--r-- | hw/sd/sd.c | 5 | ||||
-rw-r--r-- | hw/sd/sdhci.c | 3 | ||||
-rw-r--r-- | hw/sd/ssi-sd.c | 3 |
10 files changed, 47 insertions, 1 deletions
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index 8c3b7f0..02a1544 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -624,6 +624,11 @@ 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, BDRV_SECTOR_SIZE))) { diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 8742294..098f6c6 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -830,6 +830,11 @@ static int blk_connect(struct XenDevice *xendev) /* setup via qemu cmdline -> already setup for us */ xen_be_printf(&blkdev->xendev, 2, "get configured bdrv (cmdline setup)\n"); blkdev->bs = blkdev->dinfo->bdrv; + if (bdrv_is_read_only(blkdev->bs) && !readonly) { + xen_be_printf(&blkdev->xendev, 0, "Unexpected read-only drive"); + blkdev->bs = NULL; + return -1; + } /* blkdev->bs is not create by us, we get a reference * so we can bdrv_unref() unconditionally */ bdrv_ref(blkdev->bs); diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index a71a4ca..a8be62c 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1198,7 +1198,15 @@ void ahci_reset(AHCIState *s) int i; s->control_regs.irqstatus = 0; - s->control_regs.ghc = 0; + /* AHCI Enable (AE) + * The implementation of this bit is dependent upon the value of the + * CAP.SAM bit. If CAP.SAM is '0', then GHC.AE shall be read-write and + * shall have a reset value of '0'. If CAP.SAM is '1', then AE shall be + * read-only and shall have a reset value of '1'. + * + * We set HOST_CAP_AHCI so we must enable AHCI at reset. + */ + s->control_regs.ghc = HOST_CTL_AHCI_EN; for (i = 0; i < s->ports; i++) { pr = &s->dev[i].port_regs; diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index 42613b3..d1168c9 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -255,6 +255,10 @@ static int milkymist_memcard_init(SysBusDevice *dev) dinfo = drive_get_next(IF_SD); s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false); + if (s->card == NULL) { + return -1; + } + s->enabled = dinfo ? bdrv_is_inserted(dinfo->bdrv) : 0; memory_region_init_io(&s->regs_region, OBJECT(s), &memcard_mmio_ops, s, diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c index bf5d1fb..937a478 100644 --- a/hw/sd/omap_mmc.c +++ b/hw/sd/omap_mmc.c @@ -593,6 +593,9 @@ struct omap_mmc_s *omap_mmc_init(hwaddr base, /* Instantiate the storage */ s->card = sd_init(bd, false); + if (s->card == NULL) { + exit(1); + } return s; } @@ -618,6 +621,9 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta, /* Instantiate the storage */ s->card = sd_init(bd, false); + if (s->card == NULL) { + exit(1); + } s->cdet = qemu_allocate_irqs(omap_mmc_cover_cb, s, 1)[0]; sd_set_cb(s->card, NULL, s->cdet); diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 03875bf..c35896d 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -491,6 +491,10 @@ static int pl181_init(SysBusDevice *sbd) qdev_init_gpio_out(dev, s->cardstatus, 2); dinfo = drive_get_next(IF_SD); s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false); + if (s->card == NULL) { + return -1; + } + return 0; } diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 90c955f..b9d8b1a 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -539,6 +539,9 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem, /* Instantiate the actual storage */ s->card = sd_init(bd, false); + if (s->card == NULL) { + exit(1); + } register_savevm(NULL, "pxa2xx_mmci", 0, 0, pxa2xx_mmci_save, pxa2xx_mmci_load, s); @@ -494,6 +494,11 @@ SDState *sd_init(BlockDriverState *bs, bool is_spi) { SDState *sd; + if (bdrv_is_read_only(bs)) { + fprintf(stderr, "sd_init: Cannot use read-only drive\n"); + return NULL; + } + sd = (SDState *) g_malloc0(sizeof(SDState)); sd->buf = qemu_blockalign(bs, 512); sd->spi = is_spi; diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 1483e19..0906a1d 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -1166,6 +1166,9 @@ static void sdhci_initfn(Object *obj) di = drive_get_next(IF_SD); s->card = sd_init(di ? di->bdrv : NULL, false); + if (s->card == NULL) { + exit(1); + } s->eject_cb = qemu_allocate_irqs(sdhci_insert_eject_cb, s, 1)[0]; s->ro_cb = qemu_allocate_irqs(sdhci_card_readonly_cb, s, 1)[0]; sd_set_cb(s->card, s->ro_cb, s->eject_cb); diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c index d47e237..1bb56c4 100644 --- a/hw/sd/ssi-sd.c +++ b/hw/sd/ssi-sd.c @@ -246,6 +246,9 @@ static int ssi_sd_init(SSISlave *dev) s->mode = SSI_SD_CMD; dinfo = drive_get_next(IF_SD); s->sd = sd_init(dinfo ? dinfo->bdrv : NULL, true); + if (s->sd == NULL) { + return -1; + } register_savevm(&dev->qdev, "ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s); return 0; } |