1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2022, Oracle and/or its affiliates.
4  * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved
5  */
6 #ifndef _IOVA_BITMAP_H_
7 #define _IOVA_BITMAP_H_
8 
9 #include <linux/types.h>
10 
11 struct iova_bitmap;
12 
13 typedef int (*iova_bitmap_fn_t)(struct iova_bitmap *bitmap,
14 				unsigned long iova, size_t length,
15 				void *opaque);
16 
17 struct iova_bitmap *iova_bitmap_alloc(unsigned long iova, size_t length,
18 				      unsigned long page_size,
19 				      u64 __user *data);
20 void iova_bitmap_free(struct iova_bitmap *bitmap);
21 int iova_bitmap_for_each(struct iova_bitmap *bitmap, void *opaque,
22 			 iova_bitmap_fn_t fn);
23 void iova_bitmap_set(struct iova_bitmap *bitmap,
24 		     unsigned long iova, size_t length);
25 
26 #endif
27