drm/panel-edp: Add STA 116QHD024002
[drm/drm-misc.git] / include / linux / iova_bitmap.h
blob1c338f5e5b7a62027290b44ad47c4a74d84706ac
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_
9 #include <linux/types.h>
10 #include <linux/errno.h>
12 struct iova_bitmap;
14 typedef int (*iova_bitmap_fn_t)(struct iova_bitmap *bitmap,
15 unsigned long iova, size_t length,
16 void *opaque);
18 #if IS_ENABLED(CONFIG_IOMMUFD_DRIVER)
19 struct iova_bitmap *iova_bitmap_alloc(unsigned long iova, size_t length,
20 unsigned long page_size,
21 u64 __user *data);
22 void iova_bitmap_free(struct iova_bitmap *bitmap);
23 int iova_bitmap_for_each(struct iova_bitmap *bitmap, void *opaque,
24 iova_bitmap_fn_t fn);
25 void iova_bitmap_set(struct iova_bitmap *bitmap,
26 unsigned long iova, size_t length);
27 #else
28 static inline struct iova_bitmap *iova_bitmap_alloc(unsigned long iova,
29 size_t length,
30 unsigned long page_size,
31 u64 __user *data)
33 return NULL;
36 static inline void iova_bitmap_free(struct iova_bitmap *bitmap)
40 static inline int iova_bitmap_for_each(struct iova_bitmap *bitmap, void *opaque,
41 iova_bitmap_fn_t fn)
43 return -EOPNOTSUPP;
46 static inline void iova_bitmap_set(struct iova_bitmap *bitmap,
47 unsigned long iova, size_t length)
50 #endif
52 #endif