[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 009/113] dma: Let dma_memory_rw() propagate MemTxResult
From: |
Paolo Bonzini |
Subject: |
[PULL 009/113] dma: Let dma_memory_rw() propagate MemTxResult |
Date: |
Wed, 2 Dec 2020 03:07:05 -0500 |
From: Philippe Mathieu-Daudé <philmd@redhat.com>
address_space_rw() returns a MemTxResult type.
Do not discard it, return it to the caller.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201023151923.3243652-6-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/sysemu/dma.h | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
index 37cd9f1121..04687d8825 100644
--- a/include/sysemu/dma.h
+++ b/include/sysemu/dma.h
@@ -80,12 +80,13 @@ static inline bool dma_memory_valid(AddressSpace *as,
MEMTXATTRS_UNSPECIFIED);
}
-static inline int dma_memory_rw_relaxed(AddressSpace *as, dma_addr_t addr,
- void *buf, dma_addr_t len,
- DMADirection dir)
+static inline MemTxResult dma_memory_rw_relaxed(AddressSpace *as,
+ dma_addr_t addr,
+ void *buf, dma_addr_t len,
+ DMADirection dir)
{
- return (bool)address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED,
- buf, len, dir == DMA_DIRECTION_FROM_DEVICE);
+ return address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED,
+ buf, len, dir == DMA_DIRECTION_FROM_DEVICE);
}
static inline int dma_memory_read_relaxed(AddressSpace *as, dma_addr_t addr,
@@ -101,9 +102,22 @@ static inline int dma_memory_write_relaxed(AddressSpace
*as, dma_addr_t addr,
DMA_DIRECTION_FROM_DEVICE);
}
-static inline int dma_memory_rw(AddressSpace *as, dma_addr_t addr,
- void *buf, dma_addr_t len,
- DMADirection dir)
+/**
+ * dma_memory_rw: Read from or write to an address space from DMA controller.
+ *
+ * Return a MemTxResult indicating whether the operation succeeded
+ * or failed (eg unassigned memory, device rejected the transaction,
+ * IOMMU fault).
+ *
+ * @as: #AddressSpace to be accessed
+ * @addr: address within that address space
+ * @buf: buffer with the data transferred
+ * @len: the number of bytes to read or write
+ * @dir: indicates the transfer direction
+ */
+static inline MemTxResult dma_memory_rw(AddressSpace *as, dma_addr_t addr,
+ void *buf, dma_addr_t len,
+ DMADirection dir)
{
dma_barrier(as, dir);
--
2.26.2
- [PULL 000/113] First batch of misc (i386, kernel-doc, memory, vl.c) changes for QEMU 6.0, Paolo Bonzini, 2020/12/02
- [PULL 003/113] target/i386: seg_helper: Correct segement selector nullification in the RET/IRET helper, Paolo Bonzini, 2020/12/02
- [PULL 002/113] target/i386: Support up to 32768 CPUs without IRQ remapping, Paolo Bonzini, 2020/12/02
- [PULL 005/113] docs/devel/loads-stores: Add regexp for DMA functions, Paolo Bonzini, 2020/12/02
- [PULL 008/113] dma: Let dma_memory_set() propagate MemTxResult, Paolo Bonzini, 2020/12/02
- [PULL 001/113] target/i386: fix operand order for PDEP and PEXT, Paolo Bonzini, 2020/12/02
- [PULL 009/113] dma: Let dma_memory_rw() propagate MemTxResult,
Paolo Bonzini <=
- [PULL 004/113] WHPX: support for the kernel-irqchip on/off, Paolo Bonzini, 2020/12/02
- [PULL 007/113] dma: Document address_space_map/address_space_unmap() prototypes, Paolo Bonzini, 2020/12/02
- [PULL 013/113] pci: Let pci_dma_read() propagate MemTxResult, Paolo Bonzini, 2020/12/02
- [PULL 014/113] pci: Let pci_dma_write() propagate MemTxResult, Paolo Bonzini, 2020/12/02
- [PULL 006/113] qom: eliminate identical functions, Paolo Bonzini, 2020/12/02
- [PULL 012/113] pci: Let pci_dma_rw() propagate MemTxResult, Paolo Bonzini, 2020/12/02
- [PULL 010/113] dma: Let dma_memory_read() propagate MemTxResult, Paolo Bonzini, 2020/12/02
- [PULL 011/113] dma: Let dma_memory_write() propagate MemTxResult, Paolo Bonzini, 2020/12/02
- [PULL 015/113] hw/ssi/aspeed_smc: Rename 'max_slaves' variable as 'max_peripherals', Paolo Bonzini, 2020/12/02
- [PULL 019/113] hw/dma/xilinx_axidma: Rename StreamSlave as StreamSink, Paolo Bonzini, 2020/12/02