2017-10-07 05:18:14 +07:00
|
|
|
/*
|
2019-05-28 16:29:49 +07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-10-07 05:18:14 +07:00
|
|
|
*
|
2019-05-28 16:29:49 +07:00
|
|
|
* Copyright © 2017 Intel Corporation
|
2017-10-07 05:18:14 +07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/mount.h>
|
2017-10-07 05:18:15 +07:00
|
|
|
#include <linux/pagemap.h>
|
2017-10-07 05:18:14 +07:00
|
|
|
|
|
|
|
#include "i915_drv.h"
|
|
|
|
#include "i915_gemfs.h"
|
|
|
|
|
|
|
|
int i915_gemfs_init(struct drm_i915_private *i915)
|
|
|
|
{
|
|
|
|
struct file_system_type *type;
|
|
|
|
struct vfsmount *gemfs;
|
|
|
|
|
|
|
|
type = get_fs_type("tmpfs");
|
|
|
|
if (!type)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2017-10-07 05:18:15 +07:00
|
|
|
/*
|
2019-08-09 00:22:26 +07:00
|
|
|
* By creating our own shmemfs mountpoint, we can pass in
|
|
|
|
* mount flags that better match our usecase.
|
|
|
|
*
|
|
|
|
* One example, although it is probably better with a per-file
|
|
|
|
* control, is selecting huge page allocations ("huge=within_size").
|
|
|
|
* Currently unused due to bandwidth issues (slow reads) on Broadwell+.
|
2017-10-07 05:18:15 +07:00
|
|
|
*/
|
|
|
|
|
2019-08-09 00:22:26 +07:00
|
|
|
gemfs = kern_mount(type);
|
|
|
|
if (IS_ERR(gemfs))
|
|
|
|
return PTR_ERR(gemfs);
|
2017-10-07 05:18:15 +07:00
|
|
|
|
2017-10-07 05:18:14 +07:00
|
|
|
i915->mm.gemfs = gemfs;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void i915_gemfs_fini(struct drm_i915_private *i915)
|
|
|
|
{
|
|
|
|
kern_unmount(i915->mm.gemfs);
|
|
|
|
}
|