virtio-scsi-ccw: fix iotest 068 for s390x
v2 cover virtio-scsi-ccw: fix iotest 068 for s390x
This commit fixes iotest 068 for s390x as s390x uses virtio-scsi-ccw. It's based on commit c324fd0a39c by Stefan Hajnoczi. Thanks!
Change history:
v2:
Remove Stefan from sign-off list and change the patch's commit message according to Christian Borntraeger's comment.
QingFeng Hao (1):
virtio-scsi-ccw: use ioeventfd even when KVM is disabled
hw/s390x/virtio-ccw.c | 2 +- target/s390x/kvm.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
Signature · 1 line
2.11.2
PATCH v2 1/1 virtio-scsi-ccw: use ioeventfd even when KVM is disabled
This patch is based on a similar patch from Stefan Hajnoczi - commit c324fd0a39c (" virtio-pci: use ioeventfd even when KVM is disabled)
Do not check kvm_eventfds_enabled() when KVM is disabled since it always returns 0. Since commit 8c56c1a592b5092d91da8d8943c17777d6462a6f ("memory: emulate ioeventfd") it has been possible to use ioeventfds in qtest or TCG mode.
This patch makes -device virtio-scsi-ccw,iothread=iothread0 work even when KVM is disabled.
I have tested that virtio-scsi-ccw works under tcg both with and without iothread.
This patch fixes qemu-iotests 068, which was accidentally merged early despite the dependency on ioeventfd.
--- hw/s390x/virtio-ccw.c | 2 +- target/s390x/kvm.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
hw/s390x/virtio-ccw.c +1 -1
@@ -711,7 +711,7 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp) sch->cssid, sch->ssid, sch->schid, sch->devno, ccw_dev->devno.valid ? "user-configured" : "auto-configured"); -if (!kvm_eventfds_enabled ()) { +if (kvm_enabled () && !kvm_eventfds_enabled ()) { dev->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD ; }
target/s390x/kvm.c +3 -0
@@ -2220,6 +2220,9 @@ int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, .addr = sch, .len = 8, }; +if (!kvm_enabled ()) { +return 0 ; + }if (!kvm_check_extension (kvm_state,KVM_CAP_IOEVENTFD )) {return -ENOSYS ; }
Signature · 1 line
2.11.2
Re: [Qemu-devel] [PATCH v2 1/1] virtio-scsi-ccw: use ioeventfd even when KVM is disabled
Quoted 41 lines · QingFeng Hao
This patch is based on a similar patch from Stefan Hajnoczi - commit
c324fd0a39c(" virtio-pci: use ioeventfd even when KVM is disabled)Do not check
kvm_eventfds_enabled()when KVM is disabled since it always returns 0. Since commit8c56c1a592b5092d91da8d8943c17777d6462a6f("memory: emulate ioeventfd") it has been possible to use ioeventfds in qtest or TCG mode.This patch makes -device virtio-scsi-ccw,iothread=iothread0 work even when KVM is disabled.
I have tested that virtio-scsi-ccw works under tcg both with and without iothread.
This patch fixes qemu-iotests 068, which was accidentally merged early despite the dependency on ioeventfd.
Signed-off-by QingFeng Hao <[email protected]>--- hw/s390x/virtio-ccw.c | 2 +- target/s390x/kvm.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)hw/s390x/virtio-ccw.c +1
-1@@ -711,7 +711,7 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp) sch->cssid, sch->ssid, sch->schid, sch->devno, ccw_dev->devno.valid ? "user-configured" : "auto-configured"); -if (!kvm_eventfds_enabled ()) { +if (kvm_enabled () && !kvm_eventfds_enabled ()) { dev->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD ; }target/s390x/kvm.c +0
-0
target/s390x/kvm.c int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, · line 2225
Quoted 6 lines
target/s390x/kvm.c +3
-0@@ -2220,6 +2220,9 @@ int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, .addr = sch, .len = 8, }; +if (!kvm_enabled ()) { +return 0 ; + }
thinking more about it. wouldnt it be better to do something like this instead
target/s390x/cpu.h +5 -1
@@ -1240,7 +1240,11 @@ static inline int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id, int vq, bool assign) { - return kvm_s390_assign_subch_ioeventfd(notifier, sch_id, vq, assign); + if (kvm_enabled()) { + return kvm_s390_assign_subch_ioeventfd(notifier, sch_id, vq, assign); + } else { +return 0 ; + } }static inline void s390_crypto_reset (void )
FWIW, it seems that we (s390) do not have a functional equivalent function as commit 8c56c1a592b5092d91da8d8943c17777d6462a6f ("memory: emulate ioeventfd") , so we will not use the iothreads.
Quoted 4 lines
target/s390x/kvm.c +0
-0if (!kvm_check_extension (kvm_state,KVM_CAP_IOEVENTFD )) {return -ENOSYS ; }
Re: [Qemu-devel] [PATCH v2 1/1] virtio-scsi-ccw: use ioeventfd even when KVM is disabled
Quoted 23 lines · On Mon, 3 Jul 2017 12:20:03 +0200 Christian Borntraeger…
target/s390x/kvm.c int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, · line 2225
Quoted 11 lines · QingFeng Hao
target/s390x/kvm.c +3
-0@@ -2220,6 +2220,9 @@ int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, .addr = sch, .len = 8, }; +if (!kvm_enabled ()) { +return 0 ; + }thinking more about it. wouldnt it be better to do something like this instead
target/s390x/cpu.h +0
-0@@ -1240,7 +1240,11 @@ static inline int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id, int vq, bool assign)
target/s390x/cpu.h static inline int s390_assign_subch_ioeventfd(EventNotifier *notifier, · line 1250
Quoted 10 lines
target/s390x/cpu.h +5
-1{ -return kvm_s390_assign_subch_ioeventfd (notifier, sch_id, vq, assign); +if (kvm_enabled ()) { +return kvm_s390_assign_subch_ioeventfd (notifier, sch_id, vq, assign); + }else { +return 0 ; + } }static inline void s390_crypto_reset (void )
Agreed.
Quoted 5 lines
FWIW, it seems that we (s390) do not have a functional equivalent function as commit
8c56c1a592b5092d91da8d8943c17777d6462a6f("memory: emulate ioeventfd") , so we will not use the iothreads.
Should not be a problem, I think. We may want to cook up an equivalent, though.
Quoted 8 lines
Quoted 6 lines
target/s390x/kvm.c +0
-0if (!kvm_check_extension (kvm_state,KVM_CAP_IOEVENTFD )) {return -ENOSYS ; }
Re: [Qemu-devel] [PATCH v2 1/1] virtio-scsi-ccw: use ioeventfd even when KVM is disabled
In reply to Christian BorntraegerQuoted 55 lines · Christian Borntraeger
Quoted 41 lines · QingFeng Hao
This patch is based on a similar patch from Stefan Hajnoczi - commit
c324fd0a39c(" virtio-pci: use ioeventfd even when KVM is disabled)Do not check
kvm_eventfds_enabled()when KVM is disabled since it always returns 0. Since commit8c56c1a592b5092d91da8d8943c17777d6462a6f("memory: emulate ioeventfd") it has been possible to use ioeventfds in qtest or TCG mode.This patch makes -device virtio-scsi-ccw,iothread=iothread0 work even when KVM is disabled.
I have tested that virtio-scsi-ccw works under tcg both with and without iothread.
This patch fixes qemu-iotests 068, which was accidentally merged early despite the dependency on ioeventfd.
Signed-off-by QingFeng Hao <[email protected]>--- hw/s390x/virtio-ccw.c | 2 +- target/s390x/kvm.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)hw/s390x/virtio-ccw.c +1
-1@@ -711,7 +711,7 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp) sch->cssid, sch->ssid, sch->schid, sch->devno, ccw_dev->devno.valid ? "user-configured" : "auto-configured"); -if (!kvm_eventfds_enabled ()) { +if (kvm_enabled () && !kvm_eventfds_enabled ()) { dev->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD ; }target/s390x/kvm.c +0
-0target/s390x/kvm.c int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, · line 2225
Quoted 6 lines
target/s390x/kvm.c +3
-0@@ -2220,6 +2220,9 @@ int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, .addr = sch, .len = 8, }; +if (!kvm_enabled ()) { +return 0 ; + }thinking more about it. wouldnt it be better to do something like this instead
target/s390x/cpu.h +0
-0
target/s390x/cpu.h static inline int s390_assign_subch_ioeventfd(EventNotifier *notifier, · line 1248
Quoted 10 lines
target/s390x/cpu.h +5
-1@@ -1240,7 +1240,11 @@ static inline int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id, int vq, bool assign) { - return kvm_s390_assign_subch_ioeventfd(notifier, sch_id, vq, assign); + if (kvm_enabled()) { + return kvm_s390_assign_subch_ioeventfd(notifier, sch_id, vq, assign); + } else { +return 0 ; + } }
Thanks. It makes sense. I'll change it.
Quoted 6 lines
target/s390x/cpu.h +0
-0static inline void s390_crypto_reset (void )FWIW, it seems that we (s390) do not have a functional equivalent function as commit
8c56c1a592b5092d91da8d8943c17777d6462a6f("memory: emulate ioeventfd") , so we will not use the iothreads.
Ok, but might s390 have skipped the iothread arguments and passed the test, so we could still keep this test case?
Quoted 5 lines
Quoted 5 lines
target/s390x/kvm.c +0
-0if (!kvm_check_extension (kvm_state,KVM_CAP_IOEVENTFD )) {return -ENOSYS ; }
Signature · 2 lines
Regards QingFeng Hao
Re: [Qemu-devel] [PATCH v2 1/1] virtio-scsi-ccw: use ioeventfd even when KVM is disabled
Quoted 69 lines · QingFeng Hao
Quoted 55 lines · Christian Borntraeger
Quoted 41 lines · QingFeng Hao
This patch is based on a similar patch from Stefan Hajnoczi - commit
c324fd0a39c(" virtio-pci: use ioeventfd even when KVM is disabled)Do not check
kvm_eventfds_enabled()when KVM is disabled since it always returns 0. Since commit8c56c1a592b5092d91da8d8943c17777d6462a6f("memory: emulate ioeventfd") it has been possible to use ioeventfds in qtest or TCG mode.This patch makes -device virtio-scsi-ccw,iothread=iothread0 work even when KVM is disabled.
I have tested that virtio-scsi-ccw works under tcg both with and without iothread.
This patch fixes qemu-iotests 068, which was accidentally merged early despite the dependency on ioeventfd.
Signed-off-by QingFeng Hao <[email protected]>--- hw/s390x/virtio-ccw.c | 2 +- target/s390x/kvm.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)hw/s390x/virtio-ccw.c +1
-1@@ -711,7 +711,7 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp) sch->cssid, sch->ssid, sch->schid, sch->devno, ccw_dev->devno.valid ? "user-configured" : "auto-configured"); -if (!kvm_eventfds_enabled ()) { +if (kvm_enabled () && !kvm_eventfds_enabled ()) { dev->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD ; }target/s390x/kvm.c +0
-0target/s390x/kvm.c int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, · line 2225
Quoted 6 lines
target/s390x/kvm.c +3
-0@@ -2220,6 +2220,9 @@ int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, .addr = sch, .len = 8, }; +if (!kvm_enabled ()) { +return 0 ; + }thinking more about it. wouldnt it be better to do something like this instead
target/s390x/cpu.h +0
-0target/s390x/cpu.h static inline int s390_assign_subch_ioeventfd(EventNotifier *notifier, · line 1248
Quoted 10 lines
target/s390x/cpu.h +5
-1@@ -1240,7 +1240,11 @@ static inline int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id, int vq, bool assign) { - return kvm_s390_assign_subch_ioeventfd(notifier, sch_id, vq, assign); + if (kvm_enabled()) { + return kvm_s390_assign_subch_ioeventfd(notifier, sch_id, vq, assign); + } else { +return 0 ; + } }Thanks. It makes sense. I'll change it.
Quoted 8 lines
Quoted 6 lines
target/s390x/cpu.h +0
-0static inline void s390_crypto_reset (void )FWIW, it seems that we (s390) do not have a functional equivalent function as commit
8c56c1a592b5092d91da8d8943c17777d6462a6f("memory: emulate ioeventfd") , so we will not use the iothreads.Ok, but might s390 have skipped the iothread arguments and passed the test, so we could still keep this test case?
Yes, lets just fix the test case. We can implement emulated ioeventfds later.
Re: [Qemu-devel] [PATCH v2 1/1] virtio-scsi-ccw: use ioeventfd even when KVM is disabled
Quoted 72 lines · Christian Borntraeger
Quoted 71 lines · QingFeng Hao
Quoted 55 lines · Christian Borntraeger
Quoted 41 lines · QingFeng Hao
This patch is based on a similar patch from Stefan Hajnoczi - commit
c324fd0a39c(" virtio-pci: use ioeventfd even when KVM is disabled)Do not check
kvm_eventfds_enabled()when KVM is disabled since it always returns 0. Since commit8c56c1a592b5092d91da8d8943c17777d6462a6f("memory: emulate ioeventfd") it has been possible to use ioeventfds in qtest or TCG mode.This patch makes -device virtio-scsi-ccw,iothread=iothread0 work even when KVM is disabled.
I have tested that virtio-scsi-ccw works under tcg both with and without iothread.
This patch fixes qemu-iotests 068, which was accidentally merged early despite the dependency on ioeventfd.
Signed-off-by QingFeng Hao <[email protected]>--- hw/s390x/virtio-ccw.c | 2 +- target/s390x/kvm.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)hw/s390x/virtio-ccw.c +1
-1@@ -711,7 +711,7 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp) sch->cssid, sch->ssid, sch->schid, sch->devno, ccw_dev->devno.valid ? "user-configured" : "auto-configured"); -if (!kvm_eventfds_enabled ()) { +if (kvm_enabled () && !kvm_eventfds_enabled ()) { dev->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD ; }target/s390x/kvm.c +0
-0target/s390x/kvm.c int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, · line 2225
Quoted 6 lines
target/s390x/kvm.c +3
-0@@ -2220,6 +2220,9 @@ int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, .addr = sch, .len = 8, }; +if (!kvm_enabled ()) { +return 0 ; + }thinking more about it. wouldnt it be better to do something like this instead
target/s390x/cpu.h +0
-0target/s390x/cpu.h static inline int s390_assign_subch_ioeventfd(EventNotifier *notifier, · line 1248
Quoted 10 lines
target/s390x/cpu.h +5
-1@@ -1240,7 +1240,11 @@ static inline int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id, int vq, bool assign) { - return kvm_s390_assign_subch_ioeventfd(notifier, sch_id, vq, assign); + if (kvm_enabled()) { + return kvm_s390_assign_subch_ioeventfd(notifier, sch_id, vq, assign); + } else { +return 0 ; + } }Thanks. It makes sense. I'll change it.
Quoted 3 lines
target/s390x/cpu.h +0
-0static inline void s390_crypto_reset (void )
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
FWIW, it seems that we (s390) do not have a functional equivalent function as commit
8c56c1a592b5092d91da8d8943c17777d6462a6f("memory: emulate ioeventfd") , so we will not use the iothreads.Ok, but might s390 have skipped the iothread arguments and passed the test, so we could still keep this test case?
Yes, lets just fix the test case. We can implement emulated ioeventfds later.
Fine, thanks!
Quoted 1 line
Signature · 2 lines
Regards QingFeng Hao