[PATCH] tools/virtio: Add DMA_MAPPING_ERROR define for virtio test
From: Yufeng Wang
Date: Mon Jan 13 2025 - 04:04:15 EST
Fixes: <c7e1b422afac>("virtio_ring: perform premapped operations based on per-buffer")
also add DMA_MAPPING_ERROR define for virtio test.
Signed-off-by: Yufeng Wang <wangyufeng@xxxxxxxxxx>
---
tools/virtio/linux/dma-mapping.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tools/virtio/linux/dma-mapping.h b/tools/virtio/linux/dma-mapping.h
index 822ecaa8e4df..6e6e443c53d4 100644
--- a/tools/virtio/linux/dma-mapping.h
+++ b/tools/virtio/linux/dma-mapping.h
@@ -43,4 +43,16 @@ enum dma_data_direction {
} while (0)
#define dma_max_mapping_size(...) SIZE_MAX
+/*
+ * A dma_addr_t can hold any valid DMA or bus address for the platform. It can
+ * be given to a device to use as a DMA source or target. It is specific to a
+ * given device and there may be a translation between the CPU physical address
+ * space and the bus address space.
+ *
+ * DMA_MAPPING_ERROR is the magic error code if a mapping failed. It should not
+ * be used directly in drivers, but checked for using dma_mapping_error()
+ * instead.
+ */
+#define DMA_MAPPING_ERROR (~(dma_addr_t)0)
+
#endif
--
2.34.1