Lines Matching +full:can +full:- +full:primary

1 // SPDX-License-Identifier: GPL-2.0-only
21 #define SRR1_MC_LDSTERR (1ul << (63-42))
22 #define SRR1_MC_IFETCH_SH (63-45)
25 #define SRR1_MC_IFETCH_SLBMULTI 3 /* SLB multi-hit */
26 #define SRR1_MC_IFETCH_SLBPARMULTI 4 /* SLB parity + multi-hit */
27 #define SRR1_MC_IFETCH_TLBMULTI 5 /* I-TLB multi-hit */
30 #define DSISR_MC_DERAT_MULTI 0x800 /* D-ERAT multi-hit */
31 #define DSISR_MC_TLB_MULTI 0x400 /* D-TLB multi-hit */
33 #define DSISR_MC_SLB_MULTI 0x080 /* SLB multi-hit */
34 #define DSISR_MC_SLB_PARMULTI 0x040 /* SLB parity + multi-hit */
46 slb = vcpu->arch.slb_shadow.pinned_addr; in reload_slb()
51 n = min_t(u32, be32_to_cpu(slb->persistent), SLB_MIN_SIZE); in reload_slb()
52 if ((void *) &slb->save_area[n] > vcpu->arch.slb_shadow.pinned_end) in reload_slb()
57 unsigned long rb = be64_to_cpu(slb->save_area[i].esid); in reload_slb()
58 unsigned long rs = be64_to_cpu(slb->save_area[i].vsid); in reload_slb()
66 * On POWER7, see if we can handle a machine check that occurred inside
71 unsigned long srr1 = vcpu->arch.shregs.msr; in kvmppc_realmode_mc_power7()
76 unsigned long dsisr = vcpu->arch.shregs.dsisr; in kvmppc_realmode_mc_power7()
80 /* flush and reload SLB; flushes D-ERAT too */ in kvmppc_realmode_mc_power7()
86 tlbiel_all_lpid(vcpu->kvm->arch.radix); in kvmppc_realmode_mc_power7()
103 tlbiel_all_lpid(vcpu->kvm->arch.radix); in kvmppc_realmode_mc_power7()
117 if (vcpu->kvm->arch.fwnmi_enabled) { in kvmppc_realmode_machine_check()
125 * Now get the event and stash it in the vcpu struct so it can in kvmppc_realmode_machine_check()
126 * be handled by the primary thread in virtual mode. We can't in kvmppc_realmode_machine_check()
137 vcpu->arch.mce_evt = mce_evt; in kvmppc_realmode_machine_check()
143 struct kvmppc_vcore *vc = vcpu->arch.vcore; in kvmppc_p9_realmode_hmi_handler()
148 * resynced then it will remain in host-offset, and if it was resynced in kvmppc_p9_realmode_hmi_handler()
149 * then it is brought into host-offset. Then the tb offset is in kvmppc_p9_realmode_hmi_handler()
150 * re-applied before continuing with the KVM exit. in kvmppc_p9_realmode_hmi_handler()
156 if (vc->tb_offset_applied) { in kvmppc_p9_realmode_hmi_handler()
157 u64 new_tb = mftb() - vc->tb_offset_applied; in kvmppc_p9_realmode_hmi_handler()
163 vc->tb_offset_applied = 0; in kvmppc_p9_realmode_hmi_handler()
166 local_paca->hmi_irqs++; in kvmppc_p9_realmode_hmi_handler()
178 u64 new_tb = mftb() + vc->tb_offset; in kvmppc_p9_realmode_hmi_handler()
184 vc->tb_offset_applied = kvmppc_get_tb_offset(vcpu); in kvmppc_p9_realmode_hmi_handler()
191 * The following subcore HMI handling is all only for pre-POWER9 CPUs.
197 if (local_paca->kvm_hstate.kvm_split_mode) in kvmppc_cur_subcore_size()
198 return local_paca->kvm_hstate.kvm_split_mode->subcore_size; in kvmppc_cur_subcore_size()
207 thread_id = cpu_thread_in_core(local_paca->paca_index); in kvmppc_subcore_enter_guest()
210 local_paca->sibling_subcore_state->in_guest[subcore_id] = 1; in kvmppc_subcore_enter_guest()
218 thread_id = cpu_thread_in_core(local_paca->paca_index); in kvmppc_subcore_exit_guest()
221 local_paca->sibling_subcore_state->in_guest[subcore_id] = 0; in kvmppc_subcore_exit_guest()
228 &local_paca->sibling_subcore_state->flags)) in kvmppc_tb_resync_required()
237 &local_paca->sibling_subcore_state->flags); in kvmppc_tb_resync_done()
241 * kvmppc_realmode_hmi_handler() is called only by primary thread during
248 * to non-TB errors, opal hmi handler will not touch/restore TB register
251 * Since we are not sure about the cause of this HMI, we can't be sure
258 * - On TB error, HMI interrupt is reported on all the threads of the core
259 * that has encountered TB error irrespective of split-core mode.
260 * - The very first thread on the core that get chance to fix TB error
262 * - The resync TB is a core level action i.e. it will sync all the TBs
263 * in that core independent of split-core mode. This means if we trigger
267 * All threads need to co-ordinate before making opal hmi handler.
268 * All threads will use sibling_subcore_state->in_guest[] (shared by all
272 * subcore status. Only primary threads from each subcore is responsible
278 * (sibling_subcore_state->flags) will be used to co-ordinate between
279 * primary threads to decide who takes up the responsibility.
282 * - Primary thread from each subcore tries to set resync required bit[63]
283 * of paca->sibling_subcore_state->flags.
284 * - The first primary thread that is able to set the flag takes the
286 * - All other threads which are in host will call
287 * wait_for_subcore_guest_exit() and wait for in_guest[0-3] from
288 * paca->sibling_subcore_state to get cleared.
289 * - All the primary thread will clear its subcore status from subcore
291 * - Once all primary threads clear in_guest[0-3], all of them will invoke
293 * - Now all threads will wait for TB resync to complete by invoking
295 * - Thread leader will do a TB resync by invoking opal_resync_timebase()
297 * - All other threads will now come out of resync wait loop and proceed
299 * - On return of this function, primary thread will signal all
301 * - All secondary threads will eventually call opal hmi handler on
311 local_paca->hmi_irqs++; in kvmppc_realmode_hmi_handler()
317 * By now primary thread has already completed guest->host in kvmppc_realmode_hmi_handler()
320 * for primary thread to signal them to go ahead. in kvmppc_realmode_hmi_handler()
342 * All the primary threads and threads from subcore that are in kvmppc_realmode_hmi_handler()
349 * At this point we are sure that primary threads from each in kvmppc_realmode_hmi_handler()
350 * subcore on this core have completed guest->host partition in kvmppc_realmode_hmi_handler()
373 if (local_paca->kvm_hstate.kvm_vcore) in kvmppc_realmode_hmi_handler()
374 local_paca->kvm_hstate.kvm_vcore->tb_offset_applied = 0; in kvmppc_realmode_hmi_handler()