On Fri, 2009-10-09 at 13:57 -0700, Hollis Blanchard wrote: > > +#ifdef CONFIG_PPC64 > > +#ifdef DEBUG_EMUL > > + printk(KERN_INFO "mtDEC: %x\n", vcpu->arch.dec); > > +#endif > > + /* POWER4+ triggers a dec interrupt if the value is < 0 */ > > + if (vcpu->arch.dec & 0x80000000) { > > + del_timer(&vcpu->arch.dec_timer); > > + kvmppc_core_queue_dec(vcpu); > > + } > > + else if (true) { > > +#else > > if (vcpu->arch.tcr & TCR_DIE) { > > +#endif > > /* The decrementer ticks at the same rate as the timebase, so > > * that's how we convert the guest DEC value to the number of > > * host ticks. */ > > Ifdefs through the middle of control syntax makes my head hurt. :) Note that your original BookE DEC emulation looks fishy :-) I may have missed something in your code... but I don't think it emulates the expected HW behaviour: Basically, when the BookE DEC hits the 1 -> 0 transition it latches an event in TSE:DIS always, whether TCR:DIE is set or not. If DIE is not set, the interrupt is sent. It will then stop counting if auto-reload isn't enabled. That means that if TSR:DIS is set from a previous event while TCR:DIE is clear, then setting TCR:DIE (with MSR:EE enabled of course) will trigger a DEC interrupt on BookE. The BookE DEC interrupt is basically a level sensitive thing sourced from to (TSR:DIS && TCR:DIE), and TSR:DIS remains set until explicitely cleared. Cheers, Ben. -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html