Lines Matching +full:re +full:- +full:routed

1 // SPDX-License-Identifier: GPL-2.0-only
40 xc->pending |= 1 << cppr; in GLUE()
44 if (cppr >= xc->hw_cppr) in GLUE()
45 pr_warn("KVM-XIVE: CPU %d odd ack CPPR, got %d at %d\n", in GLUE()
46 smp_processor_id(), cppr, xc->hw_cppr); in GLUE()
51 * xc->cppr, this will be done as we scan for interrupts in GLUE()
54 xc->hw_cppr = cppr; in GLUE()
61 if (offset == XIVE_ESB_SET_PQ_10 && xd->flags & XIVE_IRQ_FLAG_STORE_EOI) in GLUE()
64 if (xd->flags & XIVE_IRQ_FLAG_SHIFT_BUG) in GLUE()
69 val >>= 64-8; in GLUE()
78 if (xd->flags & XIVE_IRQ_FLAG_STORE_EOI) in GLUE()
80 else if (hw_irq && xd->flags & XIVE_IRQ_FLAG_EOI_FW) in GLUE()
82 else if (xd->flags & XIVE_IRQ_FLAG_LSI) { in GLUE()
85 * as they are automatically re-triggred in HW when still in GLUE()
98 * This allows us to then do a re-trigger if Q was set in GLUE()
103 /* Re-trigger if needed */ in GLUE()
122 while ((xc->mfrr != 0xff || pending != 0) && hirq == 0) { in GLUE()
131 prio = ffs(pending) - 1; in GLUE()
134 if (prio >= xc->cppr || prio > 7) { in GLUE()
135 if (xc->mfrr < xc->cppr) { in GLUE()
136 prio = xc->mfrr; in GLUE()
143 q = &xc->queues[prio]; in GLUE()
144 idx = q->idx; in GLUE()
145 toggle = q->toggle; in GLUE()
153 qpage = READ_ONCE(q->qpage); in GLUE()
158 * non-queueing priority (ie, qpage = 0). in GLUE()
160 hirq = __xive_read_eq(qpage, q->msk, &idx, &toggle); in GLUE()
165 * we EOI it now, thus re-enabling reception of a new in GLUE()
169 * page for the queue. In this case, we have non-queued in GLUE()
178 GLUE(X_PFX,source_eoi)(xc->vp_ipi, in GLUE()
179 &xc->vp_ipi_data); in GLUE()
180 q->idx = idx; in GLUE()
181 q->toggle = toggle; in GLUE()
203 if (atomic_read(&q->pending_count)) { in GLUE()
204 int p = atomic_xchg(&q->pending_count, 0); in GLUE()
207 WARN_ON(p > atomic_read(&q->count)); in GLUE()
209 atomic_sub(p, &q->count); in GLUE()
219 if (prio >= xc->mfrr && xc->mfrr < xc->cppr) { in GLUE()
220 prio = xc->mfrr; in GLUE()
227 q->idx = idx; in GLUE()
228 q->toggle = toggle; in GLUE()
237 xc->pending = pending; in GLUE()
251 * Note: This can only make xc->cppr smaller as the previous in GLUE()
253 * the current xc->cppr. Thus we don't need to re-check xc->mfrr in GLUE()
257 xc->cppr = prio; in GLUE()
260 * as the HW interrupt we use for IPIs is routed to priority 0. in GLUE()
262 * We re-sync it here. in GLUE()
264 if (xc->cppr != xc->hw_cppr) { in GLUE()
265 xc->hw_cppr = xc->cppr; in GLUE()
266 __x_writeb(xc->cppr, __x_tima + TM_QW1_OS + TM_CPPR); in GLUE()
274 struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu; in GLUE()
280 xc->GLUE(X_STAT_PFX,h_xirr)++; in GLUE()
286 xc->pending, xc->hw_cppr, xc->cppr); in GLUE()
289 old_cppr = xive_prio_to_guest(xc->cppr); in GLUE()
292 hirq = GLUE(X_PFX,scan_interrupts)(xc, xc->pending, scan_fetch); in GLUE()
295 hirq, xc->hw_cppr, xc->cppr); in GLUE()
318 vcpu->arch.regs.gpr[4] = hirq | (old_cppr << 24); in GLUE()
325 struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu; in GLUE()
326 u8 pending = xc->pending; in GLUE()
331 xc->GLUE(X_STAT_PFX,h_ipoll)++; in GLUE()
334 if (xc->server_num != server) { in GLUE()
335 vcpu = kvmppc_xive_find_server(vcpu->kvm, server); in GLUE()
338 xc = vcpu->arch.xive_vcpu; in GLUE()
353 vcpu->arch.regs.gpr[4] = hirq | (xc->cppr << 24); in GLUE()
362 pending = xc->pending; in GLUE()
363 if (xc->mfrr != 0xff) { in GLUE()
364 if (xc->mfrr < 8) in GLUE()
365 pending |= 1 << xc->mfrr; in GLUE()
371 prio = ffs(pending) - 1; in GLUE()
382 for (prio = xc->cppr; prio < KVMPPC_XIVE_Q_COUNT; prio++) { in GLUE()
383 struct xive_q *q = &xc->queues[prio]; in GLUE()
391 idx = q->idx; in GLUE()
392 toggle = q->toggle; in GLUE()
393 qpage = READ_ONCE(q->qpage); in GLUE()
412 state = &sb->irq_state[src]; in GLUE()
415 if (xc->server_num == state->act_server) in GLUE()
419 * Allright, it *has* been re-routed, kill it from in GLUE()
428 if (!(xd->flags & XIVE_IRQ_FLAG_LSI)) in GLUE()
435 idx = (idx + 1) & q->msk; in GLUE()
444 struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu; in GLUE()
445 struct kvmppc_xive *xive = vcpu->kvm->arch.xive; in GLUE()
450 xc->GLUE(X_STAT_PFX,h_cppr)++; in GLUE()
456 old_cppr = xc->cppr; in GLUE()
457 xc->cppr = cppr; in GLUE()
460 * Order the above update of xc->cppr with the subsequent in GLUE()
461 * read of xc->mfrr inside push_pending_to_hw() in GLUE()
476 * interrupt that has been routed to another CPU, take in GLUE()
488 * the queue must still be routed to us and isn't a source in GLUE()
495 xc->hw_cppr = cppr; in GLUE()
503 struct kvmppc_xive *xive = vcpu->kvm->arch.xive; in GLUE()
506 struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu; in GLUE()
515 xc->GLUE(X_STAT_PFX,h_eoi)++; in GLUE()
517 xc->cppr = xive_prio_from_guest(new_cppr); in GLUE()
527 * This barrier orders the setting of xc->cppr vs. in GLUE()
528 * subsquent test of xc->mfrr done inside in GLUE()
544 state = &sb->irq_state[src]; in GLUE()
547 state->in_eoi = true; in GLUE()
552 * of xc->cppr vs. subsquent test of xc->mfrr done inside in GLUE()
558 if (state->guest_priority == MASKED) { in GLUE()
559 arch_spin_lock(&sb->lock); in GLUE()
560 if (state->guest_priority != MASKED) { in GLUE()
561 arch_spin_unlock(&sb->lock); in GLUE()
567 state->old_p = false; in GLUE()
569 arch_spin_unlock(&sb->lock); in GLUE()
577 if (state->lsi && state->asserted) in GLUE()
588 * state->in_eoi is visible. in GLUE()
591 state->in_eoi = false; in GLUE()
594 /* Re-evaluate pending IRQs and update HW */ in GLUE()
595 GLUE(X_PFX,scan_interrupts)(xc, xc->pending, scan_eoi); in GLUE()
597 pr_devel(" after scan pending=%02x\n", xc->pending); in GLUE()
600 xc->hw_cppr = xc->cppr; in GLUE()
601 __x_writeb(xc->cppr, __x_tima + TM_QW1_OS + TM_CPPR); in GLUE()
609 struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu; in GLUE()
613 xc->GLUE(X_STAT_PFX,h_ipi)++; in GLUE()
616 vcpu = kvmppc_xive_find_server(vcpu->kvm, server); in GLUE()
619 xc = vcpu->arch.xive_vcpu; in GLUE()
622 xc->mfrr = mfrr; in GLUE()
625 * The load of xc->cppr below and the subsequent MMIO store in GLUE()
629 * - Synchronize with another CPU doing an H_EOI or a H_CPPR in GLUE()
630 * updating xc->cppr then reading xc->mfrr. in GLUE()
632 * - The target of the IPI sees the xc->mfrr update in GLUE()
637 if (mfrr < xc->cppr) in GLUE()
638 __x_writeq(0, __x_trig_page(&xc->vp_ipi_data)); in GLUE()