Lines Matching refs:vf
22 struct ifcvf_hw *vf = arg;
24 if (vf->config_cb.callback)
25 return vf->config_cb.callback(vf->config_cb.private);
42 struct ifcvf_hw *vf = arg;
46 for (i = 0; i < vf->nr_vring; i++) {
47 vring = &vf->vring[i];
57 struct ifcvf_hw *vf = arg;
60 isr = vp_ioread8(vf->isr);
72 static void ifcvf_free_per_vq_irq(struct ifcvf_hw *vf)
74 struct pci_dev *pdev = vf->pdev;
77 for (i = 0; i < vf->nr_vring; i++) {
78 if (vf->vring[i].irq != -EINVAL) {
79 devm_free_irq(&pdev->dev, vf->vring[i].irq, &vf->vring[i]);
80 vf->vring[i].irq = -EINVAL;
85 static void ifcvf_free_vqs_reused_irq(struct ifcvf_hw *vf)
87 struct pci_dev *pdev = vf->pdev;
89 if (vf->vqs_reused_irq != -EINVAL) {
90 devm_free_irq(&pdev->dev, vf->vqs_reused_irq, vf);
91 vf->vqs_reused_irq = -EINVAL;
96 static void ifcvf_free_vq_irq(struct ifcvf_hw *vf)
98 if (vf->msix_vector_status == MSIX_VECTOR_PER_VQ_AND_CONFIG)
99 ifcvf_free_per_vq_irq(vf);
101 ifcvf_free_vqs_reused_irq(vf);
104 static void ifcvf_free_config_irq(struct ifcvf_hw *vf)
106 struct pci_dev *pdev = vf->pdev;
108 if (vf->config_irq == -EINVAL)
115 if (vf->msix_vector_status != MSIX_VECTOR_DEV_SHARED) {
116 devm_free_irq(&pdev->dev, vf->config_irq, vf);
117 vf->config_irq = -EINVAL;
121 static void ifcvf_free_irq(struct ifcvf_hw *vf)
123 struct pci_dev *pdev = vf->pdev;
125 ifcvf_free_vq_irq(vf);
126 ifcvf_free_config_irq(vf);
128 vf->num_msix_vectors = 0;
136 static int ifcvf_alloc_vectors(struct ifcvf_hw *vf)
138 struct pci_dev *pdev = vf->pdev;
142 max_intr = vf->nr_vring + 1;
158 static int ifcvf_request_per_vq_irq(struct ifcvf_hw *vf)
160 struct pci_dev *pdev = vf->pdev;
163 vf->vqs_reused_irq = -EINVAL;
164 for (i = 0; i < vf->nr_vring; i++) {
165 snprintf(vf->vring[i].msix_name, 256, "ifcvf[%s]-%d\n", pci_name(pdev), i);
170 vf->vring[i].msix_name,
171 &vf->vring[i]);
177 vf->vring[i].irq = irq;
178 ret = ifcvf_set_vq_vector(vf, i, vector);
187 ifcvf_free_irq(vf);
192 static int ifcvf_request_vqs_reused_irq(struct ifcvf_hw *vf)
194 struct pci_dev *pdev = vf->pdev;
198 snprintf(vf->vring[0].msix_name, 256, "ifcvf[%s]-vqs-reused-irq\n", pci_name(pdev));
202 vf->vring[0].msix_name, vf);
208 vf->vqs_reused_irq = irq;
209 for (i = 0; i < vf->nr_vring; i++) {
210 vf->vring[i].irq = -EINVAL;
211 ret = ifcvf_set_vq_vector(vf, i, vector);
220 ifcvf_free_irq(vf);
225 static int ifcvf_request_dev_irq(struct ifcvf_hw *vf)
227 struct pci_dev *pdev = vf->pdev;
231 snprintf(vf->vring[0].msix_name, 256, "ifcvf[%s]-dev-irq\n", pci_name(pdev));
235 vf->vring[0].msix_name, vf);
241 vf->vqs_reused_irq = irq;
242 for (i = 0; i < vf->nr_vring; i++) {
243 vf->vring[i].irq = -EINVAL;
244 ret = ifcvf_set_vq_vector(vf, i, vector);
251 vf->config_irq = irq;
252 ret = ifcvf_set_config_vector(vf, vector);
260 ifcvf_free_irq(vf);
266 static int ifcvf_request_vq_irq(struct ifcvf_hw *vf)
270 if (vf->msix_vector_status == MSIX_VECTOR_PER_VQ_AND_CONFIG)
271 ret = ifcvf_request_per_vq_irq(vf);
273 ret = ifcvf_request_vqs_reused_irq(vf);
278 static int ifcvf_request_config_irq(struct ifcvf_hw *vf)
280 struct pci_dev *pdev = vf->pdev;
283 if (vf->msix_vector_status == MSIX_VECTOR_PER_VQ_AND_CONFIG)
284 config_vector = vf->nr_vring;
285 else if (vf->msix_vector_status == MSIX_VECTOR_SHARED_VQ_AND_CONFIG)
288 else if (vf->msix_vector_status == MSIX_VECTOR_DEV_SHARED)
294 snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n",
296 vf->config_irq = pci_irq_vector(pdev, config_vector);
297 ret = devm_request_irq(&pdev->dev, vf->config_irq,
299 vf->config_msix_name, vf);
305 ret = ifcvf_set_config_vector(vf, config_vector);
313 ifcvf_free_irq(vf);
318 static int ifcvf_request_irq(struct ifcvf_hw *vf)
322 nvectors = ifcvf_alloc_vectors(vf);
326 vf->msix_vector_status = MSIX_VECTOR_PER_VQ_AND_CONFIG;
327 max_intr = vf->nr_vring + 1;
329 vf->msix_vector_status = MSIX_VECTOR_SHARED_VQ_AND_CONFIG;
332 vf->msix_vector_status = MSIX_VECTOR_DEV_SHARED;
333 ret = ifcvf_request_dev_irq(vf);
338 ret = ifcvf_request_vq_irq(vf);
342 ret = ifcvf_request_config_irq(vf);
347 vf->num_msix_vectors = nvectors;
361 return adapter->vf;
367 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
369 u32 type = vf->dev_type;
373 features = ifcvf_get_dev_features(vf);
376 IFCVF_ERR(pdev, "VIRTIO ID %u not supported\n", vf->dev_type);
384 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
387 ret = ifcvf_verify_min_features(vf, features);
391 ifcvf_set_driver_features(vf, features);
398 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
401 features = ifcvf_get_driver_features(vf);
408 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
410 return ifcvf_get_status(vf);
415 struct ifcvf_hw *vf;
419 vf = vdpa_to_vf(vdpa_dev);
420 status_old = ifcvf_get_status(vf);
427 ret = ifcvf_request_irq(vf);
429 IFCVF_ERR(vf->pdev, "failed to request irq with error %d\n", ret);
434 ifcvf_set_status(vf, status);
439 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
440 u8 status = ifcvf_get_status(vf);
442 ifcvf_stop(vf);
445 ifcvf_free_irq(vf);
447 ifcvf_reset(vf);
454 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
456 return ifcvf_get_max_vq_size(vf);
462 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
464 state->split.avail_index = ifcvf_get_vq_state(vf, qid);
471 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
473 return ifcvf_set_vq_state(vf, qid, state->split.avail_index);
479 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
481 vf->vring[qid].cb = *cb;
487 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
489 ifcvf_set_vq_ready(vf, qid, ready);
494 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
496 return ifcvf_get_vq_ready(vf, qid);
502 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
504 ifcvf_set_vq_num(vf, qid, num);
511 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
513 return ifcvf_set_vq_address(vf, qid, desc_area, driver_area, device_area);
518 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
520 ifcvf_notify_queue(vf, qid);
525 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
527 return vp_ioread8(&vf->common_cfg->config_generation);
532 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
534 return vf->dev_type;
552 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
554 return vf->config_size;
566 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
568 ifcvf_read_dev_config(vf, offset, buf, len);
575 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
577 ifcvf_write_dev_config(vf, offset, buf, len);
583 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
585 vf->config_cb.callback = cb->callback;
586 vf->config_cb.private = cb->private;
592 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
594 if (vf->vqs_reused_irq < 0)
595 return vf->vring[qid].irq;
603 struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
606 area.addr = vf->vring[idx].notify_pa;
607 if (!vf->notify_off_multiplier)
610 area.size = vf->notify_off_multiplier;
685 struct ifcvf_hw *vf;
690 vf = &ifcvf_mgmt_dev->vf;
691 pdev = vf->pdev;
703 adapter->vf = vf;
706 device_features = vf->hw_features;
715 vf->dev_features = device_features;
722 ret = _vdpa_register_device(&adapter->vdpa, vf->nr_vring);
750 struct ifcvf_hw *vf;
786 vf = &ifcvf_mgmt_dev->vf;
787 vf->dev_type = get_dev_type(pdev);
788 vf->base = pcim_iomap_table(pdev);
789 vf->pdev = pdev;
791 ret = ifcvf_init_hw(vf, pdev);
797 for (i = 0; i < vf->nr_vring; i++)
798 vf->vring[i].irq = -EINVAL;
800 vf->hw_features = ifcvf_get_hw_features(vf);
801 vf->config_size = ifcvf_get_config_size(vf);
819 ifcvf_mgmt_dev->mdev.max_supported_vqs = vf->nr_vring;
820 ifcvf_mgmt_dev->mdev.supported_features = vf->hw_features;
835 kfree(ifcvf_mgmt_dev->vf.vring);
846 kfree(ifcvf_mgmt_dev->vf.vring);