-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmy_mmap.c
More file actions
24 lines (21 loc) · 782 Bytes
/
my_mmap.c
File metadata and controls
24 lines (21 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
//
// This file is provided under a dual BSD/GPLv2 license. When using or
// redistributing this file, you may do so under either license.
//
// Copyright(c) 2019 Intel Corporation. All rights reserved.
//
// Author: Marcin Zielinski <marcinx.zielinski@linux.intel.com>
//
#include "my_mmap.h"
int simple_remap_mmap(struct file *filp, struct vm_area_struct *vma)
{
int ret;
unsigned long size = vma->vm_end - vma->vm_start;
pr_info("[SOF] (re)mapping memory to user space; start address = %lu, physical address = %lu, size = %lu",
vma->vm_start, vma->vm_pgoff, size);
ret = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, size,
PAGE_SHARED);
describe_retval(ret, 0, "(re)mapping file");
return ret;
}