Age | Commit message (Collapse) | Author |
|
Signed-off-by: Suman Anna <s-anna@ti.com>
|
|
The mmap_sem locking semantics were abstracted out in preparation for
some scalability work in v5.8 kernel. The mmap_sem field is no longer
defined (renamed), and is abstracted out through newly introduced
mmap_read_{lock,unlock} wrappers in a new mmap_lock.h file in commit
9740ca4e95b4 ("mmap locking API: initial implementation as rwsem
wrappers").
Adopt to these new wrappers to fix the CMEM kernel module build against
these newer kernels.
Signed-off-by: Suman Anna <s-anna@ti.com>
|
|
Introduce small inline wrapper functions around down_read() and
up_read() in preparation for scaling the CMEM kernel module for
changes in v5.8 kernel around the mmap lock semantics.
Signed-off-by: Suman Anna <s-anna@ti.com>
|
|
Signed-off-by: Suman Anna <s-anna@ti.com>
|
|
The CMEM kernel module fails to build for 5.6 Linux kernel due to
couple of changes:
1. The dma_buf ops lost the .map() and .unmap() callbacks in
commit 4337ebbbbda3 ("dma-buf: Remove kernel map/unmap hooks")
2. The proc_create() function signature has changed to use a new
proc_ops structure in place of the larger file_operations
structure in commit d56c0d45f0e2 ("proc: decouple proc from
VFS with "struct proc_ops")
Fix #1 by limiting the ops for only older Linux kernels, and fix #2
by introducing a new proc_ops similar to the conversions done in
commit 97a32539b956 ("proc: convert everything to "struct proc_ops"")
Signed-off-by: Suman Anna <s-anna@ti.com>
|
|
Signed-off-by: Suman Anna <s-anna@ti.com>
|
|
Fix various compile warnings in the tests folder around
off_t.
Signed-off-by: Suman Anna <s-anna@ti.com>
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Signed-off-by: Shravan Karthik <shravan.karthik@ti.com>
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
From kernel versions 4.18, the map_atomic, unmap_atomic interfaces are
removed.
The device parameter for the attach callback is also removed.
Signed-off-by: Shravan Karthik <shravan.karthik@ti.com>
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Adds check for return value of zero and exit instead of going ahead with
map.
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Add spaces instead of spaces for consistency across code
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Fixes return of unsigned long long to user space for physp
Fixes print issues to be address with portability in mind.
Fix argument pointers
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Adds handling of 64 bit properly
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Adds portabilty fix for 64 bit address handling.
Also, with K3 cache coherence architecture, Cache operations are not
required from the Arm Host side. This patch disables all cache
operations for K3 architecture.
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Remove hard coding to ARCH=arm
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
The commit 16d7ceb04b55 ("mmap: introduce sane default mmap limits")
that came through v4.14.49 stable tree has added additional range
checks that resulted in the mmap() calls on the CMEM device to fail
on K2 SoCs. K2 SoCs use 36-bit address spaces and the range check
fails when comparing (in page indices) the 33-bit physical address
against the 4 GB address imit, resulting in CMEM API failures and
unable to launch MPM daemon on K2 SoCs affecting all MPM based IPC
use-cases.
Work around this problem by setting FMODE_UNSIGNED_OFFSET in the file
flags in the driver's open() fops implementation for the /dev/cmem
device. The change follows the suggestion in the above commit to mark
the file descriptors as safe in the full 64-bit mmap address space
by using the repurposed FMODE_UNSIGNED_OFFSET bit. The fix was also
inspired by a similar fix in commit 2abd4c3ed20d ("drm: set
FMODE_UNSIGNED_OFFSET for drm files") for the same problem.
The same fix applies when using CMEM against kernels v4.17-rc5 and
above as well overcoming the corresponding upstream equivalent commit
be83bbf80682 ("mmap: introduce sane default mmap limits").
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Fixes one issue related to falling through for direct mapped memory.
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Need to check all negative values not only -1.
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Changes are backward compatible with Linux Kernel 4.4 as well.
Replaced use of deprecated ioremap_page_range function with ioremap
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
There is a race condition when mmap is happening simultaneously in a
different thread and find_vma returns invalid value.
Adding protection here to avoid race condition
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
In case of error, function expected to return negative value
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
The dma-buf ops .kmap_atomic, .kunmap_atomic, .kmap and .kunmap have
been renamed to .map_atomic, .unmap_atomic, .map and .unmap respectively
on 4.12+ kernels to avoid conflict with a kmap_atomic macro from the
Linux highmem.h header file. Fix the ops names in the current definitions
of cmem_dmabuf_ops, so that the CMEM module can be built against 4.12+
kernels properly.
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/linux/dma-buf.h?id=f9b67f0014cba18f1aabb6fa9272335a043eb6fd
Signed-off-by: Suman Anna <s-anna@ti.com>
|
|
Replace the architecture specific asm/uaccess.h with the Linux
generic linux/uaccess.h header file. The architecture specific
header files will be included by the generic header file.
This fixes an issue when building the CMEM kernel module against
4.12+ kernels.
Signed-off-by: Suman Anna <s-anna@ti.com>
|
|
The get_user_pages_remote() function signature has changed in 4.10
kernel, it gained an additional integer pointer argument [1]. Fix
the current get_user_pages_remote() invocation in cmemk kernel with
the appropriate signature to build properly for these kernels.
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/linux/mm.h?id=5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
Signed-off-by: Suman Anna <s-anna@ti.com>
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Updating Android makefile to generate cmem userspace binaries and
libraries in /vendor location instead of /system.
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
The get_user_pages() function has gone through a bunch of changes
between 4.4 and 4.9 Linux kernel versions. The function first lost
the first two arguments - the task_struct and the mm_struct pointers
in 4.6 kernel (and got replaced with a new get_user_pages_remote()
function)[1][2], and then replaced two other arguments 'write' and
'force' with a single 'gup_flags' argument in 4.9 kernel[3][4]. Fix
the current get_user_pages() invocation in cmemk kernel with the
appropriate functions to build properly for these kernels.
[1]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/linux/mm.h?id=1e9877902dc7e11d2be038371c6fbf2dfcd469d7
[2]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/linux/mm.h?id=c12d2da56d0e07d230968ee2305aaa86b93a6832
[3]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/linux/mm.h?id=768ae309a96103ed02eb1e111e838c87854d8b51
[4]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/linux/mm.h?id=9beae1ea89305a9667ceaab6d0bf46a045ad71e7
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Commit 18b862dcd57a ("dma-buf, drm, ion: Propagate error code from
dma_buf_start_cpu_access()") in Linux kernel has changed the signature
for the dma_buf's end_cpu_access() ops. It now returns an error code,
so adjust the signature for the cmem_dma_buf_end_cpu_access() function
appropriately based on the kernel version.
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
This is a bug fix. Uninitialized variable caused freeing of random
pointer and page fault.
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Adds support for using sram node
Also updated documentation by demarcating the entries in the block
subnodes
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
---
Updated documentation with "sram" node definition
---
|
|
Some memory sections can be managed by sram nodes in the dts.
Adding support for sram subnodes allows the CMEM memory to use sram
memory areas.
Parsing of addresses on the subnodes now use of_address_to_resource for
both sram and mem-region nodes.
NOTE: For some of the routines the spacing and tabs are updated to general linux kernel coding guidelines.
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
---
Change from previous version
Redesigned to use "sram" node instead of mem-type.
---
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Added new API to export buffer as dmabuf
Added kernel driver code to support dmabuf ops
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Cleanup: The block_struct was duplicated in both cmem.c and cmemk.c
Removing it and add it in the common cmem.h file
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Added error check for ioremap_page_range in case of failure
Also added initialisation of virtp
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
coherent_dma_mask was not set for Am57x platforms and resulted in
allocation failure
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
- Found that __cpuc_flush_dcache_area doesnot work properly: Needed to
be replaced by dmac_map_area
- Other minor spacing issues fixed.
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
dmac_map_area and associated assembly functions are no longer available
for use in kernel modules in kernel version >= 4.4 and there are no
equivalent higher level function available for cache operations.
Use of dma_sync_single* function creates additional issues with address
translation and does not really solve the problem for memory range > 4
GB and hence reverting back that change.
Reverting back to local assembly functions. Modified code to add
local functions for all kernels versions where dmac_map_area is not
available.
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|