qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH v2 3/6] memory: add memory_region_to_address


From: Scott Wood
Subject: Re: [Qemu-devel] [RFC PATCH v2 3/6] memory: add memory_region_to_address()
Date: Tue, 16 Apr 2013 19:10:48 -0500

On 04/16/2013 03:25:50 AM, Peter Maydell wrote:
On 16 April 2013 00:19, Scott Wood <address@hidden> 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 <address@hidden>
> ---
> TODO: Use add/del memory listeners later in the patchset, which would
> eliminate the need for this patch.

Yes, please do.

I will. Alex wanted a respun patchset to work with the latest kernel API, and I didn't have a chance to address this yet. It's still RFC.

> +/* memory_region_to_address: Find the full address of the start of the > + * given #MemoryRegion, ignoring aliases. There is no guarantee > + * that the #MemoryRegion is actually visible at this address, if
> + *      there are overlapping regions.
> + *
> + * @mr: #MemoryRegion being queried
> + * @asp: if non-NULL, returns the #AddressSpace @mr is mapped in, if any
> + */
> +hwaddr memory_region_to_address(MemoryRegion *mr, AddressSpace **asp);

A MemoryRegion can appear in more than one AddressSpace (or none at all),
so I don't think this is a very clearly defined API to put in the
memory API itself. (It's ok to make that kind of assumption as a user
of the memory APIs for particular cases, eg in how a memory listener
callback function behaves. But we shouldn't be baking those assumptions
into new API functions.)

I'm not sure how it's different from memory_region_to_address_space in that regard, other than its ability to gracefully handle the "or none at all" case.

How does it work to be in more than one AddressSpace, if there's a parent chain? More than one "as" with the same "as->root"? Or are you referring to aliases?

-Scott



reply via email to

[Prev in Thread] Current Thread [Next in Thread]