diff mbox series

[09/27] Make flatview_access_valid() take a MemTxAttrs argument

Message ID 20180521140402.23318-10-peter.maydell@linaro.org
State New
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_access_valid().
Its callers now all have an attrs value to hand, so we can
correct our earlier temporary use of MEMTXATTRS_UNSPECIFIED.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 exec.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Alex Bennée May 22, 2018, 10:58 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_access_valid().
> Its callers now all have an attrs value to hand, so we can
> correct our earlier temporary use of MEMTXATTRS_UNSPECIFIED.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

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

> ---
>  exec.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/exec.c b/exec.c
> index b58eb0fedd..9229fb4058 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -2697,7 +2697,7 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
>  static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
>                                    const uint8_t *buf, int len);
>  static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
> -                                  bool is_write);
> +                                  bool is_write, MemTxAttrs attrs);
>
>  static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data,
>                                  unsigned len, MemTxAttrs attrs)
> @@ -2773,7 +2773,7 @@ static bool subpage_accepts(void *opaque, hwaddr addr,
>  #endif
>
>      return flatview_access_valid(subpage->fv, addr + subpage->base,
> -                                 len, is_write);
> +                                 len, is_write, attrs);
>  }
>
>  static const MemoryRegionOps subpage_ops = {
> @@ -3461,7 +3461,7 @@ static void cpu_notify_map_clients(void)
>  }
>
>  static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
> -                                  bool is_write)
> +                                  bool is_write, MemTxAttrs attrs)
>  {
>      MemoryRegion *mr;
>      hwaddr l, xlat;
> @@ -3472,8 +3472,7 @@ static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
>          if (!memory_access_is_direct(mr, is_write)) {
>              l = memory_access_size(mr, l, addr);
>              /* When our callers all have attrs we'll pass them through here */
> -            if (!memory_region_access_valid(mr, xlat, l, is_write,
> -                                            MEMTXATTRS_UNSPECIFIED)) {
> +            if (!memory_region_access_valid(mr, xlat, l, is_write, attrs)) {
>                  return false;
>              }
>          }
> @@ -3493,7 +3492,7 @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr,
>
>      rcu_read_lock();
>      fv = address_space_to_flatview(as);
> -    result = flatview_access_valid(fv, addr, len, is_write);
> +    result = flatview_access_valid(fv, addr, len, is_write, attrs);
>      rcu_read_unlock();
>      return result;
>  }


--
Alex Bennée
Richard Henderson May 22, 2018, 4:33 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_access_valid().
> Its callers now all have an attrs value to hand, so we can
> correct our earlier temporary use of MEMTXATTRS_UNSPECIFIED.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---

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

>              /* When our callers all have attrs we'll pass them through here */
> -            if (!memory_region_access_valid(mr, xlat, l, is_write,
> -                                            MEMTXATTRS_UNSPECIFIED)) {
> +            if (!memory_region_access_valid(mr, xlat, l, is_write, attrs)) {

Kill the temporary comment too.


r~
Peter Maydell May 22, 2018, 4:37 p.m. UTC | #3
On 22 May 2018 at 17:33, Richard Henderson <rth@twiddle.net> wrote:
> 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_access_valid().
>> Its callers now all have an attrs value to hand, so we can
>> correct our earlier temporary use of MEMTXATTRS_UNSPECIFIED.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
>>              /* When our callers all have attrs we'll pass them through here */
>> -            if (!memory_region_access_valid(mr, xlat, l, is_write,
>> -                                            MEMTXATTRS_UNSPECIFIED)) {
>> +            if (!memory_region_access_valid(mr, xlat, l, is_write, attrs)) {
>
> Kill the temporary comment too.

Oops, yes.

thanks
-- PMM
diff mbox series

Patch

diff --git a/exec.c b/exec.c
index b58eb0fedd..9229fb4058 100644
--- a/exec.c
+++ b/exec.c
@@ -2697,7 +2697,7 @@  static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
 static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
                                   const uint8_t *buf, int len);
 static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
-                                  bool is_write);
+                                  bool is_write, MemTxAttrs attrs);
 
 static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data,
                                 unsigned len, MemTxAttrs attrs)
@@ -2773,7 +2773,7 @@  static bool subpage_accepts(void *opaque, hwaddr addr,
 #endif
 
     return flatview_access_valid(subpage->fv, addr + subpage->base,
-                                 len, is_write);
+                                 len, is_write, attrs);
 }
 
 static const MemoryRegionOps subpage_ops = {
@@ -3461,7 +3461,7 @@  static void cpu_notify_map_clients(void)
 }
 
 static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
-                                  bool is_write)
+                                  bool is_write, MemTxAttrs attrs)
 {
     MemoryRegion *mr;
     hwaddr l, xlat;
@@ -3472,8 +3472,7 @@  static bool flatview_access_valid(FlatView *fv, hwaddr addr, int len,
         if (!memory_access_is_direct(mr, is_write)) {
             l = memory_access_size(mr, l, addr);
             /* When our callers all have attrs we'll pass them through here */
-            if (!memory_region_access_valid(mr, xlat, l, is_write,
-                                            MEMTXATTRS_UNSPECIFIED)) {
+            if (!memory_region_access_valid(mr, xlat, l, is_write, attrs)) {
                 return false;
             }
         }
@@ -3493,7 +3492,7 @@  bool address_space_access_valid(AddressSpace *as, hwaddr addr,
 
     rcu_read_lock();
     fv = address_space_to_flatview(as);
-    result = flatview_access_valid(fv, addr, len, is_write);
+    result = flatview_access_valid(fv, addr, len, is_write, attrs);
     rcu_read_unlock();
     return result;
 }