[sudeep-holla:ffa_notifications_proto 15/15] drivers/firmware/arm_ffa_test/test_driver_ffa.c:110:26: warning: no previous prototype for 'get_partition_struct'
From: kernel test robot
Date: Mon Oct 25 2021 - 22:15:39 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux.git ffa_notifications_proto
head: c58dfd7efd456c261212967aebc7938a7d5998be
commit: c58dfd7efd456c261212967aebc7938a7d5998be [15/15] test_ffa_driver: Add Test Driver
config: arm64-randconfig-r023-20211021 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux.git/commit/?id=c58dfd7efd456c261212967aebc7938a7d5998be
git remote add sudeep-holla https://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux.git
git fetch --no-tags sudeep-holla ffa_notifications_proto
git checkout c58dfd7efd456c261212967aebc7938a7d5998be
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
>> drivers/firmware/arm_ffa_test/test_driver_ffa.c:110:26: warning: no previous prototype for 'get_partition_struct' [-Wmissing-prototypes]
110 | struct partition_struct *get_partition_struct(ffa_partition_id_t id)
| ^~~~~~~~~~~~~~~~~~~~
>> drivers/firmware/arm_ffa_test/test_driver_ffa.c:120:20: warning: no previous prototype for 'get_ffa_dev' [-Wmissing-prototypes]
120 | struct ffa_device* get_ffa_dev(ffa_partition_id_t id)
| ^~~~~~~~~~~
>> drivers/firmware/arm_ffa_test/test_driver_ffa.c:126:15: warning: no previous prototype for 'get_partition_lock' [-Wmissing-prototypes]
126 | struct mutex *get_partition_lock(ffa_partition_id_t id)
| ^~~~~~~~~~~~~~~~~~
drivers/firmware/arm_ffa_test/test_driver_ffa.c:132:5: warning: no previous prototype for 'check_status' [-Wmissing-prototypes]
132 | int check_status(int status, int test_id) {
| ^~~~~~~~~~~~
>> drivers/firmware/arm_ffa_test/test_driver_ffa.c:147:6: warning: no previous prototype for 'schedule_receiver_handler' [-Wmissing-prototypes]
147 | void schedule_receiver_handler(ffa_partition_id_t partition_id, ffa_vcpu_id_t vcpu,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/firmware/arm_ffa_test/test_driver_ffa.c:163:6: warning: no previous prototype for 'handle_notification_callbacks' [-Wmissing-prototypes]
163 | void handle_notification_callbacks(ffa_partition_id_t partition_id,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/firmware/arm_ffa_test/test_driver_ffa.c:172:5: warning: no previous prototype for 'setup_notifications' [-Wmissing-prototypes]
172 | int setup_notifications(ffa_partition_id_t id, struct partition_struct *partition)
| ^~~~~~~~~~~~~~~~~~~
drivers/firmware/arm_ffa_test/test_driver_ffa.c:208:5: warning: no previous prototype for 'relay_message' [-Wmissing-prototypes]
208 | int relay_message(u32 message, struct partition_struct *partition, ffa_partition_id_t target)
| ^~~~~~~~~~~~~
drivers/firmware/arm_ffa_test/test_driver_ffa.c:235:5: warning: no previous prototype for 'echo_message' [-Wmissing-prototypes]
235 | int echo_message(u32 message, struct partition_struct *partition)
| ^~~~~~~~~~~~
>> drivers/firmware/arm_ffa_test/test_driver_ffa.c:261:5: warning: no previous prototype for 'p_p_notification' [-Wmissing-prototypes]
261 | int p_p_notification(struct partition_struct *from, struct partition_struct *to,
| ^~~~~~~~~~~~~~~~
>> drivers/firmware/arm_ffa_test/test_driver_ffa.c:294:5: warning: no previous prototype for 'partition_pvm_notification' [-Wmissing-prototypes]
294 | int partition_pvm_notification(struct partition_struct *partition, bool is_per_vcpu, bool delay)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/firmware/arm_ffa_test/test_driver_ffa.c:331:5: warning: no previous prototype for 'setup_and_trigger_partition_notifications' [-Wmissing-prototypes]
331 | int setup_and_trigger_partition_notifications(struct partition_struct *partition, bool is_per_vcpu)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/firmware/arm_ffa_test/test_driver_ffa.c:363:5: warning: no previous prototype for 'sp_svm_notification' [-Wmissing-prototypes]
363 | int sp_svm_notification(struct partition_struct *src, struct partition_struct *dst,
| ^~~~~~~~~~~~~~~~~~~
>> drivers/firmware/arm_ffa_test/test_driver_ffa.c:413:6: warning: no previous prototype for 'test_concurrent_notifications' [-Wmissing-prototypes]
413 | void test_concurrent_notifications(void *_) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/firmware/arm_ffa_test/test_driver_ffa.c:432:6: warning: no previous prototype for 'run_test' [-Wmissing-prototypes]
432 | long run_test(int test_id){
| ^~~~~~~~
drivers/firmware/arm_ffa_test/test_driver_ffa.c: In function 'ffa_test_driver_probe':
>> drivers/firmware/arm_ffa_test/test_driver_ffa.c:608:37: warning: variable 'data' set but not used [-Wunused-but-set-variable]
608 | struct ffa_send_direct_data data;
| ^~~~
drivers/firmware/arm_ffa_test/test_driver_ffa.c: At top level:
drivers/firmware/arm_ffa_test/test_driver_ffa.c:709:5: warning: no previous prototype for 'ff_a_test_init' [-Wmissing-prototypes]
709 | int ff_a_test_init(void)
| ^~~~~~~~~~~~~~
drivers/firmware/arm_ffa_test/test_driver_ffa.c:682:34: warning: 'int_driver_id' defined but not used [-Wunused-const-variable=]
682 | static const struct of_device_id int_driver_id[] = {
| ^~~~~~~~~~~~~
vim +/get_partition_struct +110 drivers/firmware/arm_ffa_test/test_driver_ffa.c
108
109 /* Helper function to get partition struct for VM or SP. */
> 110 struct partition_struct *get_partition_struct(ffa_partition_id_t id)
111 {
112 if ((SECURE_WORLD_PARTITION_MASK & id)) {
113 return &sp_structs[id & 0xF];
114 }
115 return &vm_structs[id & 0xF];
116 }
117
118
119 /* Helper function to get ffa device for VM or SP. */
> 120 struct ffa_device* get_ffa_dev(ffa_partition_id_t id)
121 {
122 return get_partition_struct(id)->ffa_dev;
123 }
124
125 /* Helper function to get callback for VM or SP. */
> 126 struct mutex *get_partition_lock(ffa_partition_id_t id)
127 {
128 struct partition_struct *p = get_partition_struct(id);
129 return &p->lock;
130 }
131
132 int check_status(int status, int test_id) {
133 if (status) {
134 pr_err("\n\nTEST CASE (%d) FAILED with: %d!!\n\n", test_id, status);
135 ERROR_OCCURRED = true;
136 }
137 else {
138 pr_info("Test Executed Successfully\n");
139 }
140 return status;
141 }
142
143
144 /* Partition Driver Related Function. */
145
146 /* Callback to handle Scheduler Receiver Interrupt. Run the partition and ask it to retrive its notifications. */
> 147 void schedule_receiver_handler(ffa_partition_id_t partition_id, ffa_vcpu_id_t vcpu,
148 bool is_per_vcpu, void *dev_data)
149 {
150 int ret;
151 struct ffa_send_direct_data data = { FF_A_NOTIFICATION_GET };
152 /* Send a direct request to partition to indicate that partition should retrieve it's notifications. */
153 /* Use the pointer we provided when registering the callback to run the partition directly. */
154 ret = ffa_ops->sync_send_receive(dev_data, &data);
155 while (ret == -EBUSY) {
156 pr_debug("SRC: Busy - Retrying...\n");
157 ret = ffa_ops->sync_send_receive(dev_data, &data);
158 }
159 return;
160 }
161
162 /* Callback for handling notification registered to this driver. Just print a message for now. */
> 163 void handle_notification_callbacks(ffa_partition_id_t partition_id,
164 ffa_notification_id_t notification_id, void *dev_data)
165 {
166 pr_info("Handling notification %d from partition %x on cpu: %d\n",
167 notification_id, partition_id, smp_processor_id());
168 return;
169 }
170
171 /* Test basic request of requesting notifications and providing dummy callback function. */
> 172 int setup_notifications(ffa_partition_id_t id, struct partition_struct *partition)
173 {
174 int rc;
175 int global_notification = -1;
176 int per_vcpu_notification = -1;
177 bool is_per_vcpu = false;
178
179 if (partition->ffa_dev == NULL) {
180 return -1;
181 }
182
183 /* Request a global notification. */
184 rc = ffa_ops->request_notification(partition->ffa_dev, is_per_vcpu,
185 handle_notification_callbacks, NULL);
186 if (rc < 0) {
187 pr_err("Failed to request global notification: %d\n", rc);
188 return rc;
189 }
190
191 global_notification = rc;
192 pr_debug("Global Notification %d assigned.\n", global_notification);
193
194 /* Request per vcpu notification.*/
195 is_per_vcpu = true;
196 rc = ffa_ops->request_notification(partition->ffa_dev, is_per_vcpu,
197 handle_notification_callbacks, NULL);
198 if (rc < 0) {
199 pr_err("Failed to request per vcpu notification: %d\n", rc);
200 return rc;
201 }
202 per_vcpu_notification = rc;
203 pr_debug("Per VCPU Notification %d assigned.\n", per_vcpu_notification);
204 return !((global_notification >= 0) && (per_vcpu_notification >= 0));
205 }
206
207 /* Test basic communication. Relay message PVM -> SVM -> SP and back. */
208 int relay_message(u32 message, struct partition_struct *partition, ffa_partition_id_t target)
209 {
210 int rc;
211 struct ffa_send_direct_data data = { FF_A_RELAY_MESSAGE, message, target};
212
213 if (partition->ffa_dev == NULL) {
214 return -1;
215 }
216
217
218 rc = ffa_ops->sync_send_receive(partition->ffa_dev, &data);
219 while (rc == -EBUSY) {
220 pr_debug("DIR_REQ: Busy - Retrying...\n");
221 rc = ffa_ops->sync_send_receive(partition->ffa_dev, &data);
222 }
223
224 pr_debug("Echoed data: 0x%lx 0x%lx 0x%lx\n", data.data0, data.data1, data.data2);
225 if (data.data0 != message){
226 pr_err("ERROR: Relay Test Case Failed!: %lx\n", data.data0);
227 return -1;
228 }
229 return 0;
230 }
231
232
233
234 /* Test basic communication. Echo message back. */
235 int echo_message(u32 message, struct partition_struct *partition)
236 {
237 int rc;
238 struct ffa_send_direct_data data = { FF_A_ECHO_MESSAGE, message };
239
240 if (partition->ffa_dev == NULL) {
241 return -1;
242 }
243
244 rc = ffa_ops->sync_send_receive(partition->ffa_dev, &data);
245 while (rc == -EBUSY) {
246 pr_debug("DIR_REQ: Busy - Retrying...\n");
247 rc = ffa_ops->sync_send_receive(partition->ffa_dev, &data);
248 }
249
250 pr_debug("Echoed data: 0x%lx 0x%lx 0x%lx\n", data.data0, data.data1, data.data2);
251 if (message != data.data0){
252 pr_err("ERROR: Echo Test Case to %x Failed!: %lx\n",
253 partition->ffa_dev->vm_id, data.data0);
254 return -1;
255 }
256 return 0;
257 }
258
259
260 /* Request a partition to setup and send a notification to another partition-> */
> 261 int p_p_notification(struct partition_struct *from, struct partition_struct *to,
262 bool is_per_vcpu, bool delay)
263 {
264 int rc;
265 u32 src_dst_ids;
266 u32 flags = 0;
267 struct ffa_send_direct_data data;
268
269 flags |= is_per_vcpu << 0;
270 flags |= delay << 1;
271
272 if (from->ffa_dev == NULL || to->ffa_dev == NULL) {
273 return -1;
274 }
275
276 src_dst_ids = (to->ffa_dev->vm_id & 0xFFFF) | from->ffa_dev->vm_id << 16;
277 data = (struct ffa_send_direct_data) { FF_A_P_P_NOTIFICATION_TEST, src_dst_ids, flags};
278
279 rc = ffa_ops->sync_send_receive(from->ffa_dev, &data);
280 while (rc == -EBUSY) {
281 pr_debug("DIR_REQ: Busy - Retrying...\n");
282 rc = ffa_ops->sync_send_receive(from->ffa_dev, &data);
283 }
284
285
286 pr_debug("Requesting Partition 0x%x [to Bind to SP] 0x%x\n",
287 from->ffa_dev->vm_id, to->ffa_dev->vm_id);
288
289 return data.data0;
290 }
291
292
293 /* Test sending a notification from a partiion to the PVM. */
> 294 int partition_pvm_notification(struct partition_struct *partition, bool is_per_vcpu, bool delay)
295 {
296 int rc, notification_id;
297 struct ffa_send_direct_data data;
298 u32 flags = 0;
299
300 if (partition->ffa_dev == NULL) {
301 return -1;
302 }
303 /* Request a notification for the partition to signal. */
304 rc = ffa_ops->request_notification(partition->ffa_dev, is_per_vcpu,
305 handle_notification_callbacks, NULL);
306 if (rc < 0) {
307 pr_err("Failed to request is_per_vcpu notification: %d\n", rc);
308 return rc;
309 }
310
311 notification_id = rc;
312 pr_debug("Per vcpu ?:%d Notification %d assigned for %x.\n",
313 is_per_vcpu, notification_id, partition->ffa_dev->vm_id);
314
315 flags |= is_per_vcpu << 0;
316 flags |= delay << 1;
317
318 /* Request partition to send notification back to PVM. */
319 data = (struct ffa_send_direct_data) { FF_A_NOTIFICATION_SEND, notification_id, flags };
320
321 pr_debug("Requesting partition %x to send notification to PVM\n", partition->ffa_dev->vm_id);
322 rc = ffa_ops->sync_send_receive(partition->ffa_dev, &data);
323 while (rc == -EBUSY) {
324 pr_debug("DIR_REQ: Busy - Retrying...\n");
325 rc = ffa_ops->sync_send_receive(partition->ffa_dev, &data);
326 }
327
328 return data.data0;
329 }
330
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip