@@ -3147,6 +3147,12 @@ vchiq_queue_message(unsigned int handle,
return status;
}
+enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, void *context,
+ size_t size)
+{
+ return vchiq_queue_message(handle, memcpy_copy_callback, context, size);
+}
+
void
vchiq_release_message(unsigned int handle,
struct vchiq_header *header)
@@ -587,6 +587,13 @@ lock_service(struct vchiq_service *service);
extern void
unlock_service(struct vchiq_service *service);
+extern enum vchiq_status
+vchiq_queue_message(unsigned int handle,
+ ssize_t (*copy_callback)(void *context, void *dest,
+ size_t offset, size_t maxsize),
+ void *context,
+ size_t size);
+
/* The following functions are called from vchiq_core, and external
** implementations must be provided. */
@@ -105,12 +105,8 @@ extern enum vchiq_status vchiq_close_service(unsigned int service);
extern enum vchiq_status vchiq_remove_service(unsigned int service);
extern enum vchiq_status vchiq_use_service(unsigned int service);
extern enum vchiq_status vchiq_release_service(unsigned int service);
-extern enum vchiq_status
-vchiq_queue_message(unsigned int handle,
- ssize_t (*copy_callback)(void *context, void *dest,
- size_t offset, size_t maxsize),
- void *context,
- size_t size);
+extern enum vchiq_status vchiq_queue_kernel_message(unsigned int handle,
+ void *context, size_t size);
extern void vchiq_release_message(unsigned int service,
struct vchiq_header *header);
extern enum vchiq_status vchiq_bulk_transmit(unsigned int service,
@@ -99,20 +99,15 @@ EXPORT_SYMBOL(vchi_msg_remove);
*
***********************************************************/
static
-int32_t vchi_msg_queue(struct vchi_service_handle *handle,
- ssize_t (*copy_callback)(void *context, void *dest,
- size_t offset, size_t maxsize),
- void *context,
- uint32_t data_size)
+int32_t vchi_msg_queue(struct vchi_service_handle *handle, void *context,
+ uint32_t data_size)
{
struct shim_service *service = (struct shim_service *)handle;
enum vchiq_status status;
while (1) {
- status = vchiq_queue_message(service->handle,
- copy_callback,
- context,
- data_size);
+ status = vchiq_queue_kernel_message(service->handle, context,
+ data_size);
/*
* vchiq_queue_message() may return VCHIQ_RETRY, so we need to
@@ -128,25 +123,10 @@ int32_t vchi_msg_queue(struct vchi_service_handle *handle,
return vchiq_status_to_vchi(status);
}
-static ssize_t
-vchi_queue_kernel_message_callback(void *context,
- void *dest,
- size_t offset,
- size_t maxsize)
+int vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data,
+ unsigned int size)
{
- memcpy(dest, context + offset, maxsize);
- return maxsize;
-}
-
-int
-vchi_queue_kernel_message(struct vchi_service_handle *handle,
- void *data,
- unsigned int size)
-{
- return vchi_msg_queue(handle,
- vchi_queue_kernel_message_callback,
- data,
- size);
+ return vchi_msg_queue(handle, data, size);
}
EXPORT_SYMBOL(vchi_queue_kernel_message);
All vchi users use the kernel variant of the copy callback. The only user for the user space variant of the copy callback is in the ioctl implementation. So move all this copying logic into vchiq, and expose a new function that explicitly passes kernel messages. Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> --- .../interface/vchiq_arm/vchiq_core.c | 6 ++++ .../interface/vchiq_arm/vchiq_core.h | 7 ++++ .../interface/vchiq_arm/vchiq_if.h | 8 ++--- .../interface/vchiq_arm/vchiq_shim.c | 34 ++++--------------- 4 files changed, 22 insertions(+), 33 deletions(-)