Skip to content
Commit df720d3d authored by Tim Gover's avatar Tim Gover Committed by popcornmix
Browse files

vcsm: VideoCore shared memory service for BCM2835



Add experimental support for the VideoCore shared memory service.
This allows user processes to allocate memory from VideoCore's
GPU relocatable heap and mmap the buffers. Additionally, the memory
handles can passed to other VideoCore services such as MMAL, OpenMax
and DispmanX

TODO
* This driver was originally released for BCM28155 which has a different
  cache architecture to BCM2835. Consequently, in this release only
  uncached mappings are supported. However, there's no fundamental
  reason which cached mappings cannot be support or BCM2835
* More refactoring is required to remove the typedefs.
* Re-enable the some of the commented out debug-fs statistics which were
  disabled when migrating code from proc-fs.
* There's a lot of code to support sharing of VCSM in order to support
  Android. This could probably done more cleanly or perhaps just
  removed.

Signed-off-by: default avatarTim Gover <timgover@gmail.com>

config: Disable VC_SM for now to fix hang with cutdown kernel

vcsm: Use boolean as it cannot be built as module

On building the bcm_vc_sm as a module we get the following error:

v7_dma_flush_range and do_munmap are undefined in vc-sm.ko.

Fix by making it not an option to build as module

vcsm: Add ioctl for custom cache flushing

vc-sm: Move headers out of arch directory

Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>

vcsm: Treat EBUSY as success rather than SIGBUS

Currently if two cores access the same page concurrently one will return VM_FAULT_NOPAGE
and the other VM_FAULT_SIGBUS crashing the user code.

Also report when mapping fails.

Signed-off-by: default avatarpopcornmix <popcornmix@gmail.com>

vcsm: Provide new ioctl to clean/invalidate a 2D block

vcsm: Convert to loading via device tree.

Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.org>

VCSM: New option to import a DMABUF for VPU use

Takes a dmabuf, and then calls over to the VPU to wrap
it into a suitable handle.

Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.org>

vcsm: fix multi-platform build

vcsm: add macros for cache functions

vcsm: use dma APIs for cache functions

* Will handle multi-platform builds

vcsm: Fix up macros to avoid breaking numbers used by existing apps

vcsm: Define cache operation constants in user header

Without this change, users have to use raw values (1, 2, 3) to specify
cache operation.

Signed-off-by: default avatarSugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>

vcsm: Support for finding user/vc handle in memory pool

vmcs_sm_{usr,vc}_handle_from_pid_and_address() were failing to find
handle if specified user pointer is not exactly the one that the memory
locking call returned even if the pointer is in range of map/resource.
So fixed the functions to match the range.

Signed-off-by: default avatarSugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>

vcsm: Unify cache manipulating functions

Signed-off-by: default avatarSugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>

vcsm: Fix obscure conditions

Signed-off-by: default avatarSugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>

vcsm: Fix memory leaking on clean_invalid2 ioctl handler

Signed-off-by: default avatarSugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>

vcsm: Describe the use of cache operation constants

Signed-off-by: default avatarSugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>

vcsm: Fix obscure conditions again

Signed-off-by: default avatarSugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>

vcsm: Add no-op cache operation constant

Signed-off-by: default avatarSugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>

vcsm: Revert to do page-table-walk-based cache manipulating on some ioctl calls

On FLUSH, INVALID, CLEAN_INVALID ioctl calls, cache operations based on
page table walk were used in case that the buffer of the cache is not
pinned.  So reverted to do page-table-based cache manipulating.

Signed-off-by: default avatarSugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>

vcsm: Define cache operation constants in user header

Without this change, users have to use raw values (1, 2, 3) to specify
cache operation.

Signed-off-by: default avatarSugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>

vcsm: Updates for changed vchiq interface

vcsm: Fix an NULL dereference in the import_dmabuf error path

resource was dereferenced even though it was NULL.

Signed-off-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.org>

vcsm: Use struct service_creation

vcsm: Fix makefile include on out-of-tree builds

The vc_sm module tries to include the 'fs' directory from the
$(srctree). $(srctree) is already provided by the build system, and
causes the include path to be duplicated.

With -Werror this fails to compile.

Remove the unnecessary variable.

Signed-off-by: default avatarKieran Bingham <kieran.bingham@ideasonboard.com>

vcsm: Remove set but unused variable

The 'success' variable is set by the call to vchi_service_close() but never checked.
Remove it, keeping the call in place.

Signed-off-by: default avatarKieran Bingham <kieran.bingham@ideasonboard.com>

vcsm: Reduce scope of local functions

The functions:

  vc_vchi_sm_send_msg
  vc_sm_ioctl_alloc
  vc_sm_ioctl_alloc_share
  vc_sm_ioctl_import_dmabuf

Are declared without a prototype. They are not used outside of this
module, thus - convert them to static functions.

Signed-off-by: default avatarKieran Bingham <kieran.bingham@ideasonboard.com>

vc_sm: Let it support to build in the non-src folder

If we build the kernel with "-O=$non-src-folder", this driver will
introdcue a building error because of the header's location.

Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
parent d877b9c4
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment