mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 22:21:42 +00:00
um: virtio: Use dynamic IRQ allocation
This separates the devices, which is better for debug and for later suspend/resume and wakeup support, since there we'll have to separate which IRQs can wake up the system and which cannot. Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com> Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
parent
36d46a5907
commit
aaf5800e24
@ -55,7 +55,7 @@ struct virtio_uml_device {
|
||||
struct platform_device *pdev;
|
||||
|
||||
spinlock_t sock_lock;
|
||||
int sock, req_fd;
|
||||
int sock, req_fd, irq;
|
||||
u64 features;
|
||||
u64 protocol_features;
|
||||
u8 status;
|
||||
@ -409,12 +409,14 @@ static int vhost_user_init_slave_req(struct virtio_uml_device *vu_dev)
|
||||
return rc;
|
||||
vu_dev->req_fd = req_fds[0];
|
||||
|
||||
rc = um_request_irq(VIRTIO_IRQ, vu_dev->req_fd, IRQ_READ,
|
||||
rc = um_request_irq(UM_IRQ_ALLOC, vu_dev->req_fd, IRQ_READ,
|
||||
vu_req_interrupt, IRQF_SHARED,
|
||||
vu_dev->pdev->name, vu_dev);
|
||||
if (rc < 0)
|
||||
goto err_close;
|
||||
|
||||
vu_dev->irq = rc;
|
||||
|
||||
rc = vhost_user_send_no_payload_fd(vu_dev, VHOST_USER_SET_SLAVE_REQ_FD,
|
||||
req_fds[1]);
|
||||
if (rc)
|
||||
@ -423,7 +425,7 @@ static int vhost_user_init_slave_req(struct virtio_uml_device *vu_dev)
|
||||
goto out;
|
||||
|
||||
err_free_irq:
|
||||
um_free_irq(VIRTIO_IRQ, vu_dev);
|
||||
um_free_irq(vu_dev->irq, vu_dev);
|
||||
err_close:
|
||||
os_close_file(req_fds[0]);
|
||||
out:
|
||||
@ -802,7 +804,11 @@ static void vu_del_vq(struct virtqueue *vq)
|
||||
struct virtio_uml_vq_info *info = vq->priv;
|
||||
|
||||
if (info->call_fd >= 0) {
|
||||
um_free_irq(VIRTIO_IRQ, vq);
|
||||
struct virtio_uml_device *vu_dev;
|
||||
|
||||
vu_dev = to_virtio_uml_device(vq->vdev);
|
||||
|
||||
um_free_irq(vu_dev->irq, vq);
|
||||
os_close_file(info->call_fd);
|
||||
}
|
||||
|
||||
@ -852,7 +858,7 @@ static int vu_setup_vq_call_fd(struct virtio_uml_device *vu_dev,
|
||||
return rc;
|
||||
|
||||
info->call_fd = call_fds[0];
|
||||
rc = um_request_irq(VIRTIO_IRQ, info->call_fd, IRQ_READ,
|
||||
rc = um_request_irq(vu_dev->irq, info->call_fd, IRQ_READ,
|
||||
vu_interrupt, IRQF_SHARED, info->name, vq);
|
||||
if (rc < 0)
|
||||
goto close_both;
|
||||
@ -864,7 +870,7 @@ static int vu_setup_vq_call_fd(struct virtio_uml_device *vu_dev,
|
||||
goto out;
|
||||
|
||||
release_irq:
|
||||
um_free_irq(VIRTIO_IRQ, vq);
|
||||
um_free_irq(vu_dev->irq, vq);
|
||||
close_both:
|
||||
os_close_file(call_fds[0]);
|
||||
out:
|
||||
@ -969,7 +975,7 @@ static struct virtqueue *vu_setup_vq(struct virtio_device *vdev,
|
||||
|
||||
error_setup:
|
||||
if (info->call_fd >= 0) {
|
||||
um_free_irq(VIRTIO_IRQ, vq);
|
||||
um_free_irq(vu_dev->irq, vq);
|
||||
os_close_file(info->call_fd);
|
||||
}
|
||||
error_call:
|
||||
@ -1078,7 +1084,7 @@ static void virtio_uml_release_dev(struct device *d)
|
||||
|
||||
/* might not have been opened due to not negotiating the feature */
|
||||
if (vu_dev->req_fd >= 0) {
|
||||
um_free_irq(VIRTIO_IRQ, vu_dev);
|
||||
um_free_irq(vu_dev->irq, vu_dev);
|
||||
os_close_file(vu_dev->req_fd);
|
||||
}
|
||||
|
||||
|
@ -17,18 +17,17 @@
|
||||
#define TELNETD_IRQ 12
|
||||
#define XTERM_IRQ 13
|
||||
#define RANDOM_IRQ 14
|
||||
#define VIRTIO_IRQ 15
|
||||
|
||||
#ifdef CONFIG_UML_NET_VECTOR
|
||||
|
||||
#define VECTOR_BASE_IRQ (VIRTIO_IRQ + 1)
|
||||
#define VECTOR_BASE_IRQ (RANDOM_IRQ + 1)
|
||||
#define VECTOR_IRQ_SPACE 8
|
||||
|
||||
#define UM_FIRST_DYN_IRQ (VECTOR_IRQ_SPACE + VECTOR_BASE_IRQ)
|
||||
|
||||
#else
|
||||
|
||||
#define UM_FIRST_DYN_IRQ (VIRTIO_IRQ + 1)
|
||||
#define UM_FIRST_DYN_IRQ (RANDOM_IRQ + 1)
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user