mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 14:23:49 +01:00
Patch series "tools: Fix tools/virtio test build", v2. This series fixes build failures hit by: make -C tools/virtio test Patch 1 adds tools/virtio compatibility definitions needed by current virtio headers when building the tools/virtio tests. Patch 2 makes tools/include/linux/overflow.h include stdint.h for SIZE_MAX, which is used by its size helper functions. With the series applied, make -C tools/virtio test builds virtio_test, vringh_test and vhost_net_test successfully. Tested on x86_64 and arm64 with: make -C tools/virtio clean make -C tools/virtio test This patch (of 2): vhost_net_test builds virtio_ring.c in userspace. Recent virtio headers pull in helper headers that are not provided by the tools/virtio compatibility layer, including asm/percpu_types.h, linux/completion.h, linux/mod_devicetable.h and linux/virtio_features.h. Add the missing compat definitions and the DMA attribute used by the current virtio ring code. Link: https://lore.kernel.org/[email protected] Link: https://lore.kernel.org/[email protected] Signed-off-by: Yichong Chen <[email protected]> Acked-by: Eugenio Pérez <[email protected]> Cc: chenyichong <[email protected]> Cc: Jason Wang <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: "Michael S. Tsirkin" <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Xuan Zhuo <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
67 lines
2.2 KiB
C
67 lines
2.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_DMA_MAPPING_H
|
|
#define _LINUX_DMA_MAPPING_H
|
|
|
|
#ifdef CONFIG_HAS_DMA
|
|
# error Virtio userspace code does not support CONFIG_HAS_DMA
|
|
#endif
|
|
|
|
enum dma_data_direction {
|
|
DMA_BIDIRECTIONAL = 0,
|
|
DMA_TO_DEVICE = 1,
|
|
DMA_FROM_DEVICE = 2,
|
|
DMA_NONE = 3,
|
|
};
|
|
|
|
#define dma_alloc_coherent(d, s, hp, f) ({ \
|
|
void *__dma_alloc_coherent_p = kmalloc((s), (f)); \
|
|
*(hp) = (unsigned long)__dma_alloc_coherent_p; \
|
|
__dma_alloc_coherent_p; \
|
|
})
|
|
|
|
#define dma_free_coherent(d, s, p, h) kfree(p)
|
|
|
|
#define dma_map_page(d, p, o, s, dir) (page_to_phys(p) + (o))
|
|
#define dma_map_page_attrs(d, p, o, s, dir, a) (page_to_phys(p) + (o))
|
|
|
|
#define dma_map_single(d, p, s, dir) (virt_to_phys(p))
|
|
#define dma_map_single_attrs(d, p, s, dir, a) (virt_to_phys(p))
|
|
#define dma_mapping_error(...) (0)
|
|
|
|
#define dma_unmap_single(d, a, s, r) do { (void)(d); (void)(a); (void)(s); (void)(r); } while (0)
|
|
#define dma_unmap_page(d, a, s, r) do { (void)(d); (void)(a); (void)(s); (void)(r); } while (0)
|
|
#define dma_unmap_page_attrs(d, a, s, r, t) do { \
|
|
(void)(d); (void)(a); (void)(s); (void)(r); (void)(t); \
|
|
} while (0)
|
|
|
|
#define sg_dma_address(sg) (0)
|
|
#define sg_dma_len(sg) (0)
|
|
#define dma_need_sync(v, a) (0)
|
|
#define dma_unmap_single_attrs(d, a, s, r, t) do { \
|
|
(void)(d); (void)(a); (void)(s); (void)(r); (void)(t); \
|
|
} while (0)
|
|
#define dma_sync_single_range_for_cpu(d, a, o, s, r) do { \
|
|
(void)(d); (void)(a); (void)(o); (void)(s); (void)(r); \
|
|
} while (0)
|
|
#define dma_sync_single_range_for_device(d, a, o, s, r) do { \
|
|
(void)(d); (void)(a); (void)(o); (void)(s); (void)(r); \
|
|
} 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)
|
|
|
|
#define DMA_ATTR_CPU_CACHE_CLEAN (1UL << 11)
|
|
#define DMA_ATTR_DEBUGGING_IGNORE_CACHELINES 0
|
|
|
|
#endif
|