aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/tegra/nvmap/nvmap_mru.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/tegra/nvmap/nvmap_mru.h')
-rw-r--r--drivers/video/tegra/nvmap/nvmap_mru.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_mru.h b/drivers/video/tegra/nvmap/nvmap_mru.h
new file mode 100644
index 00000000000..6c94630bc3e
--- /dev/null
+++ b/drivers/video/tegra/nvmap/nvmap_mru.h
@@ -0,0 +1,84 @@
1/*
2 * drivers/video/tegra/nvmap_mru.c
3 *
4 * IOVMM virtualization support for nvmap
5 *
6 * Copyright (c) 2009-2010, NVIDIA Corporation.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23
24#ifndef __VIDEO_TEGRA_NVMAP_MRU_H
25#define __VIDEO_TEGRA_NVMAP_MRU_H
26
27#include <linux/spinlock.h>
28
29#include "nvmap.h"
30
31struct tegra_iovmm_area;
32struct tegra_iovmm_client;
33
34#ifdef CONFIG_NVMAP_RECLAIM_UNPINNED_VM
35
36static inline void nvmap_mru_lock(struct nvmap_share *share)
37{
38 mutex_lock(&share->mru_lock);
39}
40
41static inline void nvmap_mru_unlock(struct nvmap_share *share)
42{
43 mutex_unlock(&share->mru_lock);
44}
45
46int nvmap_mru_init(struct nvmap_share *share);
47
48void nvmap_mru_destroy(struct nvmap_share *share);
49
50size_t nvmap_mru_vm_size(struct tegra_iovmm_client *iovmm);
51
52void nvmap_mru_insert_locked(struct nvmap_share *share, struct nvmap_handle *h);
53
54void nvmap_mru_remove(struct nvmap_share *s, struct nvmap_handle *h);
55
56struct tegra_iovmm_area *nvmap_handle_iovmm_locked(struct nvmap_client *c,
57 struct nvmap_handle *h);
58
59#else
60
61#define nvmap_mru_lock(_s) do { } while (0)
62#define nvmap_mru_unlock(_s) do { } while (0)
63#define nvmap_mru_init(_s) 0
64#define nvmap_mru_destroy(_s) do { } while (0)
65#define nvmap_mru_vm_size(_a) tegra_iovmm_get_vm_size(_a)
66
67static inline void nvmap_mru_insert_locked(struct nvmap_share *share,
68 struct nvmap_handle *h)
69{ }
70
71static inline void nvmap_mru_remove(struct nvmap_share *s,
72 struct nvmap_handle *h)
73{ }
74
75static inline struct tegra_iovmm_area *nvmap_handle_iovmm_locked(struct nvmap_client *c,
76 struct nvmap_handle *h)
77{
78 BUG_ON(!h->pgalloc.area);
79 return h->pgalloc.area;
80}
81
82#endif
83
84#endif