On 21.03.2013, at 11:53, Peter Maydell wrote: > On 21 March 2013 08:31, Alexander Graf <ag...@suse.de> wrote: >> On 14.02.2013, at 07:31, Scott Wood wrote: >>> This is useful for when a user of the memory region API needs to >>> communicate the absolute bus address to something outside QEMU >>> (in particular, KVM). >>> >>> Signed-off-by: Scott Wood <scottw...@freescale.com> >> >> Peter, how does the VGIC implementation handle this? > > Check kvm_arm_register_device() in target-arm/kvm.c. Basically > the VGIC device model calls this function to say "tell the kernel > where this MemoryRegion is in the system address space, when it > eventually gets mapped". The code in kvm.c uses the memory system's > Notifier API to get a callback when the region is mapped into > an address space, which it uses to track the offset in the > address space. Finally, we use a machine init notifier so that > just before everything finally starts we can make the KVM ioctls > to say "here is where everything lives".
Same thing here. The question is how the kvm-vgic code in QEMU finds out where it got mapped to. Scott adds this patch to do this, but I'd assume you have some other way :) Alex > > I think this is a pretty neat way of doing it because it means > neither the interrupt controller device nor the board model > really need to care about the kernel being told where things > are mapped; it's all abstracted out into kvm.c. If your > interrupt controller can be moved around at runtime that's > probably also handlable, but the ARM code just unregisters its > notifiers at machine init because the GIC can't move. > > (I think the code assumes the device only gets mapped into > one address space; this could easily be fixed if it's not true > at some point in the future.) > > thanks > -- PMM