From 75f01c68b5c630a9a6b21b93febf3a871a9111ba Mon Sep 17 00:00:00 2001 From: Philippe Mathieu-Daudé Date: Sat, 15 Jan 2022 21:37:23 +0100 Subject: exec/memory: Extract address_space_set() from dma_memory_set() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dma_memory_set() does a DMA barrier, set the address space with a constant value. The constant value filling code is not specific to DMA and can be used for AddressSpace. Extract it as a new helper: address_space_set(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Reviewed-by: Stefano Garzarella Reviewed-by: Richard Henderson [lv: rebase] Signed-off-by: Laurent Vivier Reviewed-by: David Hildenbrand Reviewed-by: Peter Xu Message-Id: <20220115203725.3834712-2-laurent@vivier.eu> --- include/exec/memory.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/exec/memory.h') diff --git a/include/exec/memory.h b/include/exec/memory.h index 63be794a06..4d5997e6bb 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -2908,6 +2908,22 @@ address_space_write_cached(MemoryRegionCache *cache, hwaddr addr, } } +/** + * address_space_set: Fill address space with a constant byte. + * + * 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 + * @c: constant byte to fill the memory + * @len: the number of bytes to fill with the constant byte + * @attrs: memory transaction attributes + */ +MemTxResult address_space_set(AddressSpace *as, hwaddr addr, + uint8_t c, hwaddr len, MemTxAttrs attrs); + #ifdef NEED_CPU_H /* enum device_endian to MemOp. */ static inline MemOp devend_memop(enum device_endian end) -- cgit 1.4.1