hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/xen/gntdev-common.h
....@@ -15,21 +15,16 @@
1515 #include <linux/mman.h>
1616 #include <linux/mmu_notifier.h>
1717 #include <linux/types.h>
18
+#include <xen/interface/event_channel.h>
19
+#include <xen/grant_table.h>
1820
1921 struct gntdev_dmabuf_priv;
2022
2123 struct gntdev_priv {
2224 /* Maps with visible offsets in the file descriptor. */
2325 struct list_head maps;
24
- /*
25
- * Maps that are not visible; will be freed on munmap.
26
- * Only populated if populate_freeable_maps == 1
27
- */
28
- struct list_head freeable_maps;
2926 /* lock protects maps and freeable_maps. */
3027 struct mutex lock;
31
- struct mm_struct *mm;
32
- struct mmu_notifier mn;
3328
3429 #ifdef CONFIG_XEN_GRANT_DMA_ALLOC
3530 /* Device for which DMA memory is allocated. */
....@@ -45,12 +40,14 @@
4540 int flags;
4641 /* Address relative to the start of the gntdev_grant_map. */
4742 int addr;
48
- int event;
43
+ evtchn_port_t event;
4944 };
5045
5146 struct gntdev_grant_map {
47
+ atomic_t in_use;
48
+ struct mmu_interval_notifier notifier;
49
+ bool notifier_init;
5250 struct list_head next;
53
- struct vm_area_struct *vma;
5451 int index;
5552 int count;
5653 int flags;
....@@ -61,6 +58,7 @@
6158 struct gnttab_unmap_grant_ref *unmap_ops;
6259 struct gnttab_map_grant_ref *kmap_ops;
6360 struct gnttab_unmap_grant_ref *kunmap_ops;
61
+ bool *being_removed;
6462 struct page **pages;
6563 unsigned long pages_vm_start;
6664
....@@ -78,6 +76,11 @@
7876 /* Needed to avoid allocation in gnttab_dma_free_pages(). */
7977 xen_pfn_t *frames;
8078 #endif
79
+
80
+ /* Number of live grants */
81
+ atomic_t live_grants;
82
+ /* Needed to avoid allocation in __unmap_grant_pages */
83
+ struct gntab_unmap_queue_data unmap_data;
8184 };
8285
8386 struct gntdev_grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count,
....@@ -87,7 +90,7 @@
8790
8891 void gntdev_put_map(struct gntdev_priv *priv, struct gntdev_grant_map *map);
8992
90
-bool gntdev_account_mapped_pages(int count);
93
+bool gntdev_test_page_count(unsigned int count);
9194
9295 int gntdev_map_grant_pages(struct gntdev_grant_map *map);
9396