Lines Matching refs:virtvdev

33 virtiovf_issue_legacy_rw_cmd(struct virtiovf_pci_core_device *virtvdev,  in virtiovf_issue_legacy_rw_cmd()  argument
38 (virtvdev->core_device.irq_type == VFIO_PCI_MSIX_IRQ_INDEX); in virtiovf_issue_legacy_rw_cmd()
39 struct pci_dev *pdev = virtvdev->core_device.pdev; in virtiovf_issue_legacy_rw_cmd()
40 u8 *bar0_buf = virtvdev->bar0_virtual_buf; in virtiovf_issue_legacy_rw_cmd()
48 mutex_lock(&virtvdev->bar_mutex); in virtiovf_issue_legacy_rw_cmd()
74 mutex_unlock(&virtvdev->bar_mutex); in virtiovf_issue_legacy_rw_cmd()
79 virtiovf_pci_bar0_rw(struct virtiovf_pci_core_device *virtvdev, in virtiovf_pci_bar0_rw() argument
83 struct vfio_pci_core_device *core_device = &virtvdev->core_device; in virtiovf_pci_bar0_rw()
88 if (!(le16_to_cpu(virtvdev->pci_cmd) & PCI_COMMAND_IO)) in virtiovf_pci_bar0_rw()
91 if (pos + count > virtvdev->bar0_virtual_buf_size) in virtiovf_pci_bar0_rw()
108 virtvdev->notify_addr); in virtiovf_pci_bar0_rw()
122 virtvdev->notify_addr); in virtiovf_pci_bar0_rw()
126 ret = virtiovf_issue_legacy_rw_cmd(virtvdev, pos, buf, count, in virtiovf_pci_bar0_rw()
139 struct virtiovf_pci_core_device *virtvdev = container_of( in virtiovf_pci_read_config() local
162 if ((le16_to_cpu(virtvdev->pci_cmd) & PCI_COMMAND_IO) && in virtiovf_pci_read_config()
187 u32 bar_mask = ~(virtvdev->bar0_virtual_buf_size - 1); in virtiovf_pci_read_config()
188 u32 pci_base_addr_0 = le32_to_cpu(virtvdev->pci_base_addr_0); in virtiovf_pci_read_config()
224 struct virtiovf_pci_core_device *virtvdev = container_of( in virtiovf_pci_core_read() local
236 return virtiovf_pci_bar0_rw(virtvdev, pos, buf, count, true); in virtiovf_pci_core_read()
245 struct virtiovf_pci_core_device *virtvdev = container_of( in virtiovf_pci_write_config() local
253 sizeof(virtvdev->pci_cmd), in virtiovf_pci_write_config()
256 if (copy_from_user((void *)&virtvdev->pci_cmd + register_offset, in virtiovf_pci_write_config()
263 sizeof(virtvdev->pci_base_addr_0), in virtiovf_pci_write_config()
266 if (copy_from_user((void *)&virtvdev->pci_base_addr_0 + register_offset, in virtiovf_pci_write_config()
279 struct virtiovf_pci_core_device *virtvdev = container_of( in virtiovf_pci_core_write() local
291 return virtiovf_pci_bar0_rw(virtvdev, pos, (char __user *)buf, count, false); in virtiovf_pci_core_write()
300 struct virtiovf_pci_core_device *virtvdev = container_of( in virtiovf_pci_ioctl_get_region_info() local
315 info.size = virtvdev->bar0_virtual_buf_size; in virtiovf_pci_ioctl_get_region_info()
337 virtiovf_set_notify_addr(struct virtiovf_pci_core_device *virtvdev) in virtiovf_set_notify_addr() argument
339 struct vfio_pci_core_device *core_device = &virtvdev->core_device; in virtiovf_set_notify_addr()
347 virtvdev->notify_bar); in virtiovf_set_notify_addr()
351 virtvdev->notify_addr = core_device->barmap[virtvdev->notify_bar] + in virtiovf_set_notify_addr()
352 virtvdev->notify_offset; in virtiovf_set_notify_addr()
358 struct virtiovf_pci_core_device *virtvdev = container_of( in virtiovf_pci_open_device() local
360 struct vfio_pci_core_device *vdev = &virtvdev->core_device; in virtiovf_pci_open_device()
367 if (virtvdev->bar0_virtual_buf) { in virtiovf_pci_open_device()
373 ret = virtiovf_set_notify_addr(virtvdev); in virtiovf_pci_open_device()
390 static int virtiovf_read_notify_info(struct virtiovf_pci_core_device *virtvdev) in virtiovf_read_notify_info() argument
396 ret = virtio_pci_admin_legacy_io_notify_info(virtvdev->core_device.pdev, in virtiovf_read_notify_info()
402 virtvdev->notify_bar = bar; in virtiovf_read_notify_info()
403 virtvdev->notify_offset = offset; in virtiovf_read_notify_info()
409 struct virtiovf_pci_core_device *virtvdev = container_of( in virtiovf_pci_init_device() local
418 pdev = virtvdev->core_device.pdev; in virtiovf_pci_init_device()
419 ret = virtiovf_read_notify_info(virtvdev); in virtiovf_pci_init_device()
423 virtvdev->bar0_virtual_buf_size = VIRTIO_PCI_CONFIG_OFF(true) + in virtiovf_pci_init_device()
425 BUILD_BUG_ON(!is_power_of_2(virtvdev->bar0_virtual_buf_size)); in virtiovf_pci_init_device()
426 virtvdev->bar0_virtual_buf = kzalloc(virtvdev->bar0_virtual_buf_size, in virtiovf_pci_init_device()
428 if (!virtvdev->bar0_virtual_buf) in virtiovf_pci_init_device()
430 mutex_init(&virtvdev->bar_mutex); in virtiovf_pci_init_device()
436 struct virtiovf_pci_core_device *virtvdev = container_of( in virtiovf_pci_core_release_dev() local
439 kfree(virtvdev->bar0_virtual_buf); in virtiovf_pci_core_release_dev()
492 struct virtiovf_pci_core_device *virtvdev; in virtiovf_pci_probe() local
499 virtvdev = vfio_alloc_device(virtiovf_pci_core_device, core_device.vdev, in virtiovf_pci_probe()
501 if (IS_ERR(virtvdev)) in virtiovf_pci_probe()
502 return PTR_ERR(virtvdev); in virtiovf_pci_probe()
504 dev_set_drvdata(&pdev->dev, &virtvdev->core_device); in virtiovf_pci_probe()
505 ret = vfio_pci_core_register_device(&virtvdev->core_device); in virtiovf_pci_probe()
510 vfio_put_device(&virtvdev->core_device.vdev); in virtiovf_pci_probe()
516 struct virtiovf_pci_core_device *virtvdev = dev_get_drvdata(&pdev->dev); in virtiovf_pci_remove() local
518 vfio_pci_core_unregister_device(&virtvdev->core_device); in virtiovf_pci_remove()
519 vfio_put_device(&virtvdev->core_device.vdev); in virtiovf_pci_remove()
532 struct virtiovf_pci_core_device *virtvdev = dev_get_drvdata(&pdev->dev); in virtiovf_pci_aer_reset_done() local
534 virtvdev->pci_cmd = 0; in virtiovf_pci_aer_reset_done()