.. | .. |
---|
15 | 15 | #include <linux/mman.h> |
---|
16 | 16 | #include <linux/mmu_notifier.h> |
---|
17 | 17 | #include <linux/types.h> |
---|
| 18 | +#include <xen/interface/event_channel.h> |
---|
| 19 | +#include <xen/grant_table.h> |
---|
18 | 20 | |
---|
19 | 21 | struct gntdev_dmabuf_priv; |
---|
20 | 22 | |
---|
21 | 23 | struct gntdev_priv { |
---|
22 | 24 | /* Maps with visible offsets in the file descriptor. */ |
---|
23 | 25 | 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; |
---|
29 | 26 | /* lock protects maps and freeable_maps. */ |
---|
30 | 27 | struct mutex lock; |
---|
31 | | - struct mm_struct *mm; |
---|
32 | | - struct mmu_notifier mn; |
---|
33 | 28 | |
---|
34 | 29 | #ifdef CONFIG_XEN_GRANT_DMA_ALLOC |
---|
35 | 30 | /* Device for which DMA memory is allocated. */ |
---|
.. | .. |
---|
45 | 40 | int flags; |
---|
46 | 41 | /* Address relative to the start of the gntdev_grant_map. */ |
---|
47 | 42 | int addr; |
---|
48 | | - int event; |
---|
| 43 | + evtchn_port_t event; |
---|
49 | 44 | }; |
---|
50 | 45 | |
---|
51 | 46 | struct gntdev_grant_map { |
---|
| 47 | + atomic_t in_use; |
---|
| 48 | + struct mmu_interval_notifier notifier; |
---|
| 49 | + bool notifier_init; |
---|
52 | 50 | struct list_head next; |
---|
53 | | - struct vm_area_struct *vma; |
---|
54 | 51 | int index; |
---|
55 | 52 | int count; |
---|
56 | 53 | int flags; |
---|
.. | .. |
---|
61 | 58 | struct gnttab_unmap_grant_ref *unmap_ops; |
---|
62 | 59 | struct gnttab_map_grant_ref *kmap_ops; |
---|
63 | 60 | struct gnttab_unmap_grant_ref *kunmap_ops; |
---|
| 61 | + bool *being_removed; |
---|
64 | 62 | struct page **pages; |
---|
65 | 63 | unsigned long pages_vm_start; |
---|
66 | 64 | |
---|
.. | .. |
---|
78 | 76 | /* Needed to avoid allocation in gnttab_dma_free_pages(). */ |
---|
79 | 77 | xen_pfn_t *frames; |
---|
80 | 78 | #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; |
---|
81 | 84 | }; |
---|
82 | 85 | |
---|
83 | 86 | struct gntdev_grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count, |
---|
.. | .. |
---|
87 | 90 | |
---|
88 | 91 | void gntdev_put_map(struct gntdev_priv *priv, struct gntdev_grant_map *map); |
---|
89 | 92 | |
---|
90 | | -bool gntdev_account_mapped_pages(int count); |
---|
| 93 | +bool gntdev_test_page_count(unsigned int count); |
---|
91 | 94 | |
---|
92 | 95 | int gntdev_map_grant_pages(struct gntdev_grant_map *map); |
---|
93 | 96 | |
---|