0001
0002
0003
0004
0005
0006
0007 #include <linux/fs.h>
0008 #include <linux/mount.h>
0009
0010 #include "i915_drv.h"
0011 #include "i915_gemfs.h"
0012 #include "i915_utils.h"
0013
0014 void i915_gemfs_init(struct drm_i915_private *i915)
0015 {
0016 char huge_opt[] = "huge=within_size";
0017 struct file_system_type *type;
0018 struct vfsmount *gemfs;
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 if (GRAPHICS_VER(i915) < 11 && !i915_vtd_active(i915))
0033 return;
0034
0035 if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
0036 goto err;
0037
0038 type = get_fs_type("tmpfs");
0039 if (!type)
0040 goto err;
0041
0042 gemfs = vfs_kern_mount(type, SB_KERNMOUNT, type->name, huge_opt);
0043 if (IS_ERR(gemfs))
0044 goto err;
0045
0046 i915->mm.gemfs = gemfs;
0047 drm_info(&i915->drm, "Using Transparent Hugepages\n");
0048 return;
0049
0050 err:
0051 drm_notice(&i915->drm,
0052 "Transparent Hugepage support is recommended for optimal performance%s\n",
0053 GRAPHICS_VER(i915) >= 11 ? " on this platform!" :
0054 " when IOMMU is enabled!");
0055 }
0056
0057 void i915_gemfs_fini(struct drm_i915_private *i915)
0058 {
0059 kern_unmount(i915->mm.gemfs);
0060 }