Skip to content

Commit d85dead

Browse files
benzeajmberg-intel
authored andcommitted
um: virtio_uml: fix call_fd IRQ allocation
If the device does not support slave requests, then the IRQ will not yet be allocated. So initialize the IRQ to UM_IRQ_ALLOC so that it will be allocated if none has been assigned yet and store it slightly later when we know that it will not be immediately unregistered again. Signed-off-by: Benjamin Berg <benjamin.berg@intel.com> Link: https://patch.msgid.link/20241103212854.1436046-4-benjamin@sipsolutions.net Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent fcbd26d commit d85dead

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

arch/um/drivers/virtio_uml.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ static int vu_setup_vq_call_fd(struct virtio_uml_device *vu_dev,
888888
{
889889
struct virtio_uml_vq_info *info = vq->priv;
890890
int call_fds[2];
891-
int rc;
891+
int rc, irq;
892892

893893
/* no call FD needed/desired in this case */
894894
if (vu_dev->protocol_features &
@@ -905,19 +905,23 @@ static int vu_setup_vq_call_fd(struct virtio_uml_device *vu_dev,
905905
return rc;
906906

907907
info->call_fd = call_fds[0];
908-
rc = um_request_irq(vu_dev->irq, info->call_fd, IRQ_READ,
909-
vu_interrupt, IRQF_SHARED, info->name, vq);
910-
if (rc < 0)
908+
irq = um_request_irq(vu_dev->irq, info->call_fd, IRQ_READ,
909+
vu_interrupt, IRQF_SHARED, info->name, vq);
910+
if (irq < 0) {
911+
rc = irq;
911912
goto close_both;
913+
}
912914

913915
rc = vhost_user_set_vring_call(vu_dev, vq->index, call_fds[1]);
914916
if (rc)
915917
goto release_irq;
916918

919+
vu_dev->irq = irq;
920+
917921
goto out;
918922

919923
release_irq:
920-
um_free_irq(vu_dev->irq, vq);
924+
um_free_irq(irq, vq);
921925
close_both:
922926
os_close_file(call_fds[0]);
923927
out:
@@ -1201,6 +1205,7 @@ static int virtio_uml_probe(struct platform_device *pdev)
12011205
vu_dev->vdev.id.vendor = VIRTIO_DEV_ANY_ID;
12021206
vu_dev->pdev = pdev;
12031207
vu_dev->req_fd = -1;
1208+
vu_dev->irq = UM_IRQ_ALLOC;
12041209

12051210
time_travel_propagate_time();
12061211

0 commit comments

Comments
 (0)