Lines Matching refs:state
393 struct kvmppc_xive_irq_state *state)
406 old_prio = state->guest_priority;
407 state->guest_priority = MASKED;
409 if (!state->in_eoi)
411 state->guest_priority = old_prio;
420 kvmppc_xive_select_irq(state, &hw_num, &xd);
426 * and won't set the interrupt to a state where it will
436 kvmppc_xive_vp(xive, state->act_server),
437 MASKED, state->number);
439 state->old_p = true;
440 state->old_q = false;
444 state->old_p = !!(val & 2);
445 state->old_q = !!(val & 1);
458 struct kvmppc_xive_irq_state *state)
465 if (!state->in_eoi)
473 struct kvmppc_xive_irq_state *state,
480 if (state->guest_priority != MASKED)
484 kvmppc_xive_select_irq(state, &hw_num, &xd);
492 kvmppc_xive_vp(xive, state->act_server),
493 state->act_priority, state->number);
495 if (!state->old_p)
504 if (state->old_q)
512 if (!state->old_p)
518 state->guest_priority = prio;
526 * NOTE: Must be called with the state lock held
529 struct kvmppc_xive_irq_state *state,
555 if (state->act_priority != MASKED)
557 state->act_server,
558 state->act_priority);
560 * Update state and HW
562 state->act_priority = prio;
563 state->act_server = server;
566 kvmppc_xive_select_irq(state, &hw_num, NULL);
570 prio, state->number);
592 * otherwise we leave PQ to the HW state which will be either
618 struct kvmppc_xive_irq_state *state;
644 state = &sb->irq_state[idx];
652 * xive_lock_and_mask() will also set state->guest_priority
653 * but won't otherwise change other fields of the state.
661 xive_lock_and_mask(xive, sb, state);
663 xive_lock_for_unmask(sb, state);
671 new_act_prio = state->act_priority;
676 new_act_prio, state->act_server, state->act_priority);
693 (state->act_server != server ||
694 state->act_priority != new_act_prio))
695 rc = xive_target_interrupt(kvm, state, server, new_act_prio);
702 xive_finish_unmask(xive, sb, state, priority);
708 state->saved_priority = priority;
719 struct kvmppc_xive_irq_state *state;
728 state = &sb->irq_state[idx];
730 *server = state->act_server;
731 *priority = state->guest_priority;
741 struct kvmppc_xive_irq_state *state;
750 state = &sb->irq_state[idx];
757 if (state->act_priority == MASKED) {
763 if (state->saved_priority == MASKED)
769 xive_lock_for_unmask(sb, state);
770 xive_finish_unmask(xive, sb, state, state->saved_priority);
780 struct kvmppc_xive_irq_state *state;
789 state = &sb->irq_state[idx];
796 state->saved_priority = xive_lock_and_mask(xive, sb, state);
805 struct kvmppc_xive_irq_state *state;
811 state = &sb->irq_state[idx];
812 if (!state->valid)
819 xive_irq_trigger(&state->ipi_data);
831 /* Return the per-cpu state for state saving/migration */
847 /* Grab individual state fields. We don't use pending_pri */
857 * We can't update the state of a "pushed" VCPU, but that
864 /* Update VCPU HW saved state */
869 * Update MFRR state. If it's not 0xff, we mark the VCPU as
901 struct kvmppc_xive_irq_state *state;
917 state = &sb->irq_state[idx];
923 * to either PQ=10 or 11 state, the latter if the interrupt
927 * The "state" argument is a "token", all it needs is to be
932 rc = irq_set_vcpu_affinity(host_irq, state);
939 * Mask and read state of IPI. We need to know if its P bit
943 prio = xive_lock_and_mask(xive, sb, state);
945 state->old_p, state->old_q);
948 xive_vm_esb_load(&state->ipi_data, XIVE_ESB_SET_PQ_01);
958 state->pt_number = hw_irq;
959 state->pt_data = irq_data_get_irq_handler_data(host_data);
968 kvmppc_xive_vp(xive, state->act_server),
969 state->act_priority, state->number);
978 if (prio != MASKED && !state->old_p)
979 xive_vm_source_eoi(hw_irq, state->pt_data);
982 state->old_p = state->old_q = false;
986 state->guest_priority = prio;
998 struct kvmppc_xive_irq_state *state;
1012 state = &sb->irq_state[idx];
1015 * Mask and read state of IRQ. We need to know if its P bit
1019 prio = xive_lock_and_mask(xive, sb, state);
1021 state->old_p, state->old_q);
1028 if (state->old_p)
1029 xive_vm_esb_load(state->pt_data, XIVE_ESB_SET_PQ_11);
1039 state->pt_number = 0;
1040 state->pt_data = NULL;
1051 xive_native_configure_irq(state->ipi_number,
1052 kvmppc_xive_vp(xive, state->act_server),
1053 state->act_priority, state->number);
1058 * to PQ=10 state. Otherwise we just re-enable it (PQ=00).
1060 if (prio == MASKED || state->old_p)
1061 xive_vm_esb_load(&state->ipi_data, XIVE_ESB_SET_PQ_10);
1063 xive_vm_esb_load(&state->ipi_data, XIVE_ESB_SET_PQ_00);
1067 state->guest_priority = prio;
1087 struct kvmppc_xive_irq_state *state = &sb->irq_state[j];
1089 if (!state->valid)
1091 if (state->act_priority == MASKED)
1093 if (state->act_server != xc->server_num)
1098 state->act_priority = MASKED;
1099 xive_vm_esb_load(&state->ipi_data, XIVE_ESB_SET_PQ_01);
1100 xive_native_configure_irq(state->ipi_number, 0, MASKED, 0);
1101 if (state->pt_number) {
1102 xive_vm_esb_load(state->pt_data, XIVE_ESB_SET_PQ_01);
1103 xive_native_configure_irq(state->pt_number, 0, MASKED, 0);
1381 struct kvmppc_xive_irq_state *state;
1388 state = &sb->irq_state[idx];
1391 if (!state->valid) {
1401 if (!state->saved_p)
1405 state->in_queue = true;
1412 struct kvmppc_xive_irq_state *state = &sb->irq_state[irq];
1414 if (!state->valid)
1417 /* Mask and save state, this will also sync HW queues */
1418 state->saved_scan_prio = xive_lock_and_mask(xive, sb, state);
1421 state->saved_p = state->old_p;
1422 state->saved_q = state->old_q;
1432 struct kvmppc_xive_irq_state *state = &sb->irq_state[irq];
1434 if (!state->valid)
1442 xive_lock_for_unmask(sb, state);
1445 if (state->saved_scan_prio != MASKED)
1446 xive_finish_unmask(xive, sb, state, state->saved_scan_prio);
1472 * work. Collect a stable state for all interrupts
1521 * This returns the source configuration and state to user space.
1526 struct kvmppc_xive_irq_state *state;
1535 state = &sb->irq_state[idx];
1537 if (!state->valid)
1543 * So to properly save the state into something that looks like a
1546 * We need, instead, mask them all (& save their previous PQ state)
1547 * to get a stable state in the HW, then sync them to ensure that
1554 * state is collected at that point, the rest of xive_get_source()
1555 * will merely collect and convert that state to the expected
1562 /* Convert saved state into something compatible with xics */
1563 val = state->act_server;
1564 prio = state->saved_scan_prio;
1568 prio = state->saved_priority;
1571 if (state->lsi) {
1573 if (state->saved_p)
1576 if (state->saved_p)
1579 if (state->saved_q)
1586 * state
1588 if (state->in_queue || (prio == MASKED && state->saved_q))
1669 struct kvmppc_xive_irq_state *state;
1692 state = &sb->irq_state[idx];
1710 if (!state->ipi_number) {
1711 state->ipi_number = xive_native_alloc_irq();
1712 if (state->ipi_number == 0) {
1716 xive_native_populate_irq_data(state->ipi_number, &state->ipi_data);
1717 pr_devel(" src_ipi=0x%x\n", state->ipi_number);
1722 * state. We will override that state from the saved state
1727 state->guest_priority = 0;
1728 xive_lock_and_mask(xive, sb, state);
1739 state->act_priority = MASKED;
1757 rc = xive_target_interrupt(xive->kvm, state,
1775 /* Cleanup the SW state */
1776 state->old_p = false;
1777 state->old_q = false;
1778 state->lsi = false;
1779 state->asserted = false;
1781 /* Restore LSI state */
1783 state->lsi = true;
1785 state->asserted = true;
1786 pr_devel(" LSI ! Asserted=%d\n", state->asserted);
1800 state->old_p = true;
1802 state->old_q = true;
1804 pr_devel(" P=%d, Q=%d\n", state->old_p, state->old_q);
1808 * perform the appropriate state transition and do a
1813 state->guest_priority = MASKED;
1814 state->saved_priority = guest_prio;
1817 xive_finish_unmask(xive, sb, state, guest_prio);
1818 state->saved_priority = guest_prio;
1822 if (!state->valid)
1824 state->valid = true;
1834 struct kvmppc_xive_irq_state *state;
1845 state = &sb->irq_state[idx];
1846 if (!state->valid)
1850 if (state->pt_number)
1853 if ((level == 1 && state->lsi) || level == KVM_INTERRUPT_SET_LEVEL)
1854 state->asserted = 1;
1856 state->asserted = 0;
1861 xive_irq_trigger(&state->ipi_data);
1961 struct kvmppc_xive_irq_state *state = &sb->irq_state[i];
1963 if (!state->valid)
1966 kvmppc_xive_cleanup_irq(state->ipi_number, &state->ipi_data);
1967 xive_cleanup_irq_data(&state->ipi_data);
1968 xive_native_free_irq(state->ipi_number);
1971 if (state->pt_number)
1972 kvmppc_xive_cleanup_irq(state->pt_number, state->pt_data);
1974 state->valid = false;
2174 seq_printf(m, "=========\nVCPU state\n=========\n");