Lines Matching refs:cpu
70 #define GIC_GET_PRIORITY(irq, cpu) \ argument
71 (((irq) < 32) ? s->priority1[irq][cpu] : s->priority2[(irq) - 32])
109 int cpu; in gic_update() local
112 for (cpu = 0; cpu < NCPU; cpu++) { in gic_update()
113 cm = 1 << cpu; in gic_update()
114 s->current_pending[cpu] = 1023; in gic_update()
115 if (!s->enabled || !s->cpu_enabled[cpu]) { in gic_update()
116 qemu_irq_lower(s->parent_irq[cpu]); in gic_update()
123 if (GIC_GET_PRIORITY(irq, cpu) < best_prio) { in gic_update()
124 best_prio = GIC_GET_PRIORITY(irq, cpu); in gic_update()
130 if (best_prio <= s->priority_mask[cpu]) { in gic_update()
131 s->current_pending[cpu] = best_irq; in gic_update()
132 if (best_prio < s->running_priority[cpu]) { in gic_update()
137 qemu_set_irq(s->parent_irq[cpu], level); in gic_update()
142 gic_set_pending_private(gic_state *s, int cpu, int irq) in gic_set_pending_private() argument
144 int cm = 1 << cpu; in gic_set_pending_private()
149 DPRINTF("Set %d pending cpu %d\n", irq, cpu); in gic_set_pending_private()
175 static void gic_set_running_irq(gic_state *s, int cpu, int irq) in gic_set_running_irq() argument
177 s->running_irq[cpu] = irq; in gic_set_running_irq()
179 s->running_priority[cpu] = 0x100; in gic_set_running_irq()
181 s->running_priority[cpu] = GIC_GET_PRIORITY(irq, cpu); in gic_set_running_irq()
186 static uint32_t gic_acknowledge_irq(gic_state *s, int cpu) in gic_acknowledge_irq() argument
189 int cm = 1 << cpu; in gic_acknowledge_irq()
190 new_irq = s->current_pending[cpu]; in gic_acknowledge_irq()
192 || GIC_GET_PRIORITY(new_irq, cpu) >= s->running_priority[cpu]) { in gic_acknowledge_irq()
196 s->last_active[new_irq][cpu] = s->running_irq[cpu]; in gic_acknowledge_irq()
200 gic_set_running_irq(s, cpu, new_irq); in gic_acknowledge_irq()
205 static void gic_complete_irq(gic_state * s, int cpu, int irq) in gic_complete_irq() argument
208 int cm = 1 << cpu; in gic_complete_irq()
210 if (s->running_irq[cpu] == 1023) in gic_complete_irq()
222 if (irq != s->running_irq[cpu]) { in gic_complete_irq()
224 int tmp = s->running_irq[cpu]; in gic_complete_irq()
225 while (s->last_active[tmp][cpu] != 1023) { in gic_complete_irq()
226 if (s->last_active[tmp][cpu] == irq) { in gic_complete_irq()
227 s->last_active[tmp][cpu] = s->last_active[irq][cpu]; in gic_complete_irq()
230 tmp = s->last_active[tmp][cpu]; in gic_complete_irq()
237 gic_set_running_irq(s, cpu, s->last_active[s->running_irq[cpu]][cpu]); in gic_complete_irq()
247 int cpu; in gic_dist_readb() local
251 cpu = gic_get_current_cpu(); in gic_dist_readb()
252 cm = 1 << cpu; in gic_dist_readb()
311 res = GIC_GET_PRIORITY(irq, cpu); in gic_dist_readb()
380 int cpu; in gic_dist_writeb() local
382 cpu = gic_get_current_cpu(); in gic_dist_writeb()
405 int mask = (irq < 32) ? (1 << cpu) : GIC_TARGET(irq); in gic_dist_writeb()
467 s->priority1[irq][cpu] = value; in gic_dist_writeb()
532 int cpu; in gic_dist_writel() local
536 cpu = gic_get_current_cpu(); in gic_dist_writel()
543 mask = 1 << cpu; in gic_dist_writel()
546 mask = ALL_CPU_MASK ^ (1 << cpu); in gic_dist_writel()
574 static uint32_t gic_cpu_read(gic_state *s, int cpu, int offset) in gic_cpu_read() argument
578 return s->cpu_enabled[cpu]; in gic_cpu_read()
580 return s->priority_mask[cpu]; in gic_cpu_read()
585 return gic_acknowledge_irq(s, cpu); in gic_cpu_read()
587 return s->running_priority[cpu]; in gic_cpu_read()
589 return s->current_pending[cpu]; in gic_cpu_read()
596 static void gic_cpu_write(gic_state *s, int cpu, int offset, uint32_t value) in gic_cpu_write() argument
600 s->cpu_enabled[cpu] = (value & 1); in gic_cpu_write()
604 s->priority_mask[cpu] = (value & 0xff); in gic_cpu_write()
610 return gic_complete_irq(s, cpu, value & 0x3ff); in gic_cpu_write()