summaryrefslogtreecommitdiffstats
path: root/hw/s390x/virtio-ccw.c
diff options
context:
space:
mode:
authorCornelia Huck2020-01-16 13:10:35 +0100
committerCornelia Huck2020-01-27 12:13:09 +0100
commit3c5fd8074335c67777d9391b84f97070c35d9c63 (patch)
treec4f8ff10d41811bd53910b2046daa63acd3bbe72 /hw/s390x/virtio-ccw.c
parents390x/event-facility.c: remove unneeded labels (diff)
downloadqemu-3c5fd8074335c67777d9391b84f97070c35d9c63.tar.gz
qemu-3c5fd8074335c67777d9391b84f97070c35d9c63.tar.xz
qemu-3c5fd8074335c67777d9391b84f97070c35d9c63.zip
s390x: adapter routes error handling
If the kernel irqchip has been disabled, we don't want the {add,release}_adapter_routes routines to call any kvm_irqchip_* interfaces, as they may rely on an irqchip actually having been created. Just take a quick exit in that case instead. If you are trying to use irqfd without a kernel irqchip, we will fail with an error. Also initialize routes->gsi[] with -1 in the virtio-ccw handling, to make sure we don't trip over other errors, either. (Nobody else uses the gsi array in that structure.) Fixes: d426d9fba8ea ("s390x/virtio-ccw: wire up irq routing and irqfds") Reviewed-by: Thomas Huth <thuth@redhat.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-Id: <20200117111147.5006-1-cohuck@redhat.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'hw/s390x/virtio-ccw.c')
-rw-r--r--hw/s390x/virtio-ccw.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 6580ce5907..13f57e7b67 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -697,6 +697,7 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp)
CCWDeviceClass *ck = CCW_DEVICE_GET_CLASS(ccw_dev);
SubchDev *sch;
Error *err = NULL;
+ int i;
sch = css_create_sch(ccw_dev->devno, errp);
if (!sch) {
@@ -717,6 +718,9 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp)
ccw_dev->sch = sch;
dev->indicators = NULL;
dev->revision = -1;
+ for (i = 0; i < ADAPTER_ROUTES_MAX_GSI; i++) {
+ dev->routes.gsi[i] = -1;
+ }
css_sch_build_virtual_schib(sch, 0, VIRTIO_CCW_CHPID_TYPE);
trace_virtio_ccw_new_device(