On 23 April 2013 18:39, Jan Kiszka <jan.kis...@siemens.com> wrote: > On 2013-04-23 19:26, Peter Maydell wrote: >> That would be an improvement, but it still requires this >> device to know what address space it's mapped into, which >> is a bit ugly. > > Unfortunately the KVM API mandates this knowledge (IOAPIC state contains > the absolute mapping address). So we need some channel to explore where > this device is mapped.
For ARM we defer the mechanics of "tell the kernel where this memory region is" from the device implementation (hw/intc/arm_gic_kvm.c) to generic code in target-arm/kvm.c, which I personally think is a neat way to solve this problem. It looks like the x86 ABI has tied up one-time config stuff (like the base address) with generic state save/load though, so that doesn't quite work for the x86 case. Anyway, I think I've previously argued on this list against having a "return address of this MR in this AddressSpace" function in the API, but I've changed my mind on that: it's kind of equivalent to the listener API functionality except it's a one-off query. NB: I don't think we should call it memory_region_get_address() though -- that implies a non-existent parallel to the current memory_region_set_address(). thanks -- PMM