Skip to content

Commit 3597a2f

Browse files
Zhu Lingshanmstsirkin
authored andcommitted
ifcvf: implement vdpa_config_ops.get_vq_irq()
This commit implemented vdpa_config_ops.get_vq_irq() in ifcvf, and initialized vq irq to -EINVAL. So that ifcvf can report irq number of a vq, or -EINVAL if the vq is not assigned an irq number. Signed-off-by: Zhu Lingshan <[email protected]> Suggested-by: Jason Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 2cf1ba9 commit 3597a2f

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

drivers/vdpa/ifcvf/ifcvf_main.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ static void ifcvf_free_irq(struct ifcvf_adapter *adapter, int queues)
5050
int i;
5151

5252

53-
for (i = 0; i < queues; i++)
53+
for (i = 0; i < queues; i++) {
5454
devm_free_irq(&pdev->dev, vf->vring[i].irq, &vf->vring[i]);
55+
vf->vring[i].irq = -EINVAL;
56+
}
5557

5658
ifcvf_free_irq_vectors(pdev);
5759
}
@@ -352,6 +354,14 @@ static void ifcvf_vdpa_set_config_cb(struct vdpa_device *vdpa_dev,
352354
vf->config_cb.private = cb->private;
353355
}
354356

357+
static int ifcvf_vdpa_get_vq_irq(struct vdpa_device *vdpa_dev,
358+
u16 qid)
359+
{
360+
struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
361+
362+
return vf->vring[qid].irq;
363+
}
364+
355365
/*
356366
* IFCVF currently does't have on-chip IOMMU, so not
357367
* implemented set_map()/dma_map()/dma_unmap()
@@ -369,6 +379,7 @@ static const struct vdpa_config_ops ifc_vdpa_ops = {
369379
.get_vq_ready = ifcvf_vdpa_get_vq_ready,
370380
.set_vq_num = ifcvf_vdpa_set_vq_num,
371381
.set_vq_address = ifcvf_vdpa_set_vq_address,
382+
.get_vq_irq = ifcvf_vdpa_get_vq_irq,
372383
.kick_vq = ifcvf_vdpa_kick_vq,
373384
.get_generation = ifcvf_vdpa_get_generation,
374385
.get_device_id = ifcvf_vdpa_get_device_id,
@@ -384,7 +395,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
384395
struct device *dev = &pdev->dev;
385396
struct ifcvf_adapter *adapter;
386397
struct ifcvf_hw *vf;
387-
int ret;
398+
int ret, i;
388399

389400
ret = pcim_enable_device(pdev);
390401
if (ret) {
@@ -441,6 +452,9 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
441452
goto err;
442453
}
443454

455+
for (i = 0; i < IFCVF_MAX_QUEUE_PAIRS * 2; i++)
456+
vf->vring[i].irq = -EINVAL;
457+
444458
ret = vdpa_register_device(&adapter->vdpa);
445459
if (ret) {
446460
IFCVF_ERR(pdev, "Failed to register ifcvf to vdpa bus");

0 commit comments

Comments
 (0)