qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [PATCH 09/17] memory: iommu support
@ 2013-05-01  4:35 David Gibson
  2013-05-01 16:10 ` Paolo Bonzini
  0 siblings, 1 reply; 6+ messages in thread
From: David Gibson @ 2013-05-01  4:35 UTC (permalink / raw)
  To: pbonzini; +Cc: aik, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2087 bytes --]

> From: Avi Kivity <avi.kivity@gmail.com>
> 
> Add a new memory region type that translates addresses it is given,
> then forwards them to a target address space.  This is similar to
> an alias, except that the mapping is more flexible than a linear
> translation and trucation, and also less efficient since the
> translation happens at runtime.
> 
> The implementation uses an AddressSpace mapping the target region to
> avoid hierarchical dispatch all the way to the resolved region; only
> iommu regions are looked up dynamically.
> 
> Signed-off-by: Avi Kivity <avi.kivity@gmail.com>
> [Modified to put translation in address_space_translate - Paolo]
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  exec.c                |   35 +++++++++++++++++++++++++++++------
>  include/exec/memory.h |   44 ++++++++++++++++++++++++++++++++++++++++++++
>  memory.c              |   28 ++++++++++++++++++++++++++++
>  3 files changed, 101 insertions(+), 6 deletions(-)

[snip]
> +void memory_region_init_iommu(MemoryRegion *mr,
> +                              MemoryRegionIOMMUOps *ops,
> +                              MemoryRegion *target,
> +                              const char *name,
> +                              uint64_t size)
> +{
> +    memory_region_init(mr, name, size);
> +    mr->ops = NULL;
> +    mr->iommu_ops = ops,
> +    mr->opaque = mr;
> +    mr->terminates = true;  /* then re-forwards */
> +    mr->destructor = memory_region_destructor_iommu;
> +    mr->iommu_target_as = g_new(AddressSpace, 1);
> +    address_space_init(mr->iommu_target_as, target);

Since IOMMUs are very likely to share a target AS (in fact, it will
nearly always be system memory), it seems odd to me to construct new
AddressSpace objects for each one, rather than just giving the
AddressSpace as the parameter to memory_region_init_iommu.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-05-02  7:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-01  4:35 [Qemu-devel] [PATCH 09/17] memory: iommu support David Gibson
2013-05-01 16:10 ` Paolo Bonzini
2013-05-02  3:05   ` David Gibson
2013-05-02  5:24     ` Paolo Bonzini
2013-05-02  6:28       ` David Gibson
2013-05-02  7:36         ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).