drm/i915/uapi: reject set_domain for discrete
[linux-2.6-microblaze.git] / drivers / gpu / drm / i915 / gem / i915_gemfs.c
1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright © 2017 Intel Corporation
5  */
6
7 #include <linux/fs.h>
8 #include <linux/mount.h>
9 #include <linux/pagemap.h>
10
11 #include "i915_drv.h"
12 #include "i915_gemfs.h"
13
14 int i915_gemfs_init(struct drm_i915_private *i915)
15 {
16         struct file_system_type *type;
17         struct vfsmount *gemfs;
18
19         type = get_fs_type("tmpfs");
20         if (!type)
21                 return -ENODEV;
22
23         /*
24          * By creating our own shmemfs mountpoint, we can pass in
25          * mount flags that better match our usecase.
26          *
27          * One example, although it is probably better with a per-file
28          * control, is selecting huge page allocations ("huge=within_size").
29          * Currently unused due to bandwidth issues (slow reads) on Broadwell+.
30          */
31
32         gemfs = kern_mount(type);
33         if (IS_ERR(gemfs))
34                 return PTR_ERR(gemfs);
35
36         i915->mm.gemfs = gemfs;
37
38         return 0;
39 }
40
41 void i915_gemfs_fini(struct drm_i915_private *i915)
42 {
43         kern_unmount(i915->mm.gemfs);
44 }