qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: pbonzini@redhat.com
Cc: aik@truffula.fritz.box, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 09/17] memory: iommu support
Date: Wed, 1 May 2013 14:35:24 +1000	[thread overview]
Message-ID: <20130501043524.GO20202@truffula.fritz.box> (raw)

[-- 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 --]

             reply	other threads:[~2013-05-01  4:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01  4:35 David Gibson [this message]
2013-05-01 16:10 ` [Qemu-devel] [PATCH 09/17] memory: iommu support 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130501043524.GO20202@truffula.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@truffula.fritz.box \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).