Lines Matching full:irq
33 * passed to amdgpu IRQ handler which is responsible for detecting source and
41 * For GPU interrupt sources that may be driven by another driver, IRQ domain
45 #include <linux/irq.h>
109 * The work gets scheduled from the IRQ handler if there
115 * from the IRQ handler to a work handler because hotplug handler has to use
116 * mutexes which cannot be locked in an IRQ handler (since &mutex_lock may
151 spin_lock_irqsave(&adev->irq.lock, irqflags); in amdgpu_irq_disable_all()
153 if (!adev->irq.client[i].sources) in amdgpu_irq_disable_all()
157 struct amdgpu_irq_src *src = adev->irq.client[i].sources[j]; in amdgpu_irq_disable_all()
172 spin_unlock_irqrestore(&adev->irq.lock, irqflags); in amdgpu_irq_disable_all()
176 * amdgpu_irq_handler - IRQ handler
178 * @irq: IRQ number (unused)
181 * IRQ handler for amdgpu driver (all ASICs).
184 * result of handling the IRQ, as defined by &irqreturn_t
186 static irqreturn_t amdgpu_irq_handler(int irq, void *arg) in amdgpu_irq_handler() argument
192 ret = amdgpu_ih_process(adev, &adev->irq.ih); in amdgpu_irq_handler()
211 irq.ih1_work); in amdgpu_irq_handle_ih1()
213 amdgpu_ih_process(adev, &adev->irq.ih1); in amdgpu_irq_handle_ih1()
226 irq.ih2_work); in amdgpu_irq_handle_ih2()
228 amdgpu_ih_process(adev, &adev->irq.ih2); in amdgpu_irq_handle_ih2()
241 irq.ih_soft_work); in amdgpu_irq_handle_ih_soft()
243 amdgpu_ih_process(adev, &adev->irq.ih_soft); in amdgpu_irq_handle_ih_soft()
296 unsigned int irq; in amdgpu_irq_init() local
298 spin_lock_init(&adev->irq.lock); in amdgpu_irq_init()
301 adev->irq.msi_enabled = false; in amdgpu_irq_init()
315 adev->irq.msi_enabled = true; in amdgpu_irq_init()
335 INIT_WORK(&adev->irq.ih1_work, amdgpu_irq_handle_ih1); in amdgpu_irq_init()
336 INIT_WORK(&adev->irq.ih2_work, amdgpu_irq_handle_ih2); in amdgpu_irq_init()
337 INIT_WORK(&adev->irq.ih_soft_work, amdgpu_irq_handle_ih_soft); in amdgpu_irq_init()
343 irq = r; in amdgpu_irq_init()
346 r = request_irq(irq, amdgpu_irq_handler, IRQF_SHARED, adev_to_drm(adev)->driver->name, in amdgpu_irq_init()
353 adev->irq.installed = true; in amdgpu_irq_init()
354 adev->irq.irq = irq; in amdgpu_irq_init()
357 DRM_DEBUG("amdgpu: irq initialized.\n"); in amdgpu_irq_init()
364 if (adev->irq.installed) { in amdgpu_irq_fini_hw()
365 free_irq(adev->irq.irq, adev_to_drm(adev)); in amdgpu_irq_fini_hw()
366 adev->irq.installed = false; in amdgpu_irq_fini_hw()
367 if (adev->irq.msi_enabled) in amdgpu_irq_fini_hw()
374 amdgpu_ih_ring_fini(adev, &adev->irq.ih_soft); in amdgpu_irq_fini_hw()
375 amdgpu_ih_ring_fini(adev, &adev->irq.ih); in amdgpu_irq_fini_hw()
376 amdgpu_ih_ring_fini(adev, &adev->irq.ih1); in amdgpu_irq_fini_hw()
377 amdgpu_ih_ring_fini(adev, &adev->irq.ih2); in amdgpu_irq_fini_hw()
394 if (!adev->irq.client[i].sources) in amdgpu_irq_fini_sw()
398 struct amdgpu_irq_src *src = adev->irq.client[i].sources[j]; in amdgpu_irq_fini_sw()
406 kfree(adev->irq.client[i].sources); in amdgpu_irq_fini_sw()
407 adev->irq.client[i].sources = NULL; in amdgpu_irq_fini_sw()
412 * amdgpu_irq_add_id - register IRQ source
417 * @source: IRQ source pointer
419 * Registers IRQ source on a client.
437 if (!adev->irq.client[client_id].sources) { in amdgpu_irq_add_id()
438 adev->irq.client[client_id].sources = in amdgpu_irq_add_id()
442 if (!adev->irq.client[client_id].sources) in amdgpu_irq_add_id()
446 if (adev->irq.client[client_id].sources[src_id] != NULL) in amdgpu_irq_add_id()
460 adev->irq.client[client_id].sources[src_id] = source; in amdgpu_irq_add_id()
465 * amdgpu_irq_dispatch - dispatch IRQ to IP blocks
470 * Dispatches IRQ to IP blocks.
486 trace_amdgpu_iv(ih - &adev->irq.ih, &entry); in amdgpu_irq_dispatch()
498 adev->irq.virq[src_id]) { in amdgpu_irq_dispatch()
499 generic_handle_domain_irq(adev->irq.domain, src_id); in amdgpu_irq_dispatch()
501 } else if (!adev->irq.client[client_id].sources) { in amdgpu_irq_dispatch()
505 } else if ((src = adev->irq.client[client_id].sources[src_id])) { in amdgpu_irq_dispatch()
538 amdgpu_ih_ring_write(&adev->irq.ih_soft, entry->iv_entry, num_dw); in amdgpu_irq_delegate()
539 schedule_work(&adev->irq.ih_soft_work); in amdgpu_irq_delegate()
558 spin_lock_irqsave(&adev->irq.lock, irqflags); in amdgpu_irq_update()
568 spin_unlock_irqrestore(&adev->irq.lock, irqflags); in amdgpu_irq_update()
588 if (!adev->irq.client[i].sources) in amdgpu_irq_gpu_reset_resume_helper()
592 struct amdgpu_irq_src *src = adev->irq.client[i].sources[j]; in amdgpu_irq_gpu_reset_resume_helper()
617 if (!adev->irq.installed) in amdgpu_irq_get()
647 if (!adev->irq.installed) in amdgpu_irq_put()
678 if (!adev->irq.installed) in amdgpu_irq_enabled()
690 /* XXX: Generic IRQ handling */
709 * amdgpu_irqdomain_map - create mapping between virtual and hardware IRQ numbers
711 * @d: amdgpu IRQ domain pointer (unused)
712 * @irq: virtual IRQ number
713 * @hwirq: hardware irq number
716 * IRQ.
722 unsigned int irq, irq_hw_number_t hwirq) in amdgpu_irqdomain_map() argument
727 irq_set_chip_and_handler(irq, in amdgpu_irqdomain_map()
732 /* Implementation of methods for amdgpu IRQ domain */
738 * amdgpu_irq_add_domain - create a linear IRQ domain
742 * Creates an IRQ domain for GPU interrupt sources
750 adev->irq.domain = irq_domain_add_linear(NULL, AMDGPU_MAX_IRQ_SRC_ID, in amdgpu_irq_add_domain()
752 if (!adev->irq.domain) { in amdgpu_irq_add_domain()
753 DRM_ERROR("GPU irq add domain failed\n"); in amdgpu_irq_add_domain()
761 * amdgpu_irq_remove_domain - remove the IRQ domain
765 * Removes the IRQ domain for GPU interrupt sources
770 if (adev->irq.domain) { in amdgpu_irq_remove_domain()
771 irq_domain_remove(adev->irq.domain); in amdgpu_irq_remove_domain()
772 adev->irq.domain = NULL; in amdgpu_irq_remove_domain()
782 * Creates mapping between a domain IRQ (GPU IH src id) and a Linux IRQ
787 * Linux IRQ
791 adev->irq.virq[src_id] = irq_create_mapping(adev->irq.domain, src_id); in amdgpu_irq_create_mapping()
793 return adev->irq.virq[src_id]; in amdgpu_irq_create_mapping()