6f544b6d70a383232efe44e4d02e8eea3c943b02
[linux-2.6-microblaze.git] / include / drm / ttm / ttm_bo_api.h
1 /**************************************************************************
2  *
3  * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial portions
16  * of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24  * USE OR OTHER DEALINGS IN THE SOFTWARE.
25  *
26  **************************************************************************/
27 /*
28  * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29  */
30
31 #ifndef _TTM_BO_API_H_
32 #define _TTM_BO_API_H_
33
34 #include <drm/drm_gem.h>
35 #include <drm/drm_hashtab.h>
36 #include <drm/drm_vma_manager.h>
37 #include <linux/kref.h>
38 #include <linux/list.h>
39 #include <linux/wait.h>
40 #include <linux/mutex.h>
41 #include <linux/mm.h>
42 #include <linux/bitmap.h>
43 #include <linux/dma-resv.h>
44
45 #include "ttm_resource.h"
46
47 struct ttm_bo_global;
48
49 struct ttm_bo_device;
50
51 struct drm_mm_node;
52
53 struct ttm_placement;
54
55 struct ttm_place;
56
57 struct ttm_lru_bulk_move;
58
59 /**
60  * enum ttm_bo_type
61  *
62  * @ttm_bo_type_device: These are 'normal' buffers that can
63  * be mmapped by user space. Each of these bos occupy a slot in the
64  * device address space, that can be used for normal vm operations.
65  *
66  * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers,
67  * but they cannot be accessed from user-space. For kernel-only use.
68  *
69  * @ttm_bo_type_sg: Buffer made from dmabuf sg table shared with another
70  * driver.
71  */
72
73 enum ttm_bo_type {
74         ttm_bo_type_device,
75         ttm_bo_type_kernel,
76         ttm_bo_type_sg
77 };
78
79 struct ttm_tt;
80
81 /**
82  * struct ttm_buffer_object
83  *
84  * @base: drm_gem_object superclass data.
85  * @bdev: Pointer to the buffer object device structure.
86  * @type: The bo type.
87  * @destroy: Destruction function. If NULL, kfree is used.
88  * @num_pages: Actual number of pages.
89  * @acc_size: Accounted size for this object.
90  * @kref: Reference count of this buffer object. When this refcount reaches
91  * zero, the object is destroyed or put on the delayed delete list.
92  * @mem: structure describing current placement.
93  * @persistent_swap_storage: Usually the swap storage is deleted for buffers
94  * pinned in physical memory. If this behaviour is not desired, this member
95  * holds a pointer to a persistent shmem object.
96  * @ttm: TTM structure holding system pages.
97  * @evicted: Whether the object was evicted without user-space knowing.
98  * @deleted: True if the object is only a zombie and already deleted.
99  * @lru: List head for the lru list.
100  * @ddestroy: List head for the delayed destroy list.
101  * @swap: List head for swap LRU list.
102  * @moving: Fence set when BO is moving
103  * @offset: The current GPU offset, which can have different meanings
104  * depending on the memory type. For SYSTEM type memory, it should be 0.
105  * @cur_placement: Hint of current placement.
106  *
107  * Base class for TTM buffer object, that deals with data placement and CPU
108  * mappings. GPU mappings are really up to the driver, but for simpler GPUs
109  * the driver can usually use the placement offset @offset directly as the
110  * GPU virtual address. For drivers implementing multiple
111  * GPU memory manager contexts, the driver should manage the address space
112  * in these contexts separately and use these objects to get the correct
113  * placement and caching for these GPU maps. This makes it possible to use
114  * these objects for even quite elaborate memory management schemes.
115  * The destroy member, the API visibility of this object makes it possible
116  * to derive driver specific types.
117  */
118
119 struct ttm_buffer_object {
120         struct drm_gem_object base;
121
122         /**
123          * Members constant at init.
124          */
125
126         struct ttm_bo_device *bdev;
127         enum ttm_bo_type type;
128         void (*destroy) (struct ttm_buffer_object *);
129         unsigned long num_pages;
130         size_t acc_size;
131
132         /**
133         * Members not needing protection.
134         */
135         struct kref kref;
136
137         /**
138          * Members protected by the bo::resv::reserved lock.
139          */
140
141         struct ttm_resource mem;
142         struct file *persistent_swap_storage;
143         struct ttm_tt *ttm;
144         bool deleted;
145
146         /**
147          * Members protected by the bdev::lru_lock.
148          */
149
150         struct list_head lru;
151         struct list_head ddestroy;
152         struct list_head swap;
153
154         /**
155          * Members protected by a bo reservation.
156          */
157
158         struct dma_fence *moving;
159         unsigned priority;
160
161         /**
162          * Special members that are protected by the reserve lock
163          * and the bo::lock when written to. Can be read with
164          * either of these locks held.
165          */
166
167         struct sg_table *sg;
168 };
169
170 /**
171  * struct ttm_bo_kmap_obj
172  *
173  * @virtual: The current kernel virtual address.
174  * @page: The page when kmap'ing a single page.
175  * @bo_kmap_type: Type of bo_kmap.
176  *
177  * Object describing a kernel mapping. Since a TTM bo may be located
178  * in various memory types with various caching policies, the
179  * mapping can either be an ioremap, a vmap, a kmap or part of a
180  * premapped region.
181  */
182
183 #define TTM_BO_MAP_IOMEM_MASK 0x80
184 struct ttm_bo_kmap_obj {
185         void *virtual;
186         struct page *page;
187         enum {
188                 ttm_bo_map_iomap        = 1 | TTM_BO_MAP_IOMEM_MASK,
189                 ttm_bo_map_vmap         = 2,
190                 ttm_bo_map_kmap         = 3,
191                 ttm_bo_map_premapped    = 4 | TTM_BO_MAP_IOMEM_MASK,
192         } bo_kmap_type;
193         struct ttm_buffer_object *bo;
194 };
195
196 /**
197  * struct ttm_operation_ctx
198  *
199  * @interruptible: Sleep interruptible if sleeping.
200  * @no_wait_gpu: Return immediately if the GPU is busy.
201  * @resv: Reservation object to allow reserved evictions with.
202  * @flags: Including the following flags
203  *
204  * Context for TTM operations like changing buffer placement or general memory
205  * allocation.
206  */
207 struct ttm_operation_ctx {
208         bool interruptible;
209         bool no_wait_gpu;
210         struct dma_resv *resv;
211         uint64_t bytes_moved;
212         uint32_t flags;
213 };
214
215 /* Allow eviction of reserved BOs */
216 #define TTM_OPT_FLAG_ALLOW_RES_EVICT            0x1
217 /* when serving page fault or suspend, allow alloc anyway */
218 #define TTM_OPT_FLAG_FORCE_ALLOC                0x2
219
220 /**
221  * ttm_bo_get - reference a struct ttm_buffer_object
222  *
223  * @bo: The buffer object.
224  */
225 static inline void ttm_bo_get(struct ttm_buffer_object *bo)
226 {
227         kref_get(&bo->kref);
228 }
229
230 /**
231  * ttm_bo_get_unless_zero - reference a struct ttm_buffer_object unless
232  * its refcount has already reached zero.
233  * @bo: The buffer object.
234  *
235  * Used to reference a TTM buffer object in lookups where the object is removed
236  * from the lookup structure during the destructor and for RCU lookups.
237  *
238  * Returns: @bo if the referencing was successful, NULL otherwise.
239  */
240 static inline __must_check struct ttm_buffer_object *
241 ttm_bo_get_unless_zero(struct ttm_buffer_object *bo)
242 {
243         if (!kref_get_unless_zero(&bo->kref))
244                 return NULL;
245         return bo;
246 }
247
248 /**
249  * ttm_bo_wait - wait for buffer idle.
250  *
251  * @bo:  The buffer object.
252  * @interruptible:  Use interruptible wait.
253  * @no_wait:  Return immediately if buffer is busy.
254  *
255  * This function must be called with the bo::mutex held, and makes
256  * sure any previous rendering to the buffer is completed.
257  * Note: It might be necessary to block validations before the
258  * wait by reserving the buffer.
259  * Returns -EBUSY if no_wait is true and the buffer is busy.
260  * Returns -ERESTARTSYS if interrupted by a signal.
261  */
262 int ttm_bo_wait(struct ttm_buffer_object *bo, bool interruptible, bool no_wait);
263
264 static inline int ttm_bo_wait_ctx(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx)
265 {
266         return ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu);
267 }
268
269 /**
270  * ttm_bo_mem_compat - Check if proposed placement is compatible with a bo
271  *
272  * @placement:  Return immediately if buffer is busy.
273  * @mem:  The struct ttm_resource indicating the region where the bo resides
274  * @new_flags: Describes compatible placement found
275  *
276  * Returns true if the placement is compatible
277  */
278 bool ttm_bo_mem_compat(struct ttm_placement *placement, struct ttm_resource *mem,
279                        uint32_t *new_flags);
280
281 /**
282  * ttm_bo_validate
283  *
284  * @bo: The buffer object.
285  * @placement: Proposed placement for the buffer object.
286  * @ctx: validation parameters.
287  *
288  * Changes placement and caching policy of the buffer object
289  * according proposed placement.
290  * Returns
291  * -EINVAL on invalid proposed placement.
292  * -ENOMEM on out-of-memory condition.
293  * -EBUSY if no_wait is true and buffer busy.
294  * -ERESTARTSYS if interrupted by a signal.
295  */
296 int ttm_bo_validate(struct ttm_buffer_object *bo,
297                     struct ttm_placement *placement,
298                     struct ttm_operation_ctx *ctx);
299
300 /**
301  * ttm_bo_put
302  *
303  * @bo: The buffer object.
304  *
305  * Unreference a buffer object.
306  */
307 void ttm_bo_put(struct ttm_buffer_object *bo);
308
309 /**
310  * ttm_bo_move_to_lru_tail
311  *
312  * @bo: The buffer object.
313  * @bulk: optional bulk move structure to remember BO positions
314  *
315  * Move this BO to the tail of all lru lists used to lookup and reserve an
316  * object. This function must be called with struct ttm_bo_global::lru_lock
317  * held, and is used to make a BO less likely to be considered for eviction.
318  */
319 void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo,
320                              struct ttm_lru_bulk_move *bulk);
321
322 /**
323  * ttm_bo_bulk_move_lru_tail
324  *
325  * @bulk: bulk move structure
326  *
327  * Bulk move BOs to the LRU tail, only valid to use when driver makes sure that
328  * BO order never changes. Should be called with ttm_bo_global::lru_lock held.
329  */
330 void ttm_bo_bulk_move_lru_tail(struct ttm_lru_bulk_move *bulk);
331
332 /**
333  * ttm_bo_lock_delayed_workqueue
334  *
335  * Prevent the delayed workqueue from running.
336  * Returns
337  * True if the workqueue was queued at the time
338  */
339 int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev);
340
341 /**
342  * ttm_bo_unlock_delayed_workqueue
343  *
344  * Allows the delayed workqueue to run.
345  */
346 void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev, int resched);
347
348 /**
349  * ttm_bo_eviction_valuable
350  *
351  * @bo: The buffer object to evict
352  * @place: the placement we need to make room for
353  *
354  * Check if it is valuable to evict the BO to make room for the given placement.
355  */
356 bool ttm_bo_eviction_valuable(struct ttm_buffer_object *bo,
357                               const struct ttm_place *place);
358
359 size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev,
360                            unsigned long bo_size,
361                            unsigned struct_size);
362
363 /**
364  * ttm_bo_init_reserved
365  *
366  * @bdev: Pointer to a ttm_bo_device struct.
367  * @bo: Pointer to a ttm_buffer_object to be initialized.
368  * @size: Requested size of buffer object.
369  * @type: Requested type of buffer object.
370  * @flags: Initial placement flags.
371  * @page_alignment: Data alignment in pages.
372  * @ctx: TTM operation context for memory allocation.
373  * @acc_size: Accounted size for this object.
374  * @resv: Pointer to a dma_resv, or NULL to let ttm allocate one.
375  * @destroy: Destroy function. Use NULL for kfree().
376  *
377  * This function initializes a pre-allocated struct ttm_buffer_object.
378  * As this object may be part of a larger structure, this function,
379  * together with the @destroy function,
380  * enables driver-specific objects derived from a ttm_buffer_object.
381  *
382  * On successful return, the caller owns an object kref to @bo. The kref and
383  * list_kref are usually set to 1, but note that in some situations, other
384  * tasks may already be holding references to @bo as well.
385  * Furthermore, if resv == NULL, the buffer's reservation lock will be held,
386  * and it is the caller's responsibility to call ttm_bo_unreserve.
387  *
388  * If a failure occurs, the function will call the @destroy function, or
389  * kfree() if @destroy is NULL. Thus, after a failure, dereferencing @bo is
390  * illegal and will likely cause memory corruption.
391  *
392  * Returns
393  * -ENOMEM: Out of memory.
394  * -EINVAL: Invalid placement flags.
395  * -ERESTARTSYS: Interrupted by signal while sleeping waiting for resources.
396  */
397
398 int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
399                          struct ttm_buffer_object *bo,
400                          unsigned long size,
401                          enum ttm_bo_type type,
402                          struct ttm_placement *placement,
403                          uint32_t page_alignment,
404                          struct ttm_operation_ctx *ctx,
405                          size_t acc_size,
406                          struct sg_table *sg,
407                          struct dma_resv *resv,
408                          void (*destroy) (struct ttm_buffer_object *));
409
410 /**
411  * ttm_bo_init
412  *
413  * @bdev: Pointer to a ttm_bo_device struct.
414  * @bo: Pointer to a ttm_buffer_object to be initialized.
415  * @size: Requested size of buffer object.
416  * @type: Requested type of buffer object.
417  * @flags: Initial placement flags.
418  * @page_alignment: Data alignment in pages.
419  * @interruptible: If needing to sleep to wait for GPU resources,
420  * sleep interruptible.
421  * pinned in physical memory. If this behaviour is not desired, this member
422  * holds a pointer to a persistent shmem object. Typically, this would
423  * point to the shmem object backing a GEM object if TTM is used to back a
424  * GEM user interface.
425  * @acc_size: Accounted size for this object.
426  * @resv: Pointer to a dma_resv, or NULL to let ttm allocate one.
427  * @destroy: Destroy function. Use NULL for kfree().
428  *
429  * This function initializes a pre-allocated struct ttm_buffer_object.
430  * As this object may be part of a larger structure, this function,
431  * together with the @destroy function,
432  * enables driver-specific objects derived from a ttm_buffer_object.
433  *
434  * On successful return, the caller owns an object kref to @bo. The kref and
435  * list_kref are usually set to 1, but note that in some situations, other
436  * tasks may already be holding references to @bo as well.
437  *
438  * If a failure occurs, the function will call the @destroy function, or
439  * kfree() if @destroy is NULL. Thus, after a failure, dereferencing @bo is
440  * illegal and will likely cause memory corruption.
441  *
442  * Returns
443  * -ENOMEM: Out of memory.
444  * -EINVAL: Invalid placement flags.
445  * -ERESTARTSYS: Interrupted by signal while sleeping waiting for resources.
446  */
447 int ttm_bo_init(struct ttm_bo_device *bdev, struct ttm_buffer_object *bo,
448                 unsigned long size, enum ttm_bo_type type,
449                 struct ttm_placement *placement,
450                 uint32_t page_alignment, bool interrubtible, size_t acc_size,
451                 struct sg_table *sg, struct dma_resv *resv,
452                 void (*destroy) (struct ttm_buffer_object *));
453
454 /**
455  * ttm_bo_create
456  *
457  * @bdev: Pointer to a ttm_bo_device struct.
458  * @size: Requested size of buffer object.
459  * @type: Requested type of buffer object.
460  * @placement: Initial placement.
461  * @page_alignment: Data alignment in pages.
462  * @interruptible: If needing to sleep while waiting for GPU resources,
463  * sleep interruptible.
464  * @p_bo: On successful completion *p_bo points to the created object.
465  *
466  * This function allocates a ttm_buffer_object, and then calls ttm_bo_init
467  * on that object. The destroy function is set to kfree().
468  * Returns
469  * -ENOMEM: Out of memory.
470  * -EINVAL: Invalid placement flags.
471  * -ERESTARTSYS: Interrupted by signal while waiting for resources.
472  */
473 int ttm_bo_create(struct ttm_bo_device *bdev, unsigned long size,
474                   enum ttm_bo_type type, struct ttm_placement *placement,
475                   uint32_t page_alignment, bool interruptible,
476                   struct ttm_buffer_object **p_bo);
477
478 /**
479  * ttm_bo_evict_mm
480  *
481  * @bdev: Pointer to a ttm_bo_device struct.
482  * @mem_type: The memory type.
483  *
484  * Evicts all buffers on the lru list of the memory type.
485  * This is normally part of a VT switch or an
486  * out-of-memory-space-due-to-fragmentation handler.
487  * The caller must make sure that there are no other processes
488  * currently validating buffers, and can do that by taking the
489  * struct ttm_bo_device::ttm_lock in write mode.
490  *
491  * Returns:
492  * -EINVAL: Invalid or uninitialized memory type.
493  * -ERESTARTSYS: The call was interrupted by a signal while waiting to
494  * evict a buffer.
495  */
496 int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type);
497
498 /**
499  * ttm_kmap_obj_virtual
500  *
501  * @map: A struct ttm_bo_kmap_obj returned from ttm_bo_kmap.
502  * @is_iomem: Pointer to an integer that on return indicates 1 if the
503  * virtual map is io memory, 0 if normal memory.
504  *
505  * Returns the virtual address of a buffer object area mapped by ttm_bo_kmap.
506  * If *is_iomem is 1 on return, the virtual address points to an io memory area,
507  * that should strictly be accessed by the iowriteXX() and similar functions.
508  */
509 static inline void *ttm_kmap_obj_virtual(struct ttm_bo_kmap_obj *map,
510                                          bool *is_iomem)
511 {
512         *is_iomem = !!(map->bo_kmap_type & TTM_BO_MAP_IOMEM_MASK);
513         return map->virtual;
514 }
515
516 /**
517  * ttm_bo_kmap
518  *
519  * @bo: The buffer object.
520  * @start_page: The first page to map.
521  * @num_pages: Number of pages to map.
522  * @map: pointer to a struct ttm_bo_kmap_obj representing the map.
523  *
524  * Sets up a kernel virtual mapping, using ioremap, vmap or kmap to the
525  * data in the buffer object. The ttm_kmap_obj_virtual function can then be
526  * used to obtain a virtual address to the data.
527  *
528  * Returns
529  * -ENOMEM: Out of memory.
530  * -EINVAL: Invalid range.
531  */
532 int ttm_bo_kmap(struct ttm_buffer_object *bo, unsigned long start_page,
533                 unsigned long num_pages, struct ttm_bo_kmap_obj *map);
534
535 /**
536  * ttm_bo_kunmap
537  *
538  * @map: Object describing the map to unmap.
539  *
540  * Unmaps a kernel map set up by ttm_bo_kmap.
541  */
542 void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map);
543
544 /**
545  * ttm_bo_mmap_obj - mmap memory backed by a ttm buffer object.
546  *
547  * @vma:       vma as input from the fbdev mmap method.
548  * @bo:        The bo backing the address space.
549  *
550  * Maps a buffer object.
551  */
552 int ttm_bo_mmap_obj(struct vm_area_struct *vma, struct ttm_buffer_object *bo);
553
554 /**
555  * ttm_bo_mmap - mmap out of the ttm device address space.
556  *
557  * @filp:      filp as input from the mmap method.
558  * @vma:       vma as input from the mmap method.
559  * @bdev:      Pointer to the ttm_bo_device with the address space manager.
560  *
561  * This function is intended to be called by the device mmap method.
562  * if the device address space is to be backed by the bo manager.
563  */
564 int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
565                 struct ttm_bo_device *bdev);
566
567 /**
568  * ttm_bo_io
569  *
570  * @bdev:      Pointer to the struct ttm_bo_device.
571  * @filp:      Pointer to the struct file attempting to read / write.
572  * @wbuf:      User-space pointer to address of buffer to write. NULL on read.
573  * @rbuf:      User-space pointer to address of buffer to read into.
574  * Null on write.
575  * @count:     Number of bytes to read / write.
576  * @f_pos:     Pointer to current file position.
577  * @write:     1 for read, 0 for write.
578  *
579  * This function implements read / write into ttm buffer objects, and is
580  * intended to
581  * be called from the fops::read and fops::write method.
582  * Returns:
583  * See man (2) write, man(2) read. In particular,
584  * the function may return -ERESTARTSYS if
585  * interrupted by a signal.
586  */
587 ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
588                   const char __user *wbuf, char __user *rbuf,
589                   size_t count, loff_t *f_pos, bool write);
590
591 int ttm_bo_swapout(struct ttm_bo_global *glob,
592                         struct ttm_operation_ctx *ctx);
593 void ttm_bo_swapout_all(void);
594
595 /**
596  * ttm_bo_uses_embedded_gem_object - check if the given bo uses the
597  * embedded drm_gem_object.
598  *
599  * Most ttm drivers are using gem too, so the embedded
600  * ttm_buffer_object.base will be initialized by the driver (before
601  * calling ttm_bo_init).  It is also possible to use ttm without gem
602  * though (vmwgfx does that).
603  *
604  * This helper will figure whenever a given ttm bo is a gem object too
605  * or not.
606  *
607  * @bo: The bo to check.
608  */
609 static inline bool ttm_bo_uses_embedded_gem_object(struct ttm_buffer_object *bo)
610 {
611         return bo->base.dev != NULL;
612 }
613
614 int ttm_mem_evict_first(struct ttm_bo_device *bdev,
615                         struct ttm_resource_manager *man,
616                         const struct ttm_place *place,
617                         struct ttm_operation_ctx *ctx,
618                         struct ww_acquire_ctx *ticket);
619
620 /* Default number of pre-faulted pages in the TTM fault handler */
621 #define TTM_BO_VM_NUM_PREFAULT 16
622
623 vm_fault_t ttm_bo_vm_reserve(struct ttm_buffer_object *bo,
624                              struct vm_fault *vmf);
625
626 vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
627                                     pgprot_t prot,
628                                     pgoff_t num_prefault,
629                                     pgoff_t fault_page_size);
630
631 vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf);
632
633 void ttm_bo_vm_open(struct vm_area_struct *vma);
634
635 void ttm_bo_vm_close(struct vm_area_struct *vma);
636
637 int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr,
638                      void *buf, int len, int write);
639
640 #endif