History log of /linux-master/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
Revision Date Author Comments
# f37e76ab 13-Mar-2024 Dan Carpenter <dan.carpenter@linaro.org>

staging: vc04_services: fix information leak in create_component()

The m.u.component_create.pid field is for debugging and in the mainline
kernel it's not used anything. However, it still needs to be set to
something to prevent disclosing uninitialized stack data. Set it to
zero.

Fixes: 7b3ad5abf027 ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.")
Cc: stable <stable@kernel.org>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/2d972847-9ebd-481b-b6f9-af390f5aabd3@moroto.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ef25725b 13-Mar-2024 Arnd Bergmann <arnd@arndb.de>

staging: vc04_services: changen strncpy() to strscpy_pad()

gcc-14 warns about this strncpy() that results in a non-terminated
string for an overflow:

In file included from include/linux/string.h:369,
from drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:20:
In function 'strncpy',
inlined from 'create_component' at drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:940:2:
include/linux/fortify-string.h:108:33: error: '__builtin_strncpy' specified bound 128 equals destination size [-Werror=stringop-truncation]

Change it to strscpy_pad(), which produces a properly terminated and
zero-padded string.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20240313163712.224585-1-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7f0c1244 30-Jan-2023 Jongwoo Han <jongwooo.han@gmail.com>

staging: vc04_services: mmal-vchiq: fix typo in comment

Correct typo from 'witin' to 'within' in comment.

Signed-off-by: Jongwoo Han <jongwooo.han@gmail.com>
Link: https://lore.kernel.org/r/20230130164250.51877-1-jongwooo.han@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 74d5eb7d 20-Jan-2023 Umang Jain <umang.jain@ideasonboard.com>

staging: vc04_services: vchiq-mmal: Drop include Makefile directive

Drop the include directive. They can break the build, when one only
wants to build a subdirectory. Replace with "../" for the includes,
in the mmal-vchiq.c instead.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Link: https://lore.kernel.org/r/20230120201104.606876-5-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3414994b 23-Dec-2022 Umang Jain <umang.jain@ideasonboard.com>

staging: vc04_services: Drop VCHIQ_SUCCESS usage

Drop the usage of VCHIQ_SUCCESS vchiq_status enum type. Replace it with
0 to report the success status.

This patch acts as intermediatory to address the TODO item:
* Get rid of custom function return values
for vc04_services/interface.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/20221223122404.170585-3-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3ba31722 23-Dec-2022 Umang Jain <umang.jain@ideasonboard.com>

staging: vc04_services: Replace vchiq_status return type to int

Modify the functions' signature using enum vchiq_status to return int.
Currently, this patch only touches the function signatures and
in subsequent patches each vchiq_status enumerated value will be
replaced by a integer value.

This patch acts as an initial point to address the TODO item:
* Get rid of custom function return values
for vc04_services/interface.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/20221223122404.170585-2-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c0012a39 18-Nov-2022 Umang Jain <umang.jain@ideasonboard.com>

vc04_services: mmal-vchiq: Use bool for vchiq_mmal_component.in_use

In commit 7967656ffbfa ("coding-style: Clarify the expectations around
bool") the check to dis-allow bool structure members was removed from
checkpatch.pl. It promotes bool structure members to store boolean
values. This enhances code readability.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://lore.kernel.org/r/20221118084244.199909-3-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 73361173 18-Nov-2022 Umang Jain <umang.jain@ideasonboard.com>

Revert "staging: mmal-vchiq: Avoid use of bool in structures"

This reverts commit 640e77466e69d9c28de227bc76881f5501f532ca.

In commit 7967656ffbfa ("coding-style: Clarify the expectations around
bool") the check to dis-allow bool structure members was removed from
checkpatch.pl. It promotes bool structure members to store boolean
values. This enhances code readability.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Link: https://lore.kernel.org/r/20221118084244.199909-2-umang.jain@ideasonboard.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f23f8a05 18-May-2022 Adrien Thierry <athierry@redhat.com>

staging: vchiq_arm: pass vchiq instance to 'vchiq_get_service_userdata'

In order to remove the 'vchiq_states' global array, we need to pass the
vchiq_instance reference to the 'handle_to_service' function, as well as
to all functions that call 'handle_to_service'. This will allow
accessing the vchiq state through the vchiq instance instead of through
the global array.

'handle_to_service' is called by 'vchiq_get_service_userdata'.
Therefore, pass the vchiq instance reference to it.

Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20220518191126.60396-7-athierry@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 14780bb1 18-May-2022 Adrien Thierry <athierry@redhat.com>

staging: vchiq_arm: pass vchiq instance to 'find_service_by_handle'

In order to remove the 'vchiq_states' global array, we need to pass the
vchiq_instance reference to the 'handle_to_service' function, as well as
to all functions that call 'handle_to_service'. This will allow
accessing the vchiq state through the vchiq instance instead of through
the global array.

'handle_to_service' is called by 'find_service_by_handle'. Therefore,
pass the vchiq instance reference to 'find_service_by_handle' and to its
callers.

Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20220518191126.60396-5-athierry@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 726e79f8 18-May-2022 Adrien Thierry <athierry@redhat.com>

staging: vchiq_arm: pass vchiq instance to service callbacks

In order to remove the 'vchiq_states' global array, we need to pass the
vchiq_instance reference to the 'handle_to_service' function, as well as
to all functions that call 'handle_to_service'. This will allow
accessing the vchiq state through the vchiq instance instead of through
the global array.

'handle_to_service' is called by 'service_callback'. Therefore, pass the
vchiq instance reference to 'service_callback'. This also requires
adding the vchiq instance reference to the service callbacks prototype,
and update all other callbacks accordingly.

Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20220518191126.60396-4-athierry@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 813fa44c 18-May-2022 Adrien Thierry <athierry@redhat.com>

staging: vchiq_arm: get rid of global device structure

Get rid of the global g_dev structure.

This is part of an effort to address TODO item "Get rid of all non
essential global structures and create a proper per device structure"

I chose to pass the vchiq_instance around instead of the device
reference because in order to get rid of the 'vchiq_states' global array
in the future, we will need another way to access the vchiq_state in the
'handle_to_service' function. Therefore, we will need to pass the
vchiq_instance to it (or the vchiq_state), and also pass it to functions
higher up in the caller chain, such as 'vchiq_bulk_transmit' and friends
which are used in the bcm2835-audio consumer.

Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20220518191126.60396-3-athierry@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 039510e8 03-May-2022 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

staging: vc04_services: Re-use generic struct s32_fract

Instead of custom data type re-use generic struct s32_fract.
No changes intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220504092915.72021-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 15210fd3 22-Apr-2022 ran jianping <ran.jianping@zte.com.cn>

staging: vchiq:remove unneeded flush_workqueue

All work currently pending will be done first by calling destroy_workqueue,
so there is no need to flush it explicitly.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: ran jianping <ran.jianping@zte.com.cn>
Link: https://lore.kernel.org/r/20220422093340.2781311-1-ran.jianping@zte.com.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9b630000 15-Mar-2022 Xiaoke Wang <xkernel.wang@foxmail.com>

staging: mmal-vchiq: clear redundant item named bulk_scratch

bulk_scratch is not used anywhere and the original allocation of it
does not have proper check.
Deleting it directly seems to be a good choice.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Link: https://lore.kernel.org/r/tencent_F721901366AB5C720E008AF7F02DA5D3FF07@qq.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b33721ba 05-Jan-2022 Gaston Gonzalez <gascoar@gmail.com>

staging: vc04_services: rename BM2835 to BCM2835 in headers comments

In the kernel, when referring to the chip BCM2835, it is more suitable
to use BCM2835 to BM2835. To avoid confusion, and to make things more
consistent, rename the headers titles accordingly.

Suggested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Gaston Gonzalez <gascoar@gmail.com>
Link: https://lore.kernel.org/r/19acea9e9da0d3ebb1a7e6bce511a3c09e8c80c3.1641414449.git.gascoar@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# afc023da 25-May-2021 Dave Stevenson <dave.stevenson@raspberrypi.com>

staging: mmal-vchiq: Fix incorrect static vchiq_instance.

For some reason lost in history function vchiq_mmal_init used
a static variable for storing the vchiq_instance.
This value is retrieved from vchiq per instance, so worked fine
until you try to call vchiq_mmal_init multiple times concurrently
when things then go wrong. This seemed to happen quite frequently
if using the cutdown firmware (no MMAL or VCSM services running)
as the vchiq_connect then failed, and one or other vchiq_shutdown
was working on an invalid handle.

Remove the static so that each caller gets a unique vchiq_instance.

Fixes: 7b3ad5abf027 ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/1621979857-26754-1-git-send-email-stefan.wahren@i2se.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 21ae24cc 20-Mar-2021 Bhaskar Chowdhury <unixbhaskar@gmail.com>

staging: vchiq: Typo fixes

s/sepecific/specific/
s/comonent/component/

Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Link: https://lore.kernel.org/r/20210321043629.585758-1-unixbhaskar@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b6ae84d6 26-Oct-2020 Seung-Woo Kim <sw0312.kim@samsung.com>

staging: mmal-vchiq: Fix memory leak for vchiq_instance

The vchiq_instance is allocated with vchiq_initialise() but never
freed properly. Fix memory leak for the vchiq_instance.

Reported-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Link: https://lore.kernel.org/r/1603706150-10806-1-git-send-email-sw0312.kim@samsung.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4184da4f 25-Sep-2020 Arnd Bergmann <arnd@arndb.de>

staging: vchiq: fix __user annotations

My earlier patches caused some new sparse warnings, but it turns out
that a number of those are actual bugs, or at least suspicous code.

Adding __user annotations to the data structures that are defined in
uapi headers helps avoid the new warnings, but that causes a different
set of warnings to show up, as some of these structures are used both
inside of the kernel and at the user interface but storing pointers to
different things there.

Duplicating the vchiq_service_params and vchiq_completion_data structures
in turn takes care of most of those, and then it turns out that there
is a 'data' pointer that can be any of a __user address, a dmd_addr_t
and a kernel pointer in vmalloc space at times.

I'm trying to annotate these as best I can without changing behavior,
but there still seems to be a serious bug when user space passes
a valid vmalloc space address instead of a user pointer. Adding
comments in the code there, and leaving the warnings in place that
seem to correspond to actual bugs.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20200925114424.2647144-1-arnd@arndb.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 50b2677c 22-Jul-2020 Dan Carpenter <dan.carpenter@oracle.com>

staging: vchiq: Fix refcounting bug in buffer_from_host()

If we fail to queue the buffer then it can never be dequeued. This can
lead to a forever loop in stop_streaming() when we wait for everything
to finish.

Fixes: 70ec64ccdaac ("staging: bcm2835-camera: Ensure all buffers are returned on disable")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200722130651.GC220681@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 12d95169 22-Jul-2020 Anmol Karn <anmol.karan123@gmail.com>

staging: vc04_services: vchiq-mmal: Fixed tab styling issue in mmal-vchiq.c

This cahnge fixes a checkpatch error for "code indent should use tabs where possible".

compile Tested only
[Linux-next-20200722]

Signed-off-by: Anmol Karn <anmol.karan123@gmail.com>
Link: https://lore.kernel.org/r/20200723072115.408070-1-anmol.karan123@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1e5f7325 13-Jul-2020 Baidyanath Kundu <kundubaidya99@gmail.com>

Staging: vc04_services: Fix unsigned int warnings

This patch fixes the checkpatch.pl warning:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: Baidyanath Kundu <kundubaidya99@gmail.com>
Link: https://lore.kernel.org/r/20200713143653.32332-1-kundubaidya99@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2ad4ba07 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchiq: Move vchiq.h into include directory

To make the separation clear between vchiq's header files and vchiq.h,
which is to be used by services and is the 'public' API, move it into a
dedicated includes directory.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

Link: https://lore.kernel.org/r/20200629150945.10720-48-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# dcfbf457 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchiq: Use vchiq.h as the main header file for services

This used to be vchiq_if.h but vchiq.h is more concise for an include
file that will hopefully be in the future in the includes directory.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-46-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9d523111 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchiq: Get rid of vchi

All the functions that vchi currently provides are a 1:1 mapping to its
vchiq counterparts. Get rid of vchi altogether and use vchiq's on all
services.

In the process also get rid of the vchi directory, as the only remaining
file was a TODO file, which now lives in the parent directory.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-44-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5c01fc5c 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchi: Move vchi_queue_kernel_message() into vchiq

We can't really merge it with vchiq_queue_message() as it has internal
users that will not benefit from the retry mechanism
vchiq_queue_kernel_message() uses. So, for the sake of getting rid of
vchi, move it into vchiq.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-43-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b2bbe3dc 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchi: Get rid of vchi_bulk_queue_receive()

Its vchiq counterpart, vchiq_bulk_receive() is only used by vchi. We can
then merge both functions by moving vchi_bulk_queue_receive()'s retry
mechanism into vchiq_bulk_receive() and let services call the later.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-41-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b06eba5c 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchiq: Unify fourcc definition mechanisms

There is already enough duplication with regard to fourcc generation in
the kernel. Let's at least use the same macro all over the vchiq
ecosystem.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-35-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3a8895a9 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchi: Get rid of struct vchi_service

The structure only contains a single parameter, which is the underlying
vchiq handle. Get rid of the struct and directly pass the handle around.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-32-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 65c75366 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchi: Use struct vchiq_service_params

For initialization, vchi has its own params structure, which is then
translated to vchiq's params structure. They are essentially the same,
so lets directly use vchiq's.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-31-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3c5da06f 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchi: Get rid of vchiq_shim's message callback

As vchiq_shim's callback does nothing aside from pushing messages into
the service's queue, let's bypass it and jump directly to the service's
callbacks, letting them choose whether to use the message queue.

It turns out most services don't need to use the message queue, which
makes for simpler code in the end.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-29-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 469fbb24 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchi: Use vchiq's enum vchiq_reason

enum vchi_callback_reason maps 1:1 to enum vchiq_reason, in an effort to
simplify things, let's use the later, and get rid of the extra
indirection.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-21-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0abd7412 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchi: Use enum vchiq_bulk_mode instead of vchi's transmission flags

vchi has a set of transfer flags which almost map 1:1 to vchiq's own
transfer modes. For the sake of simplicity let's use the later and
delete vchi's.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-20-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a24ac57e 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchi: Get rid of flags argument in vchi_msg_hold()

All users are ignoring the flags argument. So for the sake of
simplicity delete it.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-19-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7bfb15cc 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchi: Get rid of unnecessary defines

Those defines aren't used by anyone. Get rid of them.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-17-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5a8e22e3 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchi: Unify struct shim_service and struct vchi_service_handle

The idea behind struct vchi_service_handle is to create an opaque handle
to struct shim_service. This can be achieved by doing a forward
declaration of struct shim_service, which will avoid unwarranted casts
and pointer play.

Ultimately as a rename is due all over the vchi user space, rename
struct shim_service into struvt vchi_service, which is more consistent
with the rest of the exposed API.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

Link: https://lore.kernel.org/r/20200629150945.10720-13-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a7983fd9 29-Jun-2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

staging: vchi: Get rid of struct vchi_instance_handle

The idea behind this was to create an opaque handle to struct
vchiq_instance. This can be achieved without creating a new type by
means of a forward declaration of struct vchiq_instance.

This saves us from a lot of useless casting and overall simplifies code.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-12-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7c71d489 29-Jun-2020 Dave Stevenson <dave.stevenson@raspberrypi.org>

staging: mmal-vchiq: If the VPU returns an error, don't negate it

There is an enum for the errors that the VPU can return.
port_parameter_get was negating that value, but also using -EINVAL
from the Linux error codes.
Pass the VPU error code as positive values. Should the function
need to pass a Linux failure, then return that as negative.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-7-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 20e006b8 29-Jun-2020 Dave Stevenson <dave.stevenson@raspberrypi.org>

staging: mmal-vchiq: Always return the param size from param_get

mmal-vchiq is a reimplementation of the userland library for MMAL.
When getting a parameter, the client provides the storage and
the size of the storage. The VPU then returns the size of the
parameter that it wished to return, and as much as possible of
that parameter is returned to the client.

The implementation previously only returned the size provided
by the VPU should it exceed the buffer size. So for parameters
such as the supported encodings list the client had no idea
how much of the provided storage had been populated.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-6-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 22e64b48 29-Jun-2020 Dave Stevenson <dave.stevenson@raspberrypi.org>

staging: mmal-vchiq: Fix client_component for 64 bit kernel

The MMAL client_component field is used with the event
mechanism to allow the client to identify the component for
which the event is generated.
The field is only 32bits in size, therefore we can't use a
pointer to the component in a 64 bit kernel.

Component handles are already held in an array per VCHI
instance, so use the array index as the client_component handle
to avoid having to create a new IDR for this purpose.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-5-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 959fc47c 29-Jun-2020 Dave Stevenson <dave.stevenson@raspberrypi.org>

staging: mmal-vchiq: Make a mmal_buf struct for passing parameters

The callback from vchi_mmal to the client was growing lots of extra
parameters. Consolidate them into a single struct instead of
growing the list further.
The struct is associated with the client buffer, therefore there
are various changes to setup various containers for the struct,
and pass the appropriate members.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-3-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 481e5397 29-Jun-2020 Dave Stevenson <dave.stevenson@raspberrypi.org>

staging: mmal-vchiq: Make timeout a defined parameter

The timeout period for VPU communications is a useful thing
to extend when debugging.
Set it via a define, rather than a magic number buried in the code.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-2-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8c589e17 23-Jun-2020 Dave Stevenson <dave.stevenson@raspberrypi.org>

staging: mmal-vchiq: Allocate and free components as required

The existing code assumed that there would only ever be 4 components,
and never freed the entries once used.
Allow arbitrary creation and destruction of components.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200623164235.29566-3-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b18ee53a 23-Jun-2020 Jacopo Mondi <jacopo@jmondi.org>

staging: bcm2835: Break MMAL support out from camera

The BCM2835 camera host is currently the only component that uses the
VCHIQ MMAL interface. This will soon change with the upporting of
BCM2835 ISP, which make use of the same interface.

Break VCHIQ MMAL interface support out from camera host directory to
make it possible for the ISP driver to use it as well.

The only modification to the existing mmal code is the introduction of
EXPORT_SYMBOL() for symbols required by bcm2835-camera and the addition
of the module author and licenses.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200623164235.29566-2-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>