Lines Matching refs:vmci_dev
117 static void vmci_read_data(struct vmci_guest_device *vmci_dev, in vmci_read_data() argument
120 if (vmci_dev->mmio_base == NULL) in vmci_read_data()
121 ioread8_rep(vmci_dev->iobase + VMCI_DATA_IN_ADDR, in vmci_read_data()
130 struct vmci_data_in_out_header *buffer_header = vmci_dev->data_buffer; in vmci_read_data()
132 size_t buffer_offset = dest - vmci_dev->data_buffer; in vmci_read_data()
137 sg_array[0].addr = vmci_dev->data_buffer_base + buffer_offset; in vmci_read_data()
140 vmci_write_reg(vmci_dev, lower_32_bits(vmci_dev->data_buffer_base), in vmci_read_data()
143 wait_event(vmci_dev->inout_wq, buffer_header->busy == 1); in vmci_read_data()
305 static void vmci_dispatch_dgs(struct vmci_guest_device *vmci_dev) in vmci_dispatch_dgs() argument
307 u8 *dg_in_buffer = vmci_dev->data_buffer; in vmci_dispatch_dgs()
312 bool is_io_port = vmci_dev->mmio_base == NULL; in vmci_dispatch_dgs()
328 vmci_read_data(vmci_dev, dg_in_buffer, current_dg_in_buffer_size); in vmci_dispatch_dgs()
394 vmci_read_data(vmci_dev, in vmci_dispatch_dgs()
412 dev_dbg(vmci_dev->dev, in vmci_dispatch_dgs()
426 dev_dbg(vmci_dev->dev, in vmci_dispatch_dgs()
435 vmci_read_data(vmci_dev, dg_in_buffer, in vmci_dispatch_dgs()
453 vmci_read_data(vmci_dev, dg_in_buffer, in vmci_dispatch_dgs()
553 static void vmci_free_dg_buffers(struct vmci_guest_device *vmci_dev) in vmci_free_dg_buffers() argument
555 if (vmci_dev->mmio_base != NULL) { in vmci_free_dg_buffers()
556 if (vmci_dev->tx_buffer != NULL) in vmci_free_dg_buffers()
557 dma_free_coherent(vmci_dev->dev, in vmci_free_dg_buffers()
559 vmci_dev->tx_buffer, in vmci_free_dg_buffers()
560 vmci_dev->tx_buffer_base); in vmci_free_dg_buffers()
561 if (vmci_dev->data_buffer != NULL) in vmci_free_dg_buffers()
562 dma_free_coherent(vmci_dev->dev, in vmci_free_dg_buffers()
564 vmci_dev->data_buffer, in vmci_free_dg_buffers()
565 vmci_dev->data_buffer_base); in vmci_free_dg_buffers()
567 vfree(vmci_dev->data_buffer); in vmci_free_dg_buffers()
577 struct vmci_guest_device *vmci_dev; in vmci_guest_probe_device() local
624 vmci_dev = devm_kzalloc(&pdev->dev, sizeof(*vmci_dev), GFP_KERNEL); in vmci_guest_probe_device()
625 if (!vmci_dev) { in vmci_guest_probe_device()
632 vmci_dev->dev = &pdev->dev; in vmci_guest_probe_device()
633 vmci_dev->exclusive_vectors = false; in vmci_guest_probe_device()
634 vmci_dev->iobase = iobase; in vmci_guest_probe_device()
635 vmci_dev->mmio_base = mmio_base; in vmci_guest_probe_device()
637 init_waitqueue_head(&vmci_dev->inout_wq); in vmci_guest_probe_device()
640 vmci_dev->tx_buffer = dma_alloc_coherent(&pdev->dev, VMCI_DMA_DG_BUFFER_SIZE, in vmci_guest_probe_device()
641 &vmci_dev->tx_buffer_base, in vmci_guest_probe_device()
643 if (!vmci_dev->tx_buffer) { in vmci_guest_probe_device()
650 vmci_dev->data_buffer = dma_alloc_coherent(&pdev->dev, VMCI_DMA_DG_BUFFER_SIZE, in vmci_guest_probe_device()
651 &vmci_dev->data_buffer_base, in vmci_guest_probe_device()
654 vmci_dev->data_buffer = vmalloc(VMCI_MAX_DG_SIZE); in vmci_guest_probe_device()
656 if (!vmci_dev->data_buffer) { in vmci_guest_probe_device()
674 capabilities = vmci_read_reg(vmci_dev, VMCI_CAPS_ADDR); in vmci_guest_probe_device()
703 vmci_dev->notification_bitmap = dma_alloc_coherent( in vmci_guest_probe_device()
704 &pdev->dev, PAGE_SIZE, &vmci_dev->notification_base, in vmci_guest_probe_device()
706 if (!vmci_dev->notification_bitmap) in vmci_guest_probe_device()
727 vmci_write_reg(vmci_dev, caps_in_use, VMCI_CAPS_ADDR); in vmci_guest_probe_device()
731 vmci_write_reg(vmci_dev, PAGE_SHIFT, VMCI_GUEST_PAGE_SHIFT); in vmci_guest_probe_device()
734 vmci_write_reg(vmci_dev, upper_32_bits(vmci_dev->data_buffer_base), in vmci_guest_probe_device()
736 vmci_write_reg(vmci_dev, upper_32_bits(vmci_dev->tx_buffer_base), in vmci_guest_probe_device()
742 vmci_dev_g = vmci_dev; in vmci_guest_probe_device()
752 vmci_dev->notification_base >> PAGE_SHIFT; in vmci_guest_probe_device()
785 if (vmci_dev->mmio_base != NULL) in vmci_guest_probe_device()
797 vmci_dev->exclusive_vectors = true; in vmci_guest_probe_device()
806 KBUILD_MODNAME, vmci_dev); in vmci_guest_probe_device()
819 if (vmci_dev->exclusive_vectors) { in vmci_guest_probe_device()
822 KBUILD_MODNAME, vmci_dev); in vmci_guest_probe_device()
834 vmci_dev); in vmci_guest_probe_device()
854 vmci_write_reg(vmci_dev, cmd, VMCI_IMR_ADDR); in vmci_guest_probe_device()
857 vmci_write_reg(vmci_dev, VMCI_CONTROL_INT_ENABLE, VMCI_CONTROL_ADDR); in vmci_guest_probe_device()
859 pci_set_drvdata(pdev, vmci_dev); in vmci_guest_probe_device()
865 if (vmci_dev->exclusive_vectors) in vmci_guest_probe_device()
866 free_irq(pci_irq_vector(pdev, 1), vmci_dev); in vmci_guest_probe_device()
869 free_irq(pci_irq_vector(pdev, 0), vmci_dev); in vmci_guest_probe_device()
888 if (vmci_dev->notification_bitmap) { in vmci_guest_probe_device()
889 vmci_write_reg(vmci_dev, VMCI_CONTROL_RESET, VMCI_CONTROL_ADDR); in vmci_guest_probe_device()
891 vmci_dev->notification_bitmap, in vmci_guest_probe_device()
892 vmci_dev->notification_base); in vmci_guest_probe_device()
896 vmci_free_dg_buffers(vmci_dev); in vmci_guest_probe_device()
908 struct vmci_guest_device *vmci_dev = pci_get_drvdata(pdev); in vmci_guest_remove_device() local
929 vmci_write_reg(vmci_dev, VMCI_CONTROL_RESET, VMCI_CONTROL_ADDR); in vmci_guest_remove_device()
936 if (vmci_dev->exclusive_vectors) { in vmci_guest_remove_device()
937 free_irq(pci_irq_vector(pdev, 1), vmci_dev); in vmci_guest_remove_device()
938 if (vmci_dev->mmio_base != NULL) in vmci_guest_remove_device()
939 free_irq(pci_irq_vector(pdev, 2), vmci_dev); in vmci_guest_remove_device()
941 free_irq(pci_irq_vector(pdev, 0), vmci_dev); in vmci_guest_remove_device()
944 if (vmci_dev->notification_bitmap) { in vmci_guest_remove_device()
951 vmci_dev->notification_bitmap, in vmci_guest_remove_device()
952 vmci_dev->notification_base); in vmci_guest_remove_device()
955 vmci_free_dg_buffers(vmci_dev); in vmci_guest_remove_device()
957 if (vmci_dev->mmio_base != NULL) in vmci_guest_remove_device()
958 pci_iounmap(pdev, vmci_dev->mmio_base); in vmci_guest_remove_device()