Merge tag 'io_uring-5.11-2021-01-16' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / gpu / drm / i915 / gem / i915_gemfs.c
blob5e6e8c91ab385922cbd88ef5de1dc30e6a16454f
1 /*
2 * SPDX-License-Identifier: MIT
4 * Copyright © 2017 Intel Corporation
5 */
7 #include <linux/fs.h>
8 #include <linux/mount.h>
9 #include <linux/pagemap.h>
11 #include "i915_drv.h"
12 #include "i915_gemfs.h"
14 int i915_gemfs_init(struct drm_i915_private *i915)
16 struct file_system_type *type;
17 struct vfsmount *gemfs;
19 type = get_fs_type("tmpfs");
20 if (!type)
21 return -ENODEV;
24 * By creating our own shmemfs mountpoint, we can pass in
25 * mount flags that better match our usecase.
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+.
32 gemfs = kern_mount(type);
33 if (IS_ERR(gemfs))
34 return PTR_ERR(gemfs);
36 i915->mm.gemfs = gemfs;
38 return 0;
41 void i915_gemfs_fini(struct drm_i915_private *i915)
43 kern_unmount(i915->mm.gemfs);