diff mbox series

[10/13] dma: Let dma_memory_rw_relaxed() take MemTxAttrs argument

Message ID 20200904154439.643272-11-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series dma: Let the DMA API take MemTxAttrs argument and propagate MemTxResult | expand

Commit Message

Philippe Mathieu-Daudé Sept. 4, 2020, 3:44 p.m. UTC
We will add the MemTxAttrs argument to dma_memory_rw() in
the next commit. Since dma_memory_rw_relaxed() is only used
by dma_memory_rw(), modify it first in a separate commit to
keep the next commit easier to review.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 include/sysemu/dma.h | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Richard Henderson Sept. 6, 2020, 4:01 a.m. UTC | #1
On 9/4/20 8:44 AM, Philippe Mathieu-Daudé wrote:
> We will add the MemTxAttrs argument to dma_memory_rw() in
> the next commit. Since dma_memory_rw_relaxed() is only used
> by dma_memory_rw(), modify it first in a separate commit to
> keep the next commit easier to review.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  include/sysemu/dma.h | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)

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

r~
Li Qiang Sept. 7, 2020, 1:14 a.m. UTC | #2
Philippe Mathieu-Daudé <philmd@redhat.com> 于2020年9月4日周五 下午11:53写道:
>
> We will add the MemTxAttrs argument to dma_memory_rw() in
> the next commit. Since dma_memory_rw_relaxed() is only used
> by dma_memory_rw(), modify it first in a separate commit to
> keep the next commit easier to review.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Li Qiang <liq3ea@gmail.com>

> ---
>  include/sysemu/dma.h | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
> index d0381f9ae9b..59331ec0bd3 100644
> --- a/include/sysemu/dma.h
> +++ b/include/sysemu/dma.h
> @@ -83,9 +83,10 @@ static inline bool dma_memory_valid(AddressSpace *as,
>  static inline MemTxResult dma_memory_rw_relaxed(AddressSpace *as,
>                                                  dma_addr_t addr,
>                                                  void *buf, dma_addr_t len,
> -                                                DMADirection dir)
> +                                                DMADirection dir,
> +                                                MemTxAttrs attrs)
>  {
> -    return address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED,
> +    return address_space_rw(as, addr, attrs,
>                              buf, len, dir == DMA_DIRECTION_FROM_DEVICE);
>  }
>
> @@ -93,7 +94,9 @@ static inline MemTxResult dma_memory_read_relaxed(AddressSpace *as,
>                                                    dma_addr_t addr,
>                                                    void *buf, dma_addr_t len)
>  {
> -    return dma_memory_rw_relaxed(as, addr, buf, len, DMA_DIRECTION_TO_DEVICE);
> +    return dma_memory_rw_relaxed(as, addr, buf, len,
> +                                 DMA_DIRECTION_TO_DEVICE,
> +                                 MEMTXATTRS_UNSPECIFIED);
>  }
>
>  static inline MemTxResult dma_memory_write_relaxed(AddressSpace *as,
> @@ -102,7 +105,8 @@ static inline MemTxResult dma_memory_write_relaxed(AddressSpace *as,
>                                                     dma_addr_t len)
>  {
>      return dma_memory_rw_relaxed(as, addr, (void *)buf, len,
> -                                 DMA_DIRECTION_FROM_DEVICE);
> +                                 DMA_DIRECTION_FROM_DEVICE,
> +                                 MEMTXATTRS_UNSPECIFIED);
>  }
>
>  /**
> @@ -124,7 +128,8 @@ static inline MemTxResult dma_memory_rw(AddressSpace *as, dma_addr_t addr,
>  {
>      dma_barrier(as, dir);
>
> -    return dma_memory_rw_relaxed(as, addr, buf, len, dir);
> +    return dma_memory_rw_relaxed(as, addr, buf, len, dir,
> +                                 MEMTXATTRS_UNSPECIFIED);
>  }
>
>  /**
> --
> 2.26.2
>
>
diff mbox series

Patch

diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
index d0381f9ae9b..59331ec0bd3 100644
--- a/include/sysemu/dma.h
+++ b/include/sysemu/dma.h
@@ -83,9 +83,10 @@  static inline bool dma_memory_valid(AddressSpace *as,
 static inline MemTxResult dma_memory_rw_relaxed(AddressSpace *as,
                                                 dma_addr_t addr,
                                                 void *buf, dma_addr_t len,
-                                                DMADirection dir)
+                                                DMADirection dir,
+                                                MemTxAttrs attrs)
 {
-    return address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED,
+    return address_space_rw(as, addr, attrs,
                             buf, len, dir == DMA_DIRECTION_FROM_DEVICE);
 }
 
@@ -93,7 +94,9 @@  static inline MemTxResult dma_memory_read_relaxed(AddressSpace *as,
                                                   dma_addr_t addr,
                                                   void *buf, dma_addr_t len)
 {
-    return dma_memory_rw_relaxed(as, addr, buf, len, DMA_DIRECTION_TO_DEVICE);
+    return dma_memory_rw_relaxed(as, addr, buf, len,
+                                 DMA_DIRECTION_TO_DEVICE,
+                                 MEMTXATTRS_UNSPECIFIED);
 }
 
 static inline MemTxResult dma_memory_write_relaxed(AddressSpace *as,
@@ -102,7 +105,8 @@  static inline MemTxResult dma_memory_write_relaxed(AddressSpace *as,
                                                    dma_addr_t len)
 {
     return dma_memory_rw_relaxed(as, addr, (void *)buf, len,
-                                 DMA_DIRECTION_FROM_DEVICE);
+                                 DMA_DIRECTION_FROM_DEVICE,
+                                 MEMTXATTRS_UNSPECIFIED);
 }
 
 /**
@@ -124,7 +128,8 @@  static inline MemTxResult dma_memory_rw(AddressSpace *as, dma_addr_t addr,
 {
     dma_barrier(as, dir);
 
-    return dma_memory_rw_relaxed(as, addr, buf, len, dir);
+    return dma_memory_rw_relaxed(as, addr, buf, len, dir,
+                                 MEMTXATTRS_UNSPECIFIED);
 }
 
 /**