Jason Wang
2020-Jul-23 04:19 UTC
[PATCH V3 3/6] vDPA: implement vq IRQ allocate/free helpers in vDPA core
On 2020/7/22 ??6:08, Zhu Lingshan wrote:> +/* > + * Request irq for a vq, setup irq offloading if its a vhost_vdpa vq. > + * This function should be only called through setting virtio DRIVER_OK. > + * If you want to request irq during probe, you should use raw APIs > + * like request_irq() or devm_request_irq().This makes the API less flexibile. The reason is we store the irq in vhost-vdpa not vDPA. I wonder whether the following looks better: 1) store irq in vdpa device 2) register producer when DRIVER_OK and unregister producer when !DRIVER_OK in vhost-vDPA 3) deal with the synchronization with SET_VRING_CALL 4) document that irq is not expected to be changed during DRIVER_OK This can make sure the API works during driver probe, and we don't need the setup_irq and unsetup_irq method in vdpa_driver Thanks> + */ > +int vdpa_devm_request_irq(struct device *dev, struct vdpa_device *vdev, > + unsigned int irq, irq_handler_t handler, > + unsigned long irqflags, const char *devname, void *dev_id, > + int qid) > +{ > + int ret; > + > + ret = devm_request_irq(dev, irq, handler, irqflags, devname, dev_id); > + if (ret) > + dev_err(dev, "Failed to request irq for vq %d\n", qid); > + else > + vdpa_setup_irq(vdev, qid, irq); > + > + return ret; > + > +} > +EXPORT_SYMBOL_GPL(vdpa_devm_request_irq);
Reasonably Related Threads
- [PATCH 4/7] vDPA: implement IRQ offloading helpers in vDPA core
- [PATCH V2 3/6] vDPA: implement IRQ offloading helpers in vDPA core
- [PATCH 2/3] Make IRQ handlers typesafe.
- [PATCH 2/3] Make IRQ handlers typesafe.
- [PATCH V2 3/6] vDPA: implement IRQ offloading helpers in vDPA core