diff mbox series

[06/27] Make flatview_extend_translation() take a MemTxAttrs argument

Message ID 20180521140402.23318-7-peter.maydell@linaro.org
State Superseded
Headers show
Series iommu: support txattrs, support TCG execution, implement TZ MPC | expand

Commit Message

Peter Maydell May 21, 2018, 2:03 p.m. UTC
As part of plumbing MemTxAttrs down to the IOMMU translate method,
add MemTxAttrs as an argument to flatview_extend_translation().
Its callers either have an attrs value to hand, or don't care
and can use MEMTXATTRS_UNSPECIFIED.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 exec.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

-- 
2.17.0

Comments

Alex Bennée May 22, 2018, 10:56 a.m. UTC | #1
Peter Maydell <peter.maydell@linaro.org> writes:

> As part of plumbing MemTxAttrs down to the IOMMU translate method,

> add MemTxAttrs as an argument to flatview_extend_translation().

> Its callers either have an attrs value to hand, or don't care

> and can use MEMTXATTRS_UNSPECIFIED.

>

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Reviewed-by: Alex Bennée <alex.bennee@linaro.org>


> ---

>  exec.c | 15 ++++++++++-----

>  1 file changed, 10 insertions(+), 5 deletions(-)

>

> diff --git a/exec.c b/exec.c

> index 22af4e8cb9..718b33921b 100644

> --- a/exec.c

> +++ b/exec.c

> @@ -3495,9 +3495,9 @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr,

>

>  static hwaddr

>  flatview_extend_translation(FlatView *fv, hwaddr addr,

> -                                 hwaddr target_len,

> -                                 MemoryRegion *mr, hwaddr base, hwaddr len,

> -                                 bool is_write)

> +                            hwaddr target_len,

> +                            MemoryRegion *mr, hwaddr base, hwaddr len,

> +                            bool is_write, MemTxAttrs attrs)

>  {

>      hwaddr done = 0;

>      hwaddr xlat;

> @@ -3574,7 +3574,7 @@ void *address_space_map(AddressSpace *as,

>

>      memory_region_ref(mr);

>      *plen = flatview_extend_translation(fv, addr, len, mr, xlat,

> -                                             l, is_write);

> +                                        l, is_write, attrs);

>      ptr = qemu_ram_ptr_length(mr->ram_block, xlat, plen, true);

>      rcu_read_unlock();

>

> @@ -3659,8 +3659,13 @@ int64_t address_space_cache_init(MemoryRegionCache *cache,

>      mr = cache->mrs.mr;

>      memory_region_ref(mr);

>      if (memory_access_is_direct(mr, is_write)) {

> +        /* We don't care about the memory attributes here as we're only

> +         * doing this if we found actual RAM, which behaves the same

> +         * regardless of attributes; so UNSPECIFIED is fine.

> +         */

>          l = flatview_extend_translation(cache->fv, addr, len, mr,

> -                                        cache->xlat, l, is_write);

> +                                        cache->xlat, l, is_write,

> +                                        MEMTXATTRS_UNSPECIFIED);

>          cache->ptr = qemu_ram_ptr_length(mr->ram_block, cache->xlat, &l, true);

>      } else {

>          cache->ptr = NULL;



--
Alex Bennée
Richard Henderson May 22, 2018, 4:15 p.m. UTC | #2
On 05/21/2018 07:03 AM, Peter Maydell wrote:
> As part of plumbing MemTxAttrs down to the IOMMU translate method,

> add MemTxAttrs as an argument to flatview_extend_translation().

> Its callers either have an attrs value to hand, or don't care

> and can use MEMTXATTRS_UNSPECIFIED.

> 

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

> ---


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/exec.c b/exec.c
index 22af4e8cb9..718b33921b 100644
--- a/exec.c
+++ b/exec.c
@@ -3495,9 +3495,9 @@  bool address_space_access_valid(AddressSpace *as, hwaddr addr,
 
 static hwaddr
 flatview_extend_translation(FlatView *fv, hwaddr addr,
-                                 hwaddr target_len,
-                                 MemoryRegion *mr, hwaddr base, hwaddr len,
-                                 bool is_write)
+                            hwaddr target_len,
+                            MemoryRegion *mr, hwaddr base, hwaddr len,
+                            bool is_write, MemTxAttrs attrs)
 {
     hwaddr done = 0;
     hwaddr xlat;
@@ -3574,7 +3574,7 @@  void *address_space_map(AddressSpace *as,
 
     memory_region_ref(mr);
     *plen = flatview_extend_translation(fv, addr, len, mr, xlat,
-                                             l, is_write);
+                                        l, is_write, attrs);
     ptr = qemu_ram_ptr_length(mr->ram_block, xlat, plen, true);
     rcu_read_unlock();
 
@@ -3659,8 +3659,13 @@  int64_t address_space_cache_init(MemoryRegionCache *cache,
     mr = cache->mrs.mr;
     memory_region_ref(mr);
     if (memory_access_is_direct(mr, is_write)) {
+        /* We don't care about the memory attributes here as we're only
+         * doing this if we found actual RAM, which behaves the same
+         * regardless of attributes; so UNSPECIFIED is fine.
+         */
         l = flatview_extend_translation(cache->fv, addr, len, mr,
-                                        cache->xlat, l, is_write);
+                                        cache->xlat, l, is_write,
+                                        MEMTXATTRS_UNSPECIFIED);
         cache->ptr = qemu_ram_ptr_length(mr->ram_block, cache->xlat, &l, true);
     } else {
         cache->ptr = NULL;