diff mbox series

[04/12] dma: Let dma_memory_rw_relaxed() take MemTxAttrs argument

Message ID 20200903110831.353476-5-philmd@redhat.com
State New
Headers show
Series hw: Forbid DMA write accesses to MMIO regions | expand

Commit Message

Philippe Mathieu-Daudé Sept. 3, 2020, 11:08 a.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 include/sysemu/dma.h | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
index 34f957cc278..6068323e48f 100644
--- a/include/sysemu/dma.h
+++ b/include/sysemu/dma.h
@@ -82,23 +82,26 @@  static inline bool dma_memory_valid(AddressSpace *as,
 
 static inline int dma_memory_rw_relaxed(AddressSpace *as, dma_addr_t addr,
                                         void *buf, dma_addr_t len,
-                                        DMADirection dir)
+                                        DMADirection dir, MemTxAttrs attrs)
 {
-    return (bool)address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED,
+    return (bool)address_space_rw(as, addr, attrs,
                                   buf, len, dir == DMA_DIRECTION_FROM_DEVICE);
 }
 
 static inline int 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 int dma_memory_write_relaxed(AddressSpace *as, dma_addr_t addr,
                                            const void *buf, dma_addr_t len)
 {
     return dma_memory_rw_relaxed(as, addr, (void *)buf, len,
-                                 DMA_DIRECTION_FROM_DEVICE);
+                                 DMA_DIRECTION_FROM_DEVICE,
+                                 MEMTXATTRS_UNSPECIFIED);
 }
 
 static inline int dma_memory_rw(AddressSpace *as, dma_addr_t addr,
@@ -107,7 +110,8 @@  static inline int 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);
 }
 
 static inline int dma_memory_read(AddressSpace *as, dma_addr_t addr,