Lines Matching +full:msi +full:- +full:x

1 // SPDX-License-Identifier: GPL-2.0-only
36 MODULE_PARM_DESC(disable_msi, "Disable MSI use in driver - (default=0)");
40 MODULE_PARM_DESC(disable_msix, "Disable MSI-X use in driver - (default=0)");
117 iowrite8_rep(vmci_dev_g->iobase + VMCI_DATA_OUT_ADDR, in vmci_send_datagram()
119 result = ioread32(vmci_dev_g->iobase + VMCI_RESULT_LOW_ADDR); in vmci_send_datagram()
142 pr_devel("Invalid subscriber (ID=0x%x)\n", sub_id); in vmci_guest_cid_update()
146 if (!event_data || ev_payload->context_id == VMCI_INVALID_ID) { in vmci_guest_cid_update()
151 pr_devel("Updating context from (ID=0x%x) to (ID=0x%x) on event (type=%d)\n", in vmci_guest_cid_update()
152 vm_context_id, ev_payload->context_id, event_data->event); in vmci_guest_cid_update()
154 vm_context_id = ev_payload->context_id; in vmci_guest_cid_update()
173 dev_err(&pdev->dev, "%s: Insufficient memory\n", __func__); in vmci_check_host_caps()
174 return -ENOMEM; in vmci_check_host_caps()
177 check_msg->dst = vmci_make_handle(VMCI_HYPERVISOR_CONTEXT_ID, in vmci_check_host_caps()
179 check_msg->src = VMCI_ANON_SRC_HANDLE; in vmci_check_host_caps()
180 check_msg->payload_size = msg_size - VMCI_DG_HEADERSIZE; in vmci_check_host_caps()
183 msg->num_resources = VMCI_UTIL_NUM_RESOURCES; in vmci_check_host_caps()
184 msg->resources[0] = VMCI_GET_CONTEXT_ID; in vmci_check_host_caps()
190 dev_dbg(&pdev->dev, "%s: Host capability check: %s\n", in vmci_check_host_caps()
194 return result ? 0 : -ENXIO; in vmci_check_host_caps()
211 u8 *dg_in_buffer = vmci_dev->data_buffer; in vmci_dispatch_dgs()
219 ioread8_rep(vmci_dev->iobase + VMCI_DATA_IN_ADDR, in vmci_dispatch_dgs()
220 vmci_dev->data_buffer, current_dg_in_buffer_size); in vmci_dispatch_dgs()
224 while (dg->dst.resource != VMCI_INVALID_ID || in vmci_dispatch_dgs()
232 if (dg->dst.resource == VMCI_INVALID_ID) { in vmci_dispatch_dgs()
237 current_dg_in_buffer_size - in vmci_dispatch_dgs()
268 current_dg_in_buffer_size - in vmci_dispatch_dgs()
280 ioread8_rep(vmci_dev->iobase + in vmci_dispatch_dgs()
282 vmci_dev->data_buffer + in vmci_dispatch_dgs()
284 current_dg_in_buffer_size - in vmci_dispatch_dgs()
292 if (dg->src.context == VMCI_HYPERVISOR_CONTEXT_ID && in vmci_dispatch_dgs()
293 dg->dst.resource == VMCI_EVENT_HANDLER) { in vmci_dispatch_dgs()
299 dev_dbg(vmci_dev->dev, in vmci_dispatch_dgs()
300 "Datagram with resource (ID=0x%x) failed (err=%d)\n", in vmci_dispatch_dgs()
301 dg->dst.resource, result); in vmci_dispatch_dgs()
313 dev_dbg(vmci_dev->dev, in vmci_dispatch_dgs()
317 bytes_to_skip = dg_in_size - remaining_bytes; in vmci_dispatch_dgs()
322 ioread8_rep(vmci_dev->iobase + in vmci_dispatch_dgs()
324 vmci_dev->data_buffer, in vmci_dispatch_dgs()
329 bytes_to_skip -= current_dg_in_buffer_size; in vmci_dispatch_dgs()
336 (size_t) (dg_in_buffer + current_dg_in_buffer_size - in vmci_dispatch_dgs()
342 ioread8_rep(vmci_dev->iobase + VMCI_DATA_IN_ADDR, in vmci_dispatch_dgs()
343 vmci_dev->data_buffer, in vmci_dispatch_dgs()
359 if (!dev->notification_bitmap) { in vmci_process_bitmap()
360 dev_dbg(dev->dev, "No bitmap present in %s\n", __func__); in vmci_process_bitmap()
364 vmci_dbell_scan_notification_entries(dev->notification_bitmap); in vmci_process_bitmap()
368 * Interrupt handler for legacy or MSI interrupt, or for first MSI-X
376 * If we are using MSI-X with exclusive vectors then we simply schedule in vmci_interrupt()
381 if (dev->exclusive_vectors) { in vmci_interrupt()
382 tasklet_schedule(&dev->datagram_tasklet); in vmci_interrupt()
387 icr = ioread32(dev->iobase + VMCI_ICR_ADDR); in vmci_interrupt()
392 tasklet_schedule(&dev->datagram_tasklet); in vmci_interrupt()
397 tasklet_schedule(&dev->bm_tasklet); in vmci_interrupt()
402 dev_warn(dev->dev, in vmci_interrupt()
411 * Interrupt handler for MSI-X interrupt vector VMCI_INTR_NOTIFICATION,
413 * using MSI-X with exclusive vectors.
419 /* For MSI-X we can just assume it was meant for us. */ in vmci_interrupt_bm()
420 tasklet_schedule(&dev->bm_tasklet); in vmci_interrupt_bm()
439 dev_dbg(&pdev->dev, "Probing for vmci/PCI guest device\n"); in vmci_guest_probe_device()
443 dev_err(&pdev->dev, in vmci_guest_probe_device()
450 dev_err(&pdev->dev, "Failed to reserve/map IO regions\n"); in vmci_guest_probe_device()
456 dev_info(&pdev->dev, "Found VMCI PCI device at %#lx, irq %u\n", in vmci_guest_probe_device()
457 (unsigned long)iobase, pdev->irq); in vmci_guest_probe_device()
459 vmci_dev = devm_kzalloc(&pdev->dev, sizeof(*vmci_dev), GFP_KERNEL); in vmci_guest_probe_device()
461 dev_err(&pdev->dev, in vmci_guest_probe_device()
463 return -ENOMEM; in vmci_guest_probe_device()
466 vmci_dev->dev = &pdev->dev; in vmci_guest_probe_device()
467 vmci_dev->exclusive_vectors = false; in vmci_guest_probe_device()
468 vmci_dev->iobase = iobase; in vmci_guest_probe_device()
470 tasklet_init(&vmci_dev->datagram_tasklet, in vmci_guest_probe_device()
472 tasklet_init(&vmci_dev->bm_tasklet, in vmci_guest_probe_device()
475 vmci_dev->data_buffer = vmalloc(VMCI_MAX_DG_SIZE); in vmci_guest_probe_device()
476 if (!vmci_dev->data_buffer) { in vmci_guest_probe_device()
477 dev_err(&pdev->dev, in vmci_guest_probe_device()
479 return -ENOMEM; in vmci_guest_probe_device()
493 capabilities = ioread32(vmci_dev->iobase + VMCI_CAPS_ADDR); in vmci_guest_probe_device()
495 dev_err(&pdev->dev, "Device does not support datagrams\n"); in vmci_guest_probe_device()
496 error = -ENXIO; in vmci_guest_probe_device()
502 * Use 64-bit PPNs if the device supports. in vmci_guest_probe_device()
509 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); in vmci_guest_probe_device()
513 dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44)); in vmci_guest_probe_device()
522 vmci_dev->notification_bitmap = dma_alloc_coherent( in vmci_guest_probe_device()
523 &pdev->dev, PAGE_SIZE, &vmci_dev->notification_base, in vmci_guest_probe_device()
525 if (!vmci_dev->notification_bitmap) { in vmci_guest_probe_device()
526 dev_warn(&pdev->dev, in vmci_guest_probe_device()
529 memset(vmci_dev->notification_bitmap, 0, PAGE_SIZE); in vmci_guest_probe_device()
534 dev_info(&pdev->dev, "Using capabilities 0x%x\n", caps_in_use); in vmci_guest_probe_device()
537 iowrite32(caps_in_use, vmci_dev->iobase + VMCI_CAPS_ADDR); in vmci_guest_probe_device()
551 vmci_dev->notification_base >> PAGE_SHIFT; in vmci_guest_probe_device()
553 dev_warn(&pdev->dev, in vmci_guest_probe_device()
554 "VMCI device unable to register notification bitmap with PPN 0x%lx\n", in vmci_guest_probe_device()
556 error = -ENXIO; in vmci_guest_probe_device()
576 dev_warn(&pdev->dev, in vmci_guest_probe_device()
581 * Enable interrupts. Try MSI-X first, then MSI, and then fallback on in vmci_guest_probe_device()
592 vmci_dev->exclusive_vectors = true; in vmci_guest_probe_device()
596 * Request IRQ for legacy or MSI interrupts, or for first in vmci_guest_probe_device()
597 * MSI-X vector. in vmci_guest_probe_device()
602 dev_err(&pdev->dev, "Irq %u in use: %d\n", in vmci_guest_probe_device()
608 * For MSI-X with exclusive vectors we need to request an in vmci_guest_probe_device()
613 if (vmci_dev->exclusive_vectors) { in vmci_guest_probe_device()
618 dev_err(&pdev->dev, in vmci_guest_probe_device()
625 dev_dbg(&pdev->dev, "Registered device\n"); in vmci_guest_probe_device()
633 iowrite32(cmd, vmci_dev->iobase + VMCI_IMR_ADDR); in vmci_guest_probe_device()
637 vmci_dev->iobase + VMCI_CONTROL_ADDR); in vmci_guest_probe_device()
646 tasklet_kill(&vmci_dev->datagram_tasklet); in vmci_guest_probe_device()
647 tasklet_kill(&vmci_dev->bm_tasklet); in vmci_guest_probe_device()
654 dev_warn(&pdev->dev, in vmci_guest_probe_device()
655 "Failed to unsubscribe from event (type=%d) with subscriber (ID=0x%x): %d\n", in vmci_guest_probe_device()
659 if (vmci_dev->notification_bitmap) { in vmci_guest_probe_device()
661 vmci_dev->iobase + VMCI_CONTROL_ADDR); in vmci_guest_probe_device()
662 dma_free_coherent(&pdev->dev, PAGE_SIZE, in vmci_guest_probe_device()
663 vmci_dev->notification_bitmap, in vmci_guest_probe_device()
664 vmci_dev->notification_base); in vmci_guest_probe_device()
674 vfree(vmci_dev->data_buffer); in vmci_guest_probe_device()
685 dev_dbg(&pdev->dev, "Removing device\n"); in vmci_guest_remove_device()
693 dev_warn(&pdev->dev, in vmci_guest_remove_device()
694 "Failed to unsubscribe from event (type=%d) with subscriber (ID=0x%x): %d\n", in vmci_guest_remove_device()
702 dev_dbg(&pdev->dev, "Resetting vmci device\n"); in vmci_guest_remove_device()
703 iowrite32(VMCI_CONTROL_RESET, vmci_dev->iobase + VMCI_CONTROL_ADDR); in vmci_guest_remove_device()
706 * Free IRQ and then disable MSI/MSI-X as appropriate. For in vmci_guest_remove_device()
707 * MSI-X, we might have multiple vectors, each with their own in vmci_guest_remove_device()
710 if (vmci_dev->exclusive_vectors) in vmci_guest_remove_device()
715 tasklet_kill(&vmci_dev->datagram_tasklet); in vmci_guest_remove_device()
716 tasklet_kill(&vmci_dev->bm_tasklet); in vmci_guest_remove_device()
718 if (vmci_dev->notification_bitmap) { in vmci_guest_remove_device()
724 dma_free_coherent(&pdev->dev, PAGE_SIZE, in vmci_guest_remove_device()
725 vmci_dev->notification_bitmap, in vmci_guest_remove_device()
726 vmci_dev->notification_base); in vmci_guest_remove_device()
729 vfree(vmci_dev->data_buffer); in vmci_guest_remove_device()