Lines Matching +full:0 +full:xc

14 static void GLUE(X_PFX,ack_pending)(struct kvmppc_xive_vcpu *xc)  in GLUE()
38 cppr = ack & 0xff; in GLUE()
40 xc->pending |= 1 << cppr; in GLUE()
44 if (cppr >= xc->hw_cppr) 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()
79 __x_writeq(0, __x_eoi_page(xd) + XIVE_ESB_STORE_EOI); in GLUE()
105 __x_writeq(0, __x_trig_page(xd)); in GLUE()
115 static u32 GLUE(X_PFX,scan_interrupts)(struct kvmppc_xive_vcpu *xc, in GLUE()
118 u32 hirq = 0; in GLUE()
119 u8 prio = 0xff; in GLUE()
122 while ((xc->mfrr != 0xff || pending != 0) && hirq == 0) { in GLUE()
128 * If pending is 0 this will return 0xff which is what 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()
157 * Try to fetch from the queue. Will return 0 for a in GLUE()
158 * non-queueing priority (ie, qpage = 0). in GLUE()
168 * We also need to do that if prio is 0 and we had no in GLUE()
176 if (hirq == XICS_IPI || (prio == 0 && !qpage)) { in GLUE()
178 GLUE(X_PFX,source_eoi)(xc->vp_ipi, in GLUE()
179 &xc->vp_ipi_data); in GLUE()
204 int p = atomic_xchg(&q->pending_count, 0); in GLUE()
219 if (prio >= xc->mfrr && xc->mfrr < xc->cppr) { in GLUE()
220 prio = xc->mfrr; in GLUE()
237 xc->pending = pending; in GLUE()
251 * Note: This can only make xc->cppr smaller as the previous in GLUE()
252 * loop will only exit with hirq != 0 if prio is lower than 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()
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() local
280 xc->GLUE(X_STAT_PFX,h_xirr)++; in GLUE()
283 GLUE(X_PFX,ack_pending)(xc); in GLUE()
285 pr_devel(" new pending=0x%02x hw_cppr=%d cppr=%d\n", 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()
294 pr_devel(" got hirq=0x%x hw_cppr=%d cppr=%d\n", in GLUE()
295 hirq, xc->hw_cppr, xc->cppr); in GLUE()
299 if (hirq & 0xff000000) in GLUE()
300 pr_warn("XIVE: Weird guest interrupt number 0x%08x\n", hirq); in GLUE()
311 * hirq = 0; in GLUE()
325 struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu; in GLUE() local
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()
338 xc = vcpu->arch.xive_vcpu; in GLUE()
341 pending = 0xff; in GLUE()
345 u8 pipr = be64_to_cpu(qw1) & 0xff; in GLUE()
350 hirq = GLUE(X_PFX,scan_interrupts)(xc, pending, scan_poll); in GLUE()
353 vcpu->arch.regs.gpr[4] = hirq | (xc->cppr << 24); in GLUE()
358 static void GLUE(X_PFX,push_pending_to_hw)(struct kvmppc_xive_vcpu *xc) 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()
367 pending |= 0x80; in GLUE()
377 struct kvmppc_xive_vcpu *xc) 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()
404 irq = entry & 0x7fffffff; in GLUE()
415 if (xc->server_num == state->act_server) in GLUE()
422 qpage[idx] = cpu_to_be32((entry & 0x80000000) | XICS_DUMMY); in GLUE()
436 if (idx == 0) in GLUE()
444 struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu; in GLUE() local
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()
472 GLUE(X_PFX,push_pending_to_hw)(xc); in GLUE()
491 GLUE(X_PFX,scan_for_rerouted_irqs)(xive, xc); in GLUE()
495 xc->hw_cppr = cppr; in GLUE()
506 struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu; in GLUE() local
509 u32 irq = xirr & 0x00ffffff, hw_num; in GLUE()
511 int rc = 0; in GLUE()
515 xc->GLUE(X_STAT_PFX,h_eoi)++; in GLUE()
517 xc->cppr = xive_prio_from_guest(new_cppr); in GLUE()
525 if (irq == XICS_IPI || irq == 0) { in GLUE()
527 * This barrier orders the setting of xc->cppr vs. in GLUE()
528 * subsquent test of xc->mfrr done inside in GLUE()
552 * of xc->cppr vs. subsquent test of xc->mfrr done inside in GLUE()
578 __x_writeq(0, __x_trig_page(xd)); in GLUE()
595 GLUE(X_PFX,scan_interrupts)(xc, xc->pending, scan_eoi); in GLUE()
596 GLUE(X_PFX,push_pending_to_hw)(xc); 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() local
613 xc->GLUE(X_STAT_PFX,h_ipi)++; 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()
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()