Skip to content

Commit e7991f3

Browse files
Zhu Lingshanmstsirkin
authored andcommitted
ifcvf: implement config interrupt in IFCVF
This commit implements config interrupt support in IFC VF Signed-off-by: Zhu Lingshan <[email protected]> Acked-by: Jason Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent e0136c1 commit e7991f3

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

drivers/vdpa/ifcvf/ifcvf_base.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ void ifcvf_set_status(struct ifcvf_hw *hw, u8 status)
185185

186186
void ifcvf_reset(struct ifcvf_hw *hw)
187187
{
188+
hw->config_cb.callback = NULL;
189+
hw->config_cb.private = NULL;
190+
188191
ifcvf_set_status(hw, 0);
189192
/* flush set_status, make sure VF is stopped, reset */
190193
ifcvf_get_status(hw);

drivers/vdpa/ifcvf/ifcvf_base.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
((1ULL << VIRTIO_NET_F_MAC) | \
2828
(1ULL << VIRTIO_F_ANY_LAYOUT) | \
2929
(1ULL << VIRTIO_F_VERSION_1) | \
30+
(1ULL << VIRTIO_NET_F_STATUS) | \
3031
(1ULL << VIRTIO_F_ORDER_PLATFORM) | \
3132
(1ULL << VIRTIO_F_IOMMU_PLATFORM) | \
3233
(1ULL << VIRTIO_NET_F_MRG_RXBUF))
@@ -81,6 +82,9 @@ struct ifcvf_hw {
8182
void __iomem *net_cfg;
8283
struct vring_info vring[IFCVF_MAX_QUEUE_PAIRS * 2];
8384
void __iomem * const *base;
85+
char config_msix_name[256];
86+
struct vdpa_callback config_cb;
87+
8488
};
8589

8690
struct ifcvf_adapter {

drivers/vdpa/ifcvf/ifcvf_main.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818
#define DRIVER_AUTHOR "Intel Corporation"
1919
#define IFCVF_DRIVER_NAME "ifcvf"
2020

21+
static irqreturn_t ifcvf_config_changed(int irq, void *arg)
22+
{
23+
struct ifcvf_hw *vf = arg;
24+
25+
if (vf->config_cb.callback)
26+
return vf->config_cb.callback(vf->config_cb.private);
27+
28+
return IRQ_HANDLED;
29+
}
30+
2131
static irqreturn_t ifcvf_intr_handler(int irq, void *arg)
2232
{
2333
struct vring_info *vring = arg;
@@ -59,6 +69,14 @@ static int ifcvf_request_irq(struct ifcvf_adapter *adapter)
5969
return ret;
6070
}
6171

72+
snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n",
73+
pci_name(pdev));
74+
vector = 0;
75+
irq = pci_irq_vector(pdev, vector);
76+
ret = devm_request_irq(&pdev->dev, irq,
77+
ifcvf_config_changed, 0,
78+
vf->config_msix_name, vf);
79+
6280
for (i = 0; i < IFCVF_MAX_QUEUE_PAIRS * 2; i++) {
6381
snprintf(vf->vring[i].msix_name, 256, "ifcvf[%s]-%d\n",
6482
pci_name(pdev), i);
@@ -328,7 +346,10 @@ static void ifcvf_vdpa_set_config(struct vdpa_device *vdpa_dev,
328346
static void ifcvf_vdpa_set_config_cb(struct vdpa_device *vdpa_dev,
329347
struct vdpa_callback *cb)
330348
{
331-
/* We don't support config interrupt */
349+
struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
350+
351+
vf->config_cb.callback = cb->callback;
352+
vf->config_cb.private = cb->private;
332353
}
333354

334355
/*

0 commit comments

Comments
 (0)