Index: qemu-kvm-0.12.5/hw/s390-virtio-bus.c
===================================================================
--- qemu-kvm-0.12.5.orig/hw/s390-virtio-bus.c
+++ qemu-kvm-0.12.5/hw/s390-virtio-bus.c
@@ -129,7 +129,8 @@ static int s390_virtio_blk_init(VirtIOS3
 {
     VirtIODevice *vdev;
 
-    vdev = virtio_blk_init((DeviceState *)dev, dev->dinfo);
+    vdev = virtio_blk_init((DeviceState *)dev, dev->dinfo,
+                           dev->logical_block_size);
     if (!vdev) {
         return -1;
     }
@@ -339,6 +340,8 @@ static VirtIOS390DeviceInfo s390_virtio_
     .qdev.size = sizeof(VirtIOS390Device),
     .qdev.props = (Property[]) {
         DEFINE_PROP_DRIVE("drive", VirtIOS390Device, dinfo),
+        DEFINE_PROP_UINT32("logical_block_size", VirtIOS390Device,
+                           logical_block_size, 512),
         DEFINE_PROP_END_OF_LIST(),
     },
 };
Index: qemu-kvm-0.12.5/hw/s390-virtio-bus.h
===================================================================
--- qemu-kvm-0.12.5.orig/hw/s390-virtio-bus.h
+++ qemu-kvm-0.12.5/hw/s390-virtio-bus.h
@@ -44,6 +44,7 @@ typedef struct VirtIOS390Device {
     uint8_t feat_len;
     VirtIODevice *vdev;
     DriveInfo *dinfo;
+    uint32_t logical_block_size;
     NICConf nic;
 } VirtIOS390Device;
 
Index: qemu-kvm-0.12.5/hw/virtio-blk.c
===================================================================
--- qemu-kvm-0.12.5.orig/hw/virtio-blk.c
+++ qemu-kvm-0.12.5/hw/virtio-blk.c
@@ -28,6 +28,7 @@ typedef struct VirtIOBlock
     char serial_str[BLOCK_SERIAL_STRLEN + 1];
     QEMUBH *bh;
     size_t config_size;
+    uint16_t logical_block_size;
 } VirtIOBlock;
 
 static VirtIOBlock *to_virtio_blk(VirtIODevice *vdev)
@@ -458,6 +459,7 @@ static void virtio_blk_update_config(Vir
     blkcfg.heads = heads;
     blkcfg.sectors = secs;
     blkcfg.size_max = 0;
+    blkcfg._blk_size = s->logical_block_size;
     virtio_identify_template(&blkcfg);
     memcpy(&blkcfg.identify[VIRTIO_BLK_ID_SN], s->serial_str,
         VIRTIO_BLK_ID_SN_BYTES);
@@ -471,6 +473,7 @@ static uint32_t virtio_blk_get_features(
 
     features |= (1 << VIRTIO_BLK_F_SEG_MAX);
     features |= (1 << VIRTIO_BLK_F_GEOMETRY);
+    features |= (1 << VIRTIO_BLK_F_BLK_SIZE);
 
     if (bdrv_enable_write_cache(s->bs))
         features |= (1 << VIRTIO_BLK_F_WCACHE);
@@ -519,14 +522,15 @@ static int virtio_blk_load(QEMUFile *f,
     return 0;
 }
 
-VirtIODevice *virtio_blk_init(DeviceState *dev, DriveInfo *dinfo)
+VirtIODevice *virtio_blk_init(DeviceState *dev, DriveInfo *dinfo,
+                              uint16_t logical_block_size)
 {
     VirtIOBlock *s;
     int cylinders, heads, secs;
     static int virtio_blk_id;
     char *ps = (char *)drive_get_serial(dinfo->bdrv);
     size_t size = strlen(ps) ? sizeof(struct virtio_blk_config) :
-	    offsetof(struct virtio_blk_config, _blk_size);
+	    offsetof(struct virtio_blk_config, identify[0]);
 
     s = (VirtIOBlock *)virtio_common_init("virtio-blk", VIRTIO_ID_BLOCK,
                                           size,
@@ -538,6 +542,8 @@ VirtIODevice *virtio_blk_init(DeviceStat
     s->vdev.reset = virtio_blk_reset;
     s->bs = dinfo->bdrv;
     s->rq = NULL;
+    s->logical_block_size = logical_block_size;
+    s->bs->buffer_alignment = s->logical_block_size;
     if (strlen(ps))
         strncpy(s->serial_str, ps, sizeof(s->serial_str));
     else
Index: qemu-kvm-0.12.5/hw/virtio.h
===================================================================
--- qemu-kvm-0.12.5.orig/hw/virtio.h
+++ qemu-kvm-0.12.5/hw/virtio.h
@@ -169,7 +169,8 @@ void virtio_bind_device(VirtIODevice *vd
                         void *opaque);
 
 /* Base devices.  */
-VirtIODevice *virtio_blk_init(DeviceState *dev, DriveInfo *dinfo);
+VirtIODevice *virtio_blk_init(DeviceState *dev, DriveInfo *dinfo,
+                              uint16_t logical_block_size);
 VirtIODevice *virtio_net_init(DeviceState *dev, NICConf *conf);
 VirtIODevice *virtio_console_init(DeviceState *dev);
 VirtIODevice *virtio_balloon_init(DeviceState *dev);
Index: qemu-kvm-0.12.5/hw/virtio-pci.c
===================================================================
--- qemu-kvm-0.12.5.orig/hw/virtio-pci.c
+++ qemu-kvm-0.12.5/hw/virtio-pci.c
@@ -460,7 +460,7 @@ static int virtio_blk_init_pci(PCIDevice
         qemu_error("virtio-blk-pci: drive property not set\n");
         return -1;
     }
-    vdev = virtio_blk_init(&pci_dev->qdev, proxy->dinfo);
+    vdev = virtio_blk_init(&pci_dev->qdev, proxy->dinfo, 512);
     vdev->nvectors = proxy->nvectors;
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,
