/* * This gets called on a softpatch interrupt on POWER9 DD2.2 processors. * We expect to find a TM-related instruction to be emulated. The * instruction image is in vcpu->arch.emul_inst. If the guest was in * TM suspended or transactional state, the checkpointed state has been * reclaimed and is in the vcpu struct. The CPU is in virtual mode in * host context.
*/ int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu)
{
u32 instr = vcpu->arch.emul_inst;
u64 msr = vcpu->arch.shregs.msr;
u64 newmsr, bescr; int ra, rs;
/* * The TM softpatch interrupt sets NIP to the instruction following * the faulting instruction, which is not executed. Rewind nip to the * faulting instruction so it looks like a normal synchronous * interrupt, then update nip in the places where the instruction is * emulated.
*/
vcpu->arch.regs.nip -= 4;
/* * rfid, rfebb, and mtmsrd encode bit 31 = 0 since it's a reserved bit * in these instructions, so masking bit 31 out doesn't change these * instructions. For treclaim., tsr., and trechkpt. instructions if bit * 31 = 0 then they are per ISA invalid forms, however P9 UM, in section * 4.6.10 Book II Invalid Forms, informs specifically that ignoring bit * 31 is an acceptable way to handle these invalid forms that have * bit 31 = 0. Moreover, for emulation purposes both forms (w/ and wo/ * bit 31 set) can generate a softpatch interrupt. Hence both forms * are handled below for these instructions so they behave the same way.
*/ switch (instr & PO_XOP_OPCODE_MASK) { case PPC_INST_RFID: /* XXX do we need to check for PR=0 here? */
newmsr = vcpu->arch.shregs.srr1; /* should only get here for Sx -> T1 transition */
WARN_ON_ONCE(!(MSR_TM_SUSPENDED(msr) &&
MSR_TM_TRANSACTIONAL(newmsr) &&
(newmsr & MSR_TM)));
newmsr = sanitize_msr(newmsr);
vcpu->arch.shregs.msr = newmsr;
vcpu->arch.cfar = vcpu->arch.regs.nip;
vcpu->arch.regs.nip = vcpu->arch.shregs.srr0; return RESUME_GUEST;
/* What should we do here? We didn't recognize the instruction */
kvmppc_core_queue_program(vcpu, SRR1_PROGILL);
pr_warn_ratelimited("Unrecognized TM-related instruction %#x for emulation", instr);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.