.. | .. |
---|
1 | | -/** |
---|
| 1 | +/* |
---|
2 | 2 | * \file drm_scatter.c |
---|
3 | 3 | * IOCTLs to manage scatter/gather memory |
---|
4 | 4 | * |
---|
.. | .. |
---|
31 | 31 | * DEALINGS IN THE SOFTWARE. |
---|
32 | 32 | */ |
---|
33 | 33 | |
---|
34 | | -#include <linux/vmalloc.h> |
---|
| 34 | +#include <linux/mm.h> |
---|
35 | 35 | #include <linux/slab.h> |
---|
36 | | -#include <drm/drmP.h> |
---|
| 36 | +#include <linux/vmalloc.h> |
---|
| 37 | + |
---|
| 38 | +#include <drm/drm.h> |
---|
| 39 | +#include <drm/drm_drv.h> |
---|
| 40 | +#include <drm/drm_print.h> |
---|
| 41 | + |
---|
37 | 42 | #include "drm_legacy.h" |
---|
38 | 43 | |
---|
39 | 44 | #define DEBUG_SCATTER 0 |
---|
40 | | - |
---|
41 | | -static inline void *drm_vmalloc_dma(unsigned long size) |
---|
42 | | -{ |
---|
43 | | -#if defined(__powerpc__) && defined(CONFIG_NOT_COHERENT_CACHE) |
---|
44 | | - return __vmalloc(size, GFP_KERNEL, pgprot_noncached_wc(PAGE_KERNEL)); |
---|
45 | | -#else |
---|
46 | | - return vmalloc_32(size); |
---|
47 | | -#endif |
---|
48 | | -} |
---|
49 | 45 | |
---|
50 | 46 | static void drm_sg_cleanup(struct drm_sg_mem * entry) |
---|
51 | 47 | { |
---|
.. | .. |
---|
89 | 85 | DRM_DEBUG("\n"); |
---|
90 | 86 | |
---|
91 | 87 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
---|
92 | | - return -EINVAL; |
---|
| 88 | + return -EOPNOTSUPP; |
---|
93 | 89 | |
---|
94 | 90 | if (!drm_core_check_feature(dev, DRIVER_SG)) |
---|
| 91 | + return -EOPNOTSUPP; |
---|
| 92 | + |
---|
| 93 | + if (request->size > SIZE_MAX - PAGE_SIZE) |
---|
95 | 94 | return -EINVAL; |
---|
96 | 95 | |
---|
97 | 96 | if (dev->sg) |
---|
.. | .. |
---|
118 | 117 | return -ENOMEM; |
---|
119 | 118 | } |
---|
120 | 119 | |
---|
121 | | - entry->virtual = drm_vmalloc_dma(pages << PAGE_SHIFT); |
---|
| 120 | + entry->virtual = vmalloc_32(pages << PAGE_SHIFT); |
---|
122 | 121 | if (!entry->virtual) { |
---|
123 | 122 | kfree(entry->busaddr); |
---|
124 | 123 | kfree(entry->pagelist); |
---|
.. | .. |
---|
202 | 201 | struct drm_sg_mem *entry; |
---|
203 | 202 | |
---|
204 | 203 | if (!drm_core_check_feature(dev, DRIVER_LEGACY)) |
---|
205 | | - return -EINVAL; |
---|
| 204 | + return -EOPNOTSUPP; |
---|
206 | 205 | |
---|
207 | 206 | if (!drm_core_check_feature(dev, DRIVER_SG)) |
---|
208 | | - return -EINVAL; |
---|
| 207 | + return -EOPNOTSUPP; |
---|
209 | 208 | |
---|
210 | 209 | entry = dev->sg; |
---|
211 | 210 | dev->sg = NULL; |
---|