Age | Commit message (Collapse) | Author |
|
Adds handling of 64 bit properly
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
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>
|
|
This reverts commit d5481f4d32edbc320a0853b2ddfdfe8dedc8d017.
|
|
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
linux kernel 4.4 made the dmac_map_area function to internal only to dma
module.
Replaced with higher level cache operation functions to achieve the same
result, but avoid using the low level internal function to resolve
issue.
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
cmem_cma_dev_0 need not be keystone 2 specific and can be common for all
platforms. Added similar handling for all platforms.
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
In kernel version 4.4 the return value for seq_printf is removed.
Removed all return value handling for seq_printf
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
With older Linux kernels the linkage to architecture-specific cache APIs
was not available, yet CMEM needed their functionality. This problem
existed for architectures that didn't #define MULTI_CACHE. CMEM worked
around this limitation by having a copy of the needed
architecture-specific assembly functions, taken from the architecture's
source code.
The current Linux kernels don't suffer this limitation, so the copies of
the architecture's assembly source code are no longer needed and should
be removed altogether.
Addresses SDOCM00117426 & SDOCM00118582
Signed-off-by: Rob Tivy <rtivy@ti.com>
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
Cleanup to define the dma pfn offset at one location instead of spread
all over the code
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
The per device dma_pfn_offset was introduced in Kernel version 3.18.
The conditional compilation allows to compile with older kernel as well.
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
|
|
On kestone2 SOC where aliased memory is being used dma_alloc_coherent()
cannot be called with pointer to device set to NULL. The real
"struct device" has to be used. And the dma_pfn_offset has to be set
correctly. Otherwise the function returns wrong dma address.
This commit adds the cmem_cma_dev_0 pointer, which is set by
device_create(). It sets the correct coherent_dma_mask and dma_pfn_offset
for this device.
Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
|
|
When memory is using LPAE mode pointers are > 32 bit, and as such the
"reg" values in a memory-region are 64 bits each for address and size.
Change CMEM DT processing to honor #address-cells and #size-cells for
memory-region nodes.
Also, pool buffer sizes need to be specified as 64 bit values, so add
a #pool-size-cells property to the cmem node and read values from the
cmem-buf-pools property as appropriate.
|
|
This reverts commit 09d38fe7dfed7067e4e6d10a1c22a0bcc3af0271.
|
|
A 'space' between -I and the following path seems to cause the path
element to not be used for #include file searches.
The __DATE__ & __TIME__ macro usage causes a warning (that can be an
error with -Wall).
Addresses SDOCM00118585
|