Lines Matching +full:host +full:- +full:id
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (c) 2010-2021, NVIDIA Corporation.
19 list_for_each_entry_reverse(fence_in_list, &list->list, list) { in host1x_intr_add_fence_to_list()
20 if ((s32)(fence_in_list->threshold - fence->threshold) <= 0) { in host1x_intr_add_fence_to_list()
22 list_add(&fence->list, &fence_in_list->list); in host1x_intr_add_fence_to_list()
28 list_add(&fence->list, &list->list); in host1x_intr_add_fence_to_list()
31 static void host1x_intr_update_hw_state(struct host1x *host, struct host1x_syncpt *sp) in host1x_intr_update_hw_state() argument
35 if (!list_empty(&sp->fences.list)) { in host1x_intr_update_hw_state()
36 fence = list_first_entry(&sp->fences.list, struct host1x_syncpt_fence, list); in host1x_intr_update_hw_state()
38 host1x_hw_intr_set_syncpt_threshold(host, sp->id, fence->threshold); in host1x_intr_update_hw_state()
39 host1x_hw_intr_enable_syncpt_intr(host, sp->id); in host1x_intr_update_hw_state()
41 host1x_hw_intr_disable_syncpt_intr(host, sp->id); in host1x_intr_update_hw_state()
45 void host1x_intr_add_fence_locked(struct host1x *host, struct host1x_syncpt_fence *fence) in host1x_intr_add_fence_locked() argument
47 struct host1x_fence_list *fence_list = &fence->sp->fences; in host1x_intr_add_fence_locked()
49 INIT_LIST_HEAD(&fence->list); in host1x_intr_add_fence_locked()
52 host1x_intr_update_hw_state(host, fence->sp); in host1x_intr_add_fence_locked()
55 bool host1x_intr_remove_fence(struct host1x *host, struct host1x_syncpt_fence *fence) in host1x_intr_remove_fence() argument
57 struct host1x_fence_list *fence_list = &fence->sp->fences; in host1x_intr_remove_fence()
60 spin_lock_irqsave(&fence_list->lock, irqflags); in host1x_intr_remove_fence()
62 if (list_empty(&fence->list)) { in host1x_intr_remove_fence()
63 spin_unlock_irqrestore(&fence_list->lock, irqflags); in host1x_intr_remove_fence()
67 list_del_init(&fence->list); in host1x_intr_remove_fence()
68 host1x_intr_update_hw_state(host, fence->sp); in host1x_intr_remove_fence()
70 spin_unlock_irqrestore(&fence_list->lock, irqflags); in host1x_intr_remove_fence()
75 void host1x_intr_handle_interrupt(struct host1x *host, unsigned int id) in host1x_intr_handle_interrupt() argument
77 struct host1x_syncpt *sp = &host->syncpt[id]; in host1x_intr_handle_interrupt()
83 spin_lock(&sp->fences.lock); in host1x_intr_handle_interrupt()
85 list_for_each_entry_safe(fence, tmp, &sp->fences.list, list) { in host1x_intr_handle_interrupt()
86 if (((value - fence->threshold) & 0x80000000U) != 0U) { in host1x_intr_handle_interrupt()
91 list_del_init(&fence->list); in host1x_intr_handle_interrupt()
95 /* Re-enable interrupt if necessary */ in host1x_intr_handle_interrupt()
96 host1x_intr_update_hw_state(host, sp); in host1x_intr_handle_interrupt()
98 spin_unlock(&sp->fences.lock); in host1x_intr_handle_interrupt()
101 int host1x_intr_init(struct host1x *host) in host1x_intr_init() argument
104 unsigned int id; in host1x_intr_init() local
107 mutex_init(&host->intr_mutex); in host1x_intr_init()
109 for (id = 0; id < host1x_syncpt_nb_pts(host); ++id) { in host1x_intr_init()
110 struct host1x_syncpt *syncpt = &host->syncpt[id]; in host1x_intr_init()
112 spin_lock_init(&syncpt->fences.lock); in host1x_intr_init()
113 INIT_LIST_HEAD(&syncpt->fences.list); in host1x_intr_init()
116 irq_data = devm_kcalloc(host->dev, host->num_syncpt_irqs, sizeof(irq_data[0]), GFP_KERNEL); in host1x_intr_init()
118 return -ENOMEM; in host1x_intr_init()
120 host1x_hw_intr_disable_all_syncpt_intrs(host); in host1x_intr_init()
122 for (i = 0; i < host->num_syncpt_irqs; i++) { in host1x_intr_init()
123 irq_data[i].host = host; in host1x_intr_init()
126 err = devm_request_irq(host->dev, host->syncpt_irqs[i], in host1x_intr_init()
127 host->intr_op->isr, IRQF_SHARED, in host1x_intr_init()
136 void host1x_intr_deinit(struct host1x *host) in host1x_intr_deinit() argument
140 void host1x_intr_start(struct host1x *host) in host1x_intr_start() argument
142 u32 hz = clk_get_rate(host->clk); in host1x_intr_start()
145 mutex_lock(&host->intr_mutex); in host1x_intr_start()
146 err = host1x_hw_intr_init_host_sync(host, DIV_ROUND_UP(hz, 1000000)); in host1x_intr_start()
148 mutex_unlock(&host->intr_mutex); in host1x_intr_start()
151 mutex_unlock(&host->intr_mutex); in host1x_intr_start()
154 void host1x_intr_stop(struct host1x *host) in host1x_intr_stop() argument
156 host1x_hw_intr_disable_all_syncpt_intrs(host); in host1x_intr_stop()