Set correct blk feature for virtio 1.0
v4 cover Set correct blk feature for virtio 1.0
Hi all:
This series tries to set feature correctly for virtio-blk when virtio 1.0 is supported. Two isssues were addressed according to the spec:
- scsi passthrough was not support in 1.0. This is done through: 1) let get_features() can fail 2) fail the get_features() when both scsi and virtio 1.0 is enabled.
- any layout must be set for transitional device. This is done by set any layout when 1.0 is supported.
Changes from V3:
- rebase on top of Michael's any_layout fixes
Changes from V2:
- Keep scsi=on by default since virtio 1.0 is disabled by default
- Advertise VIRTIO_BLK_F_SCSI unconditionally if virtio 1.0 is disabled
Changes from V1:
- Split virtio-net changes out of the series
- Enable VIRTIO_BLK_F_SCSI only when scsi is set
- Disable scsi by default and compat it for legacy machine types
- Let get_features() can fail and fail the initialization of virito-blk when both 1.0 and scsi were supported.
Jason Wang (3):
virtio: get_features() can fail
virtio-blk: fail get_features when both scsi and 1.0 were set
virtio-blk: only clear VIRTIO_F_ANY_LAYOUT for legacy device
hw/9pfs/virtio-9p-device.c | 3 ++- hw/block/virtio-blk.c | 15 ++++++++++++--- hw/char/virtio-serial-bus.c | 3 ++- hw/display/virtio-gpu.c | 3 ++- hw/input/virtio-input.c | 3 ++- hw/net/virtio-net.c | 3 ++- hw/scsi/vhost-scsi.c | 3 ++- hw/scsi/virtio-scsi.c | 3 ++- hw/virtio/virtio-balloon.c | 3 ++- hw/virtio/virtio-bus.c | 3 ++- hw/virtio/virtio-rng.c | 2 +- include/hw/virtio/virtio.h | 4 +++- 12 files changed, 34 insertions(+), 14 deletions(-)
Signature · 1 line
2.1.4
PATCH v4 1/3 virtio: get_features() can fail
--- hw/9pfs/virtio-9p-device.c | 3 ++- hw/block/virtio-blk.c | 3 ++- hw/char/virtio-serial-bus.c | 3 ++- hw/display/virtio-gpu.c | 3 ++- hw/input/virtio-input.c | 3 ++- hw/net/virtio-net.c | 3 ++- hw/scsi/vhost-scsi.c | 3 ++- hw/scsi/virtio-scsi.c | 3 ++- hw/virtio/virtio-balloon.c | 3 ++- hw/virtio/virtio-bus.c | 3 ++- hw/virtio/virtio-rng.c | 2 +- include/hw/virtio/virtio.h | 4 +++- 12 files changed, 24 insertions(+), 12 deletions(-)
hw/9pfs/virtio-9p-device.c +2 -1
@@ -21,7 +21,8 @@#include "virtio-9p-coth.h" #include "hw/virtio/virtio-access.h" -static uint64_t virtio_9p_get_features (VirtIODevice *vdev,uint64_t features) +static uint64_t virtio_9p_get_features (VirtIODevice *vdev,uint64_t features, +Error **errp) {virtio_add_feature (&features,VIRTIO_9P_MOUNT_TAG );return features;
hw/block/virtio-blk.c +2 -1
@@ -722,7 +722,8 @@ static void virtio_blk_set_config(VirtIODevice *vdev, const uint8_t *config)aio_context_release (blk_get_aio_context (s->blk)); } -static uint64_t virtio_blk_get_features (VirtIODevice *vdev,uint64_t features) +static uint64_t virtio_blk_get_features (VirtIODevice *vdev,uint64_t features, +Error **errp) {VirtIOBlock *s =VIRTIO_BLK (vdev);
hw/char/virtio-serial-bus.c +2 -1
@@ -500,7 +500,8 @@ static void handle_input(VirtIODevice *vdev, VirtQueue *vq) } } -static uint64_t get_features (VirtIODevice *vdev,uint64_t features) +static uint64_t get_features (VirtIODevice *vdev,uint64_t features, +Error **errp) {VirtIOSerial *vser;
hw/display/virtio-gpu.c +2 -1
@@ -89,7 +89,8 @@ static void virtio_gpu_set_config(VirtIODevice *vdev, const uint8_t *config) } } -static uint64_t virtio_gpu_get_features (VirtIODevice *vdev,uint64_t features) +static uint64_t virtio_gpu_get_features (VirtIODevice *vdev,uint64_t features, +Error **errp) {return features; }
hw/input/virtio-input.c +2 -1
@@ -166,7 +166,8 @@ static void virtio_input_set_config(VirtIODevice *vdev,virtio_notify_config (vdev); } -static uint64_t virtio_input_get_features (VirtIODevice *vdev,uint64_t f) +static uint64_t virtio_input_get_features (VirtIODevice *vdev,uint64_t f, +Error **errp) {return f; }
hw/net/virtio-net.c +2 -1
@@ -446,7 +446,8 @@ static void virtio_net_set_queues(VirtIONet *n)static void virtio_net_set_multiqueue (VirtIONet *n,int multiqueue); -static uint64_t virtio_net_get_features (VirtIODevice *vdev,uint64_t features) +static uint64_t virtio_net_get_features (VirtIODevice *vdev,uint64_t features, +Error **errp) {VirtIONet *n =VIRTIO_NET (vdev);NetClientState *nc =qemu_get_queue (n->nic);
hw/scsi/vhost-scsi.c +2 -1
@@ -153,7 +153,8 @@ static void vhost_scsi_stop(VHostSCSI *s) }static uint64_t vhost_scsi_get_features (VirtIODevice *vdev, -uint64_t features) +uint64_t features, +Error **errp) {VHostSCSI *s =VHOST_SCSI (vdev);
hw/scsi/virtio-scsi.c +2 -1
@@ -629,7 +629,8 @@ static void virtio_scsi_set_config(VirtIODevice *vdev, }static uint64_t virtio_scsi_get_features (VirtIODevice *vdev, -uint64_t requested_features) +uint64_t requested_features, +Error **errp) {VirtIOSCSI *s =VIRTIO_SCSI (vdev);
hw/virtio/virtio-balloon.c +2 -1
@@ -310,7 +310,8 @@ static void virtio_balloon_set_config(VirtIODevice *vdev,trace_virtio_balloon_set_config (dev->actual, oldactual); } -static uint64_t virtio_balloon_get_features (VirtIODevice *vdev,uint64_t f) +static uint64_t virtio_balloon_get_features (VirtIODevice *vdev,uint64_t f, +Error **errp) {VirtIOBalloon *dev =VIRTIO_BALLOON (vdev); f |= dev->host_features;
hw/virtio/virtio-bus.c +2 -1
@@ -54,7 +54,8 @@ void virtio_bus_device_plugged(VirtIODevice *vdev, Error **errp)/* Get the features of the plugged device. */ assert (vdc->get_features !=NULL ); - vdev->host_features = vdc->get_features (vdev, vdev->host_features); + vdev->host_features = vdc->get_features (vdev, vdev->host_features, + errp); }/* Reset the virtio_bus */
hw/virtio/virtio-rng.c +1 -1
@@ -104,7 +104,7 @@ static void handle_input(VirtIODevice *vdev, VirtQueue *vq)virtio_rng_process (vrng); } -static uint64_t get_features (VirtIODevice *vdev,uint64_t f) +static uint64_t get_features (VirtIODevice *vdev,uint64_t f,Error **errp) {return f; }
include/hw/virtio/virtio.h +3 -1
@@ -101,7 +101,9 @@ typedef struct VirtioDeviceClass {/* This is what a VirtioDevice must implement */ DeviceRealize realize;DeviceUnrealize unrealize; -uint64_t (*get_features)(VirtIODevice *vdev,uint64_t requested_features); +uint64_t (*get_features)(VirtIODevice *vdev, +uint64_t requested_features, +Error **errp);uint64_t (*bad_features)(VirtIODevice *vdev);void (*set_features)(VirtIODevice *vdev,uint64_t val);int (*validate_features)(VirtIODevice *vdev);
Signature · 1 line
2.1.4
PATCH v4 2/3 virtio-blk: fail get_features when both scsi and 1.0 were set
In reply to Jason WangSCSI passthrough was no longer supported in virtio 1.0, so this patch fail the get_features() when both 1.0 and scsi is set. And also only advertise VIRTIO_BLK_F_SCSI for legacy virtio-blk device.
--- hw/block/virtio-blk.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
hw/block/virtio-blk.c +9 -1
@@ -731,8 +731,16 @@ static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features,virtio_add_feature (&features,VIRTIO_BLK_F_GEOMETRY );virtio_add_feature (&features,VIRTIO_BLK_F_TOPOLOGY );virtio_add_feature (&features,VIRTIO_BLK_F_BLK_SIZE ); -virtio_add_feature (&features,VIRTIO_BLK_F_SCSI );virtio_clear_feature (&features,VIRTIO_F_ANY_LAYOUT ); +if (__virtio_has_feature (features,VIRTIO_F_VERSION_1 )) { +if (s->conf.scsi) { +error_setg (errp,"Virtio 1.0 does not support scsi passthrough!" ); +return 0 ; + } +virtio_add_feature (&features,VIRTIO_F_ANY_LAYOUT ); + }else { +virtio_add_feature (&features,VIRTIO_BLK_F_SCSI ); + }if (s->conf.config_wce) {virtio_add_feature (&features,VIRTIO_BLK_F_CONFIG_WCE );
Signature · 1 line
2.1.4
PATCH v4 3/3 virtio-blk: only clear VIRTIO_F_ANY_LAYOUT for legacy device
In reply to Jason WangChapter 6.3 of spec said
"
Transitional devices MUST offer, and if offered by the device transitional drivers MUST accept the following:
VIRTIO_F_ANY_LAYOUT (27)
"
So this patch only clear VIRTIO_F_LAYOUT for legacy device.
--- hw/block/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/block/virtio-blk.c +1 -1
@@ -731,7 +731,6 @@ static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features,virtio_add_feature (&features,VIRTIO_BLK_F_GEOMETRY );virtio_add_feature (&features,VIRTIO_BLK_F_TOPOLOGY );virtio_add_feature (&features,VIRTIO_BLK_F_BLK_SIZE ); -virtio_clear_feature (&features,VIRTIO_F_ANY_LAYOUT );if (__virtio_has_feature (features,VIRTIO_F_VERSION_1 )) {if (s->conf.scsi) {error_setg (errp,"Virtio 1.0 does not support scsi passthrough!" );
@@ -739,6 +738,7 @@ static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features, }virtio_add_feature (&features,VIRTIO_F_ANY_LAYOUT ); }else { +virtio_clear_feature (&features,VIRTIO_F_ANY_LAYOUT );virtio_add_feature (&features,VIRTIO_BLK_F_SCSI ); }
Signature · 1 line
2.1.4
Re: [Qemu-devel] [PATCH V4 2/3] virtio-blk: fail get_features when both scsi and 1.0 were set
In reply to Jason WangQuoted 1 line · Jason Wang
+ if (
__virtio_has_feature(features, VIRTIO_F_VERSION_1)) {
No double underscores in userspace code. Longstanding so it can be fixed after 2.4 is out---but please remember to do it.
hw/block/virtio-blk.c static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features, · line 737
Quoted 2 lines
hw/block/virtio-blk.c +2
-0+if (s->conf.scsi) { +error_setg (errp,"Virtio 1.0 does not support scsi passthrough!" );
Unclear error message, as one would expect SCSI passthrough not to work anyway for e.g. a disk backed by a file.
It's not a big deal as long as you will disable VIRTIO_BLK_F_SCSI by default in the same release that enables VIRTIO_F_VERSION_1 by default.
Paolo
Quoted 6 lines
hw/block/virtio-blk.c +6
-0+return 0 ; + } +virtio_add_feature (&features,VIRTIO_F_ANY_LAYOUT ); + }else { +virtio_add_feature (&features,VIRTIO_BLK_F_SCSI ); + }
Re: [Qemu-devel] [PATCH V4 3/3] virtio-blk: only clear VIRTIO_F_ANY_LAYOUT for legacy device
In reply to Jason WangQuoted 23 lines · Jason Wang
So this patch only clear
VIRTIO_F_LAYOUTfor legacy device.Cc Stefan Hajnoczi <[email protected]>Cc Kevin Wolf <[email protected]>Signed-off-by Jason Wang <[email protected]>--- hw/block/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/block/virtio-blk.c +0
-1@@ -731,7 +731,6 @@ static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features,virtio_add_feature (&features,VIRTIO_BLK_F_GEOMETRY );virtio_add_feature (&features,VIRTIO_BLK_F_TOPOLOGY );virtio_add_feature (&features,VIRTIO_BLK_F_BLK_SIZE ); -virtio_clear_feature (&features,VIRTIO_F_ANY_LAYOUT );if (__virtio_has_feature (features,VIRTIO_F_VERSION_1 )) {if (s->conf.scsi) {error_setg (errp,"Virtio 1.0 does not support scsi passthrough!" );
hw/block/virtio-blk.c static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features, · line 743
Quoted 6 lines
hw/block/virtio-blk.c +1
-0@@ -739,6 +738,7 @@ static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features, }virtio_add_feature (&features,VIRTIO_F_ANY_LAYOUT ); }else { +virtio_clear_feature (&features,VIRTIO_F_ANY_LAYOUT );virtio_add_feature (&features,VIRTIO_BLK_F_SCSI ); }
This patch is unnecessary, since the feature is added back below under "if (__virtio_has_feature(features, VIRTIO_F_VERSION_1))".
Paolo
Re: [Qemu-devel] [PATCH V4 2/3] virtio-blk: fail get_features when both scsi and 1.0 were set
In reply to Paolo BonziniQuoted 5 lines · On Mon, 27 Jul 2015 12:28:23 +0200 Paolo Bonzini <[email protected]> wrote:
Quoted 1 line · Jason Wang
+ if (
__virtio_has_feature(features, VIRTIO_F_VERSION_1)) {No double underscores in userspace code. Longstanding so it can be fixed after 2.4 is out---but please remember to do it.
There's https://marc.info/?l=qemu-devel&m=142599436726514&w=2
which seems to have been lost in all that virtio rebasing.
Re: [Qemu-devel] [PATCH V4 3/3] virtio-blk: only clear VIRTIO_F_ANY_LAYOUT for legacy device
In reply to Paolo BonziniQuoted 36 lines · Paolo Bonzini
Quoted 23 lines · Jason Wang
So this patch only clear
VIRTIO_F_LAYOUTfor legacy device.Cc Stefan Hajnoczi <[email protected]>Cc Kevin Wolf <[email protected]>Signed-off-by Jason Wang <[email protected]>--- hw/block/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/block/virtio-blk.c +0
-1@@ -731,7 +731,6 @@ static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features,virtio_add_feature (&features,VIRTIO_BLK_F_GEOMETRY );virtio_add_feature (&features,VIRTIO_BLK_F_TOPOLOGY );virtio_add_feature (&features,VIRTIO_BLK_F_BLK_SIZE ); -virtio_clear_feature (&features,VIRTIO_F_ANY_LAYOUT );if (__virtio_has_feature (features,VIRTIO_F_VERSION_1 )) {if (s->conf.scsi) {error_setg (errp,"Virtio 1.0 does not support scsi passthrough!" );hw/block/virtio-blk.c static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features, · line 743
Quoted 6 lines
hw/block/virtio-blk.c +1
-0@@ -739,6 +738,7 @@ static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features, }virtio_add_feature (&features,VIRTIO_F_ANY_LAYOUT ); }else { +virtio_clear_feature (&features,VIRTIO_F_ANY_LAYOUT );virtio_add_feature (&features,VIRTIO_BLK_F_SCSI ); }This patch is unnecessary, since the feature is added back below under "if (
__virtio_has_feature(features, VIRTIO_F_VERSION_1))".
Quoted 1 line
Paolo
It's needed so we can apply
virtio: set any_layout in virtio core
Re: [Qemu-devel] [PATCH V4 2/3] virtio-blk: fail get_features when both scsi and 1.0 were set
In reply to Cornelia HuckQuoted 11 lines · Cornelia Huck
Quoted 5 lines · On Mon, 27 Jul 2015 12:28:23 +0200 Paolo Bonzini <[email protected]> wrote:
Quoted 1 line · Jason Wang
+ if (
__virtio_has_feature(features, VIRTIO_F_VERSION_1)) {No double underscores in userspace code. Longstanding so it can be fixed after 2.4 is out---but please remember to do it.
There's https://marc.info/?l=qemu-devel&m=142599436726514&w=2
which seems to have been lost in all that virtio rebasing.
Right.
Pls repost after 2.4.
Signature · 1 line
MST
Re: [Qemu-devel] [PATCH V4 2/3] virtio-blk: fail get_features when both scsi and 1.0 were set
In reply to Paolo BonziniQuoted 5 lines · Paolo Bonzini
Quoted 1 line · Jason Wang
+ if (
__virtio_has_feature(features, VIRTIO_F_VERSION_1)) {
Quoted 8 lines
No double underscores in userspace code. Longstanding so it can be fixed after 2.4 is out---but please remember to do it.
hw/block/virtio-blk.c static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features, · line 737
Quoted 2 lines
hw/block/virtio-blk.c +2
-0+if (s->conf.scsi) { +error_setg (errp,"Virtio 1.0 does not support scsi passthrough!" );Unclear error message, as one would expect SCSI passthrough not to work anyway for e.g. a disk backed by a file.
Right - so I suggested:
Virtio modern does not support scsi passthrough - please set disable-modern=on or switch to virtio-scsi.
With that change - ACK?
Quoted 11 lines
It's not a big deal as long as you will disable
VIRTIO_BLK_F_SCSIby default in the same release that enablesVIRTIO_F_VERSION_1by default.Paolo
Quoted 6 lines
hw/block/virtio-blk.c +6
-0+return 0 ; + } +virtio_add_feature (&features,VIRTIO_F_ANY_LAYOUT ); + }else { +virtio_add_feature (&features,VIRTIO_BLK_F_SCSI ); + }
Re: [Qemu-devel] [PATCH V4 2/3] virtio-blk: fail get_features when both scsi and 1.0 were set
Quoted 8 lines · Michael S. Tsirkin
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
hw/block/virtio-blk.c static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features, · line 737
Quoted 2 lines
hw/block/virtio-blk.c +2
-0+if (s->conf.scsi) { +error_setg (errp,"Virtio 1.0 does not support scsi passthrough!" );Unclear error message, as one would expect SCSI passthrough not to work anyway for e.g. a disk backed by a file.
Right - so I suggested:
Virtio modern does not support scsi passthrough - please set disable-modern=on or switch to virtio-scsi.
With that change - ACK?
scsi=on by default, so everyone is getting the message until they disable virtio 1.0. Suggesting a switch to virtio-scsi doesn't make sense.
Your proposal makes sense once scsi=off by default. Until then, what about "please set scsi=off for virtio-blk devices in order to use virtio 1.0"?
Paolo
Re: [Qemu-devel] [PATCH V4 3/3] virtio-blk: only clear VIRTIO_F_ANY_LAYOUT for legacy device
In reply to Michael S. TsirkinQuoted 5 lines · Michael S. Tsirkin
Quoted 2 lines
This patch is unnecessary, since the feature is added back below under "if (
__virtio_has_feature(features, VIRTIO_F_VERSION_1))".It's needed so we can apply
virtio: setany_layoutin virtio core
Ah, okay.
Paolo
Quoted 5 lines · Jason Wang
Hi all:
This series tries to set feature correctly for virtio-blk when virtio 1.0 is supported. Two isssues were addressed according to the spec:
Quoted 8 lines
- scsi passthrough was not support in 1.0. This is done through: 1) let
get_features()can fail 2) fail theget_features()when both scsi and virtio 1.0 is enabled.
- any layout must be set for transitional device. This is done by set any layout when 1.0 is supported.Changes from V3:
- rebase on top of Michael'sany_layoutfixes
With my fixup to the error message,
Paolo
Quoted 31 lines
Changes from V2:
- Keep scsi=on by default since virtio 1.0 is disabled by default
- AdvertiseVIRTIO_BLK_F_SCSIunconditionally if virtio 1.0 is disabledChanges from V1:
- Split virtio-net changes out of the series
- EnableVIRTIO_BLK_F_SCSIonly when scsi is set
- Disable scsi by default and compat it for legacy machine types
- Letget_features()can fail and fail the initialization of virito-blk when both 1.0 and scsi were supported.Jason Wang (3):
virtio:get_features()can fail
virtio-blk: failget_featureswhen both scsi and 1.0 were set
virtio-blk: only clearVIRTIO_F_ANY_LAYOUTfor legacy devicehw/9pfs/virtio-9p-device.c | 3 ++- hw/block/virtio-blk.c | 15 ++++++++++++--- hw/char/virtio-serial-bus.c | 3 ++- hw/display/virtio-gpu.c | 3 ++- hw/input/virtio-input.c | 3 ++- hw/net/virtio-net.c | 3 ++- hw/scsi/vhost-scsi.c | 3 ++- hw/scsi/virtio-scsi.c | 3 ++- hw/virtio/virtio-balloon.c | 3 ++- hw/virtio/virtio-bus.c | 3 ++- hw/virtio/virtio-rng.c | 2 +- include/hw/virtio/virtio.h | 4 +++- 12 files changed, 34 insertions(+), 14 deletions(-)
Re: [Qemu-devel] [PATCH V4 3/3] virtio-blk: only clear VIRTIO_F_ANY_LAYOUT for legacy device
In reply to Michael S. TsirkinQuoted 37 lines · On Mon, 27 Jul 2015 14:22:37 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 36 lines · Paolo Bonzini
Quoted 23 lines · Jason Wang
So this patch only clear
VIRTIO_F_LAYOUTfor legacy device.Cc Stefan Hajnoczi <[email protected]>Cc Kevin Wolf <[email protected]>Signed-off-by Jason Wang <[email protected]>--- hw/block/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/block/virtio-blk.c +0
-1@@ -731,7 +731,6 @@ static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features,virtio_add_feature (&features,VIRTIO_BLK_F_GEOMETRY );virtio_add_feature (&features,VIRTIO_BLK_F_TOPOLOGY );virtio_add_feature (&features,VIRTIO_BLK_F_BLK_SIZE ); -virtio_clear_feature (&features,VIRTIO_F_ANY_LAYOUT );if (__virtio_has_feature (features,VIRTIO_F_VERSION_1 )) {if (s->conf.scsi) {error_setg (errp,"Virtio 1.0 does not support scsi passthrough!" );hw/block/virtio-blk.c static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features, · line 743
Quoted 6 lines
hw/block/virtio-blk.c +1
-0@@ -739,6 +738,7 @@ static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features, }virtio_add_feature (&features,VIRTIO_F_ANY_LAYOUT ); }else { +virtio_clear_feature (&features,VIRTIO_F_ANY_LAYOUT );virtio_add_feature (&features,VIRTIO_BLK_F_SCSI ); }This patch is unnecessary, since the feature is added back below under "if (
__virtio_has_feature(features, VIRTIO_F_VERSION_1))".
Quoted 4 lines
Quoted 1 line
Paolo
It's needed so we can apply
virtio: setany_layoutin virtio core
So what's the plan on all those virtio feature patches? It's hard to keep track about what is based upon what, and what the end result looks like. I don't have a good feeling about doing this that late in the 2.4 cycle.
Re: [Qemu-devel] [PATCH V4 3/3] virtio-blk: only clear VIRTIO_F_ANY_LAYOUT for legacy device
Quoted 40 lines · Cornelia Huck
Quoted 37 lines · On Mon, 27 Jul 2015 14:22:37 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 36 lines · Paolo Bonzini
Quoted 23 lines · Jason Wang
So this patch only clear
VIRTIO_F_LAYOUTfor legacy device.Cc Stefan Hajnoczi <[email protected]>Cc Kevin Wolf <[email protected]>Signed-off-by Jason Wang <[email protected]>--- hw/block/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/block/virtio-blk.c +0
-1@@ -731,7 +731,6 @@ static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features,virtio_add_feature (&features,VIRTIO_BLK_F_GEOMETRY );virtio_add_feature (&features,VIRTIO_BLK_F_TOPOLOGY );virtio_add_feature (&features,VIRTIO_BLK_F_BLK_SIZE ); -virtio_clear_feature (&features,VIRTIO_F_ANY_LAYOUT );if (__virtio_has_feature (features,VIRTIO_F_VERSION_1 )) {if (s->conf.scsi) {error_setg (errp,"Virtio 1.0 does not support scsi passthrough!" );hw/block/virtio-blk.c static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features, · line 743
Quoted 6 lines
hw/block/virtio-blk.c +1
-0@@ -739,6 +738,7 @@ static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features, }virtio_add_feature (&features,VIRTIO_F_ANY_LAYOUT ); }else { +virtio_clear_feature (&features,VIRTIO_F_ANY_LAYOUT );virtio_add_feature (&features,VIRTIO_BLK_F_SCSI ); }This patch is unnecessary, since the feature is added back below under "if (
__virtio_has_feature(features, VIRTIO_F_VERSION_1))".
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Paolo
It's needed so we can apply
virtio: setany_layoutin virtio coreSo what's the plan on all those virtio feature patches? It's hard to keep track about what is based upon what, and what the end result looks like.
I pushed everything out to my pci branch, pls take a look. This is what I have:
b787b35 acpi: fix pvpanic device is not shown in ui
49009db hw/acpi/ich9: clean up stale comment about KVM not supporting SMM e513e9c hw/acpi/ich9: clear smi_en on reset
c9b11f9 virtio-blk: only clear VIRTIO_F_ANY_LAYOUT for legacy device efb8206 virtio-blk: fail get_features when both scsi and 1.0 were set 9d5b731 virtio: get_features() can fail
2746269 virtio-pci: fix memory MR cleanup for modern
09999a5 virtio: set any_layout in virtio core
cd4bfbb virtio-9p: fix any_layout
7882080 virtio-serial: fix ANY_LAYOUT
5f45607 virtio: hide legacy features from modern guests
Quoted 2 lines
I don't have a good feeling about doing this that late in the 2.4 cycle.
Well there will always be bugs. Given modern is disabled by default, even if more bugs surface after release it's not the end of the world.
Signature · 1 line
MST
Re: [Qemu-devel] [PATCH V4 2/3] virtio-blk: fail get_features when both scsi and 1.0 were set
In reply to Michael S. TsirkinQuoted 7 lines · Michael S. Tsirkin
Quoted 6 lines · Paolo Bonzini
Quoted 1 line · Jason Wang
+ if (
__virtio_has_feature(features, VIRTIO_F_VERSION_1)) {No double underscores in userspace code. Longstanding so it can be fixed after 2.4 is out---but please remember to do it.
Quoted 7 lines
Quoted 4 lines
hw/block/virtio-blk.c static uint64_t virtio_blk_get_features(VirtIODevice *vdev, uint64_t features, · line 737
Quoted 2 lines
hw/block/virtio-blk.c +2
-0+if (s->conf.scsi) { +error_setg (errp,"Virtio 1.0 does not support scsi passthrough!" );Unclear error message, as one would expect SCSI passthrough not to work anyway for e.g. a disk backed by a file.
Right - so I suggested:
Virtio modern does not support scsi passthrough - please set disable-modern=on or switch to virtio-scsi.
With that change - ACK?
I've considered this, but a little problem is 'disable-modern' only works for pci.
Quoted 10 lines
Quoted 10 lines
It's not a big deal as long as you will disable
VIRTIO_BLK_F_SCSIby default in the same release that enablesVIRTIO_F_VERSION_1by default.Paolo
Quoted 6 lines
hw/block/virtio-blk.c +6
-0+return 0 ; + } +virtio_add_feature (&features,VIRTIO_F_ANY_LAYOUT ); + }else { +virtio_add_feature (&features,VIRTIO_BLK_F_SCSI ); + }