[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 09/17] memory: iommu support
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 09/17] memory: iommu support |
Date: |
Wed, 01 May 2013 18:10:47 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Il 01/05/2013 06:35, David Gibson ha scritto:
>> From: Avi Kivity <address@hidden>
>>
>> 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 <address@hidden> [Modified to put
>> translation in address_space_translate - Paolo] Signed-off-by:
>> Paolo Bonzini <address@hidden> --- 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.
>
I think the problem is that we do not have reference counting, and
this makes it simpler to manage the lifetime. It can be changed later.
Paolo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJRgT6GAAoJEBvWZb6bTYbyk/cP/RCHjFrtXYas+TLti8vcbCS1
zCUGnURgNqKxI4529E9VGF4PlO6/uxDP/mpNgDx7FCkMyA6bNL6fxw7RhvWyKFjU
xvZt6l7HYVOxbuNVAraZ4JmQ+fnvgyxJn1djMKNdGKNuRdpXj6b2NC+xyw8rSSc2
bIR6FT0piAlFP+kXiNFyf3cIZzT84qVX1tqphCRov7jvWyYG8Zv5VHpEEjaY7fJS
LEJFQ4ZfjM94RAekhZ7GkGmmlh9vfTplKz0G+0/EOYcaWBNwd7bKjGf6hWNtLb3z
3chtMKyODe8JRR/FuWuLx0GDZzvKZOE9yRGHerhL0aDCMviNKILUTnES3twe82j9
F8ywYO4CnkdKRIzKXXDTd8hZkgzF60fWzMvtvjOg6oXHJFyNoXRLhD23sZsTFaMi
q+mk7JiPfXrvjrZcUlQ4YwN7gv9gkZ+2JO1di/R9Xq62aqYBLke9Fwke7fdX+qbR
RB7coXgfExheRJdyWB56Lqr9m2KAtnW7T6ISR1G/nV0yr+ye1N9LifUkCAg4MHa8
ANsMMA6NbwmwtqJ9DDqzH+RkK7ZzCzq/IkYGeEial/sUnxXLggu6LanyahTMun49
ZmJDbEUWVAbrA4bkbQ1XHM6B2EFLg//wen7uSdIR+UZKgjkhxpB+PKiLppvPyXW1
5LuT1XZmghaeE3nD/i3A
=GcNo
-----END PGP SIGNATURE-----