@@ -86,7 +86,8 @@ void blkconf_blocksizes(BlockConf *conf)
}
bool blkconf_apply_backend_options(BlockConf *conf, bool readonly,
- bool resizable, Error **errp)
+ bool resizable, bool zoned_support,
+ Error **errp)
{
BlockBackend *blk = conf->blk;
BlockdevOnError rerror, werror;
@@ -98,9 +99,12 @@ bool blkconf_apply_backend_options(BlockConf *conf, bool readonly,
if (!readonly) {
perm |= BLK_PERM_WRITE;
}
+ if (zoned_support) {
+ perm |= BLK_PERM_SUPPORT_ZONED;
+ }
shared_perm = BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGED |
- BLK_PERM_GRAPH_MOD;
+ BLK_PERM_GRAPH_MOD | BLK_PERM_SUPPORT_ZONED;
if (resizable) {
shared_perm |= BLK_PERM_RESIZE;
}
@@ -477,7 +477,7 @@ static void fd_change_cb(void *opaque, bool load, Error **errp)
} else {
if (!blkconf_apply_backend_options(drive->conf,
blk_is_read_only(drive->blk), false,
- errp)) {
+ false, errp)) {
return;
}
}
@@ -569,7 +569,8 @@ static void floppy_drive_realize(DeviceState *qdev, Error **errp)
dev->conf.rerror = BLOCKDEV_ON_ERROR_AUTO;
dev->conf.werror = BLOCKDEV_ON_ERROR_AUTO;
- if (!blkconf_apply_backend_options(&dev->conf, read_only, false, errp)) {
+ if (!blkconf_apply_backend_options(&dev->conf, read_only, false, false,
+ errp)) {
return;
}
@@ -1334,7 +1334,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
}
blkconf_blocksizes(&n->conf);
if (!blkconf_apply_backend_options(&n->conf, blk_is_read_only(n->conf.blk),
- false, errp)) {
+ false, false, errp)) {
return;
}
@@ -1127,7 +1127,7 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
if (!blkconf_apply_backend_options(&conf->conf,
blk_is_read_only(conf->conf.blk), true,
- errp)) {
+ false, errp)) {
return;
}
s->original_wce = blk_enable_write_cache(conf->conf.blk);
@@ -229,7 +229,7 @@ static void xen_block_realize(XenDevice *xendev, Error **errp)
}
if (!blkconf_apply_backend_options(conf, blockdev->info & VDISK_READONLY,
- true, errp)) {
+ true, false, errp)) {
return;
}
@@ -200,7 +200,7 @@ static void ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind, Error **errp)
}
}
if (!blkconf_apply_backend_options(&dev->conf, kind == IDE_CD,
- kind != IDE_CD, errp)) {
+ kind != IDE_CD, false, errp)) {
return;
}
@@ -2318,7 +2318,7 @@ static void scsi_disk_unit_attention_reported(SCSIDevice *dev)
}
}
-static void scsi_realize(SCSIDevice *dev, Error **errp)
+static void scsi_realize(SCSIDevice *dev, bool zoned_support, Error **errp)
{
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
bool read_only;
@@ -2362,7 +2362,8 @@ static void scsi_realize(SCSIDevice *dev, Error **errp)
}
if (!blkconf_apply_backend_options(&dev->conf, read_only,
- dev->type == TYPE_DISK, errp)) {
+ dev->type == TYPE_DISK, zoned_support,
+ errp)) {
return;
}
@@ -2421,7 +2422,7 @@ static void scsi_hd_realize(SCSIDevice *dev, Error **errp)
if (!s->product) {
s->product = g_strdup("QEMU HARDDISK");
}
- scsi_realize(&s->qdev, errp);
+ scsi_realize(&s->qdev, false, errp);
if (ctx) {
aio_context_release(ctx);
}
@@ -2449,7 +2450,7 @@ static void scsi_cd_realize(SCSIDevice *dev, Error **errp)
if (!s->product) {
s->product = g_strdup("QEMU CD-ROM");
}
- scsi_realize(&s->qdev, errp);
+ scsi_realize(&s->qdev, false, errp);
aio_context_release(ctx);
}
@@ -2459,7 +2460,7 @@ static void scsi_disk_realize(SCSIDevice *dev, Error **errp)
Error *local_err = NULL;
if (!dev->conf.blk) {
- scsi_realize(dev, &local_err);
+ scsi_realize(dev, false, &local_err);
assert(local_err);
error_propagate(errp, local_err);
return;
@@ -2652,7 +2653,7 @@ static void scsi_block_realize(SCSIDevice *dev, Error **errp)
*/
s->features |= (1 << SCSI_DISK_F_NO_REMOVABLE_DEVOPS);
- scsi_realize(&s->qdev, errp);
+ scsi_realize(&s->qdev, true, errp);
scsi_generic_read_device_inquiry(&s->qdev);
out:
@@ -692,7 +692,7 @@ static void scsi_generic_realize(SCSIDevice *s, Error **errp)
}
if (!blkconf_apply_backend_options(&s->conf,
blk_is_read_only(s->conf.blk),
- true, errp)) {
+ true, true, errp)) {
return;
}
@@ -603,7 +603,7 @@ static void usb_msd_storage_realize(USBDevice *dev, Error **errp)
blkconf_blocksizes(&s->conf);
if (!blkconf_apply_backend_options(&s->conf, blk_is_read_only(blk), true,
- errp)) {
+ false, errp)) {
return;
}
@@ -85,7 +85,8 @@ bool blkconf_geometry(BlockConf *conf, int *trans,
Error **errp);
void blkconf_blocksizes(BlockConf *conf);
bool blkconf_apply_backend_options(BlockConf *conf, bool readonly,
- bool resizable, Error **errp);
+ bool resizable, bool zoned_support,
+ Error **errp);
/* Hard disk geometry */