[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/13] virtio-ccw: Check the number of vqs in CCW_CMD
From: |
Cornelia Huck |
Subject: |
[Qemu-devel] [PULL 06/13] virtio-ccw: Check the number of vqs in CCW_CMD_SET_IND |
Date: |
Fri, 24 Feb 2017 10:22:52 +0100 |
From: Halil Pasic <address@hidden>
We cannot support more than 64 virtqueues with the 64 bits provided by
classic indicators. If a driver tries to setup classic indicators
(which it is free to do even for virtio-1 devices) for a device with
more than 64 virtqueues, we should reject the attempt so that the
driver does not end up with an unusable device.
This is in preparation for bumping the number of supported virtqueues
on the ccw transport.
Signed-off-by: Halil Pasic <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
Reviewed-by: Christian Borntraeger <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
hw/s390x/virtio-ccw.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 613d8c6615..771411ea3c 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -35,6 +35,8 @@
#include "trace.h"
#include "hw/s390x/css-bridge.h"
+#define NR_CLASSIC_INDICATOR_BITS 64
+
static void virtio_ccw_bus_new(VirtioBusState *bus, size_t bus_size,
VirtioCcwDevice *dev);
@@ -509,6 +511,11 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
ret = -ENOSYS;
break;
}
+ if (virtio_get_num_queues(vdev) > NR_CLASSIC_INDICATOR_BITS) {
+ /* More queues than indicator bits --> trigger a reject */
+ ret = -ENOSYS;
+ break;
+ }
if (!ccw.cda) {
ret = -EFAULT;
} else {
--
2.11.0
- [Qemu-devel] [PULL 00/13] s390x patches for 2.9, Cornelia Huck, 2017/02/24
- [Qemu-devel] [PULL 01/13] s390x/s390-virtio: get rid of DPRINTF, Cornelia Huck, 2017/02/24
- [Qemu-devel] [PULL 05/13] virtio-ccw: add virtio-crypto-ccw device, Cornelia Huck, 2017/02/24
- [Qemu-devel] [PULL 02/13] s390x/kvm: detect some program check loops, Cornelia Huck, 2017/02/24
- [Qemu-devel] [PULL 03/13] s390x/flic: fail migration on source already, Cornelia Huck, 2017/02/24
- [Qemu-devel] [PULL 06/13] virtio-ccw: Check the number of vqs in CCW_CMD_SET_IND,
Cornelia Huck <=
- [Qemu-devel] [PULL 04/13] virtio-ccw: handle virtio 1 only devices, Cornelia Huck, 2017/02/24
- [Qemu-devel] [PULL 07/13] s390x: add property adapter_routes_max_batch, Cornelia Huck, 2017/02/24
- [Qemu-devel] [PULL 09/13] s390x: bump ADAPTER_ROUTES_MAX_GSI, Cornelia Huck, 2017/02/24
- [Qemu-devel] [PULL 08/13] virtio-ccw: check flic->adapter_routes_max_batch, Cornelia Huck, 2017/02/24
- [Qemu-devel] [PULL 10/13] virtio-ccw: support VIRTIO_QUEUE_MAX virtqueues, Cornelia Huck, 2017/02/24
- [Qemu-devel] [PULL 12/13] s390x/arch_dump: pass cpuid into notes sections, Cornelia Huck, 2017/02/24
- [Qemu-devel] [PULL 13/13] s390x/css: handle format-0 TIC CCW correctly, Cornelia Huck, 2017/02/24
- [Qemu-devel] [PULL 11/13] s390x/arch_dump: use proper note name and note size, Cornelia Huck, 2017/02/24
- Re: [Qemu-devel] [PULL 00/13] s390x patches for 2.9, Peter Maydell, 2017/02/25