On Wed, 2009-07-08 at 09:27 +0200, Alexander Graf wrote: > Hum, something like a generic interrupt hooking mechanism? Sounds > cool :-). But not all interrupt handlers use generic code, so we'd > have to duplicate some bits quite some times. Right, some of them are subtly different. .. One cool thing however is that they all have about 0x100 bytes of space and only use a portion of that so we should be able to do something about it... maybe having 2 variants of the prolog, with and without the test to jump to KVM for example and "replace" them when KVM is loaded. I need to think about it a bit more. One thing we may want to do is instead to set SPRG3 bit 0, instead, is to set a bit in the PACA, that would make things a lot easier. We could run through the base prolog and just add three instructions (that can be noped out easily) to load that flag, test it and branch out of line to a special if set. In the standard prolog, we can clobber r10, r11 and r12 right after EXCEPTION_PROLOG_1 and we should be able to clobber CR0 as well since we just saved CR into r9, so we could probably do something like lbz the "KVM" flag into r11 before loading PACAKBASE into r12, then compare it to 0 and branch conditional after loading PACAKMSR into r10 or something like that (to keep a gap between load and use to avoid back to back here). In fact, more fun: You could hack PACAKBASE and PACAMSR :-) But that's a bit harder to get the offsets right. Would probably work to. Make it point to a page where the handlers are at the right offset (we could make them all be at 0x0f0 or so from the base of the exception easily instead of right after so you don't have to do black magic to find where to put them or you could just fill the whole 0x100 bytes with copies). That way, depending on whether you are in KVM or not on that CPU, the existing code would branch to your secondary handlers with the MSR of your choice (typically still in real mode) without adding a conditional branch to the exception entry code. We can carve out a page down there in the RMA for use by KVM easily, in fact we probably have some unused space already. 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