![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-only 0002 * 0003 * Copyright (C) 2020-21 Intel Corporation. 0004 */ 0005 0006 #ifndef IOSM_IPC_TASK_QUEUE_H 0007 #define IOSM_IPC_TASK_QUEUE_H 0008 0009 /* Number of available element for the input message queue of the IPC 0010 * ipc_task 0011 */ 0012 #define IPC_THREAD_QUEUE_SIZE 256 0013 0014 /** 0015 * struct ipc_task_queue_args - Struct for Task queue elements 0016 * @ipc_imem: Pointer to struct iosm_imem 0017 * @msg: Message argument for tasklet function. (optional, can be NULL) 0018 * @completion: OS object used to wait for the tasklet function to finish for 0019 * synchronous calls 0020 * @func: Function to be called in tasklet (tl) context 0021 * @arg: Generic integer argument for tasklet function (optional) 0022 * @size: Message size argument for tasklet function (optional) 0023 * @response: Return code of tasklet function for synchronous calls 0024 * @is_copy: Is true if msg contains a pointer to a copy of the original msg 0025 * for async. calls that needs to be freed once the tasklet returns 0026 */ 0027 struct ipc_task_queue_args { 0028 struct iosm_imem *ipc_imem; 0029 void *msg; 0030 struct completion *completion; 0031 int (*func)(struct iosm_imem *ipc_imem, int arg, void *msg, 0032 size_t size); 0033 int arg; 0034 size_t size; 0035 int response; 0036 u8 is_copy:1; 0037 }; 0038 0039 /** 0040 * struct ipc_task_queue - Struct for Task queue 0041 * @q_lock: Protect the message queue of the ipc ipc_task 0042 * @args: Message queue of the IPC ipc_task 0043 * @q_rpos: First queue element to process. 0044 * @q_wpos: First free element of the input queue. 0045 */ 0046 struct ipc_task_queue { 0047 spinlock_t q_lock; /* for atomic operation on queue */ 0048 struct ipc_task_queue_args args[IPC_THREAD_QUEUE_SIZE]; 0049 unsigned int q_rpos; 0050 unsigned int q_wpos; 0051 }; 0052 0053 /** 0054 * struct ipc_task - Struct for Task 0055 * @dev: Pointer to device structure 0056 * @ipc_tasklet: Tasklet for serialized work offload 0057 * from interrupts and OS callbacks 0058 * @ipc_queue: Task for entry into ipc task queue 0059 */ 0060 struct ipc_task { 0061 struct device *dev; 0062 struct tasklet_struct *ipc_tasklet; 0063 struct ipc_task_queue ipc_queue; 0064 }; 0065 0066 /** 0067 * ipc_task_init - Allocate a tasklet 0068 * @ipc_task: Pointer to ipc_task structure 0069 * Returns: 0 on success and failure value on error. 0070 */ 0071 int ipc_task_init(struct ipc_task *ipc_task); 0072 0073 /** 0074 * ipc_task_deinit - Free a tasklet, invalidating its pointer. 0075 * @ipc_task: Pointer to ipc_task structure 0076 */ 0077 void ipc_task_deinit(struct ipc_task *ipc_task); 0078 0079 /** 0080 * ipc_task_queue_send_task - Synchronously/Asynchronously call a function in 0081 * tasklet context. 0082 * @imem: Pointer to iosm_imem struct 0083 * @func: Function to be called in tasklet context 0084 * @arg: Integer argument for func 0085 * @msg: Message pointer argument for func 0086 * @size: Size argument for func 0087 * @wait: if true wait for result 0088 * 0089 * Returns: Result value returned by func or failure value if func could not 0090 * be called. 0091 */ 0092 int ipc_task_queue_send_task(struct iosm_imem *imem, 0093 int (*func)(struct iosm_imem *ipc_imem, int arg, 0094 void *msg, size_t size), 0095 int arg, void *msg, size_t size, bool wait); 0096 0097 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |