virtio-blk.c (170f209d7848dc2f14b3f3dccc34a49558680d4d) virtio-blk.c (95129d6fc9ead97155627a4ca0cfd37282883658)
1/*
2 * Virtio Block Device
3 *
4 * Copyright IBM, Corp. 2007
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *

--- 717 unchanged lines hidden (view full) ---

726 Error **errp)
727{
728 VirtIOBlock *s = VIRTIO_BLK(vdev);
729
730 virtio_add_feature(&features, VIRTIO_BLK_F_SEG_MAX);
731 virtio_add_feature(&features, VIRTIO_BLK_F_GEOMETRY);
732 virtio_add_feature(&features, VIRTIO_BLK_F_TOPOLOGY);
733 virtio_add_feature(&features, VIRTIO_BLK_F_BLK_SIZE);
1/*
2 * Virtio Block Device
3 *
4 * Copyright IBM, Corp. 2007
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *

--- 717 unchanged lines hidden (view full) ---

726 Error **errp)
727{
728 VirtIOBlock *s = VIRTIO_BLK(vdev);
729
730 virtio_add_feature(&features, VIRTIO_BLK_F_SEG_MAX);
731 virtio_add_feature(&features, VIRTIO_BLK_F_GEOMETRY);
732 virtio_add_feature(&features, VIRTIO_BLK_F_TOPOLOGY);
733 virtio_add_feature(&features, VIRTIO_BLK_F_BLK_SIZE);
734 if (__virtio_has_feature(features, VIRTIO_F_VERSION_1)) {
734 if (virtio_has_feature(features, VIRTIO_F_VERSION_1)) {
735 if (s->conf.scsi) {
736 error_setg(errp, "Please set scsi=off for virtio-blk devices in order to use virtio 1.0");
737 return 0;
738 }
739 } else {
740 virtio_clear_feature(&features, VIRTIO_F_ANY_LAYOUT);
741 virtio_add_feature(&features, VIRTIO_BLK_F_SCSI);
742 }

--- 34 unchanged lines hidden (view full) ---

777 * Guest sets DRIVER bit in status field
778 * Guest reads host features (WCE=0, CONFIG_WCE=1)
779 * Guest writes guest features (WCE=0, CONFIG_WCE=1)
780 * Guest writes 1 to the WCE configuration field (writeback mode)
781 * Guest sets DRIVER_OK bit in status field
782 *
783 * s->blk would erroneously be placed in writethrough mode.
784 */
735 if (s->conf.scsi) {
736 error_setg(errp, "Please set scsi=off for virtio-blk devices in order to use virtio 1.0");
737 return 0;
738 }
739 } else {
740 virtio_clear_feature(&features, VIRTIO_F_ANY_LAYOUT);
741 virtio_add_feature(&features, VIRTIO_BLK_F_SCSI);
742 }

--- 34 unchanged lines hidden (view full) ---

777 * Guest sets DRIVER bit in status field
778 * Guest reads host features (WCE=0, CONFIG_WCE=1)
779 * Guest writes guest features (WCE=0, CONFIG_WCE=1)
780 * Guest writes 1 to the WCE configuration field (writeback mode)
781 * Guest sets DRIVER_OK bit in status field
782 *
783 * s->blk would erroneously be placed in writethrough mode.
784 */
785 if (!virtio_has_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE)) {
785 if (!virtio_vdev_has_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE)) {
786 aio_context_acquire(blk_get_aio_context(s->blk));
787 blk_set_enable_write_cache(s->blk,
786 aio_context_acquire(blk_get_aio_context(s->blk));
787 blk_set_enable_write_cache(s->blk,
788 virtio_has_feature(vdev, VIRTIO_BLK_F_WCE));
788 virtio_vdev_has_feature(vdev,
789 VIRTIO_BLK_F_WCE));
789 aio_context_release(blk_get_aio_context(s->blk));
790 }
791}
792
793static void virtio_blk_save(QEMUFile *f, void *opaque)
794{
795 VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
796

--- 216 unchanged lines hidden ---
790 aio_context_release(blk_get_aio_context(s->blk));
791 }
792}
793
794static void virtio_blk_save(QEMUFile *f, void *opaque)
795{
796 VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
797

--- 216 unchanged lines hidden ---