hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/misc/genwqe/card_ddcb.c
....@@ -1,4 +1,5 @@
1
-/**
1
+// SPDX-License-Identifier: GPL-2.0-only
2
+/*
23 * IBM Accelerator Family 'GenWQE'
34 *
45 * (C) Copyright IBM Corp. 2013
....@@ -7,15 +8,6 @@
78 * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com>
89 * Author: Michael Jung <mijung@gmx.net>
910 * Author: Michael Ruettger <michael@ibmra.de>
10
- *
11
- * This program is free software; you can redistribute it and/or modify
12
- * it under the terms of the GNU General Public License (version 2 only)
13
- * as published by the Free Software Foundation.
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- * GNU General Public License for more details.
1911 */
2012
2113 /*
....@@ -27,7 +19,6 @@
2719 */
2820
2921 #include <linux/types.h>
30
-#include <linux/module.h>
3122 #include <linux/sched.h>
3223 #include <linux/wait.h>
3324 #include <linux/pci.h>
....@@ -253,10 +244,13 @@
253244 (cd->card_state != GENWQE_CARD_USED);
254245 }
255246
247
+#define RET_DDCB_APPENDED 1
248
+#define RET_DDCB_TAPPED 2
256249 /**
257250 * enqueue_ddcb() - Enqueue a DDCB
258251 * @cd: pointer to genwqe device descriptor
259252 * @queue: queue this operation should be done on
253
+ * @pddcb: pointer to ddcb structure
260254 * @ddcb_no: pointer to ddcb number being tapped
261255 *
262256 * Start execution of DDCB by tapping or append to queue via NEXT
....@@ -268,9 +262,6 @@
268262 * Return: 1 if new DDCB is appended to previous
269263 * 2 if DDCB queue is tapped via register/simulation
270264 */
271
-#define RET_DDCB_APPENDED 1
272
-#define RET_DDCB_TAPPED 2
273
-
274265 static int enqueue_ddcb(struct genwqe_dev *cd, struct ddcb_queue *queue,
275266 struct ddcb *pddcb, int ddcb_no)
276267 {
....@@ -325,6 +316,8 @@
325316
326317 /**
327318 * copy_ddcb_results() - Copy output state from real DDCB to request
319
+ * @req: pointer to requsted DDCB parameters
320
+ * @ddcb_no: pointer to ddcb number being tapped
328321 *
329322 * Copy DDCB ASV to request struct. There is no endian
330323 * conversion made, since data structure in ASV is still
....@@ -365,6 +358,7 @@
365358 /**
366359 * genwqe_check_ddcb_queue() - Checks DDCB queue for completed work equests.
367360 * @cd: pointer to genwqe device descriptor
361
+ * @queue: queue to be checked
368362 *
369363 * Return: Number of DDCBs which were finished
370364 */
....@@ -562,6 +556,8 @@
562556 /**
563557 * get_next_ddcb() - Get next available DDCB
564558 * @cd: pointer to genwqe device descriptor
559
+ * @queue: DDCB queue
560
+ * @num: internal DDCB number
565561 *
566562 * DDCB's content is completely cleared but presets for PRE and
567563 * SEQNUM. This function must only be called when ddcb_lock is held.
....@@ -909,7 +905,7 @@
909905 /**
910906 * __genwqe_execute_raw_ddcb() - Setup and execute DDCB
911907 * @cd: pointer to genwqe device descriptor
912
- * @req: user provided DDCB request
908
+ * @cmd: user provided DDCB command
913909 * @f_flags: file mode: blocking, non-blocking
914910 */
915911 int __genwqe_execute_raw_ddcb(struct genwqe_dev *cd,
....@@ -974,6 +970,7 @@
974970
975971 /**
976972 * genwqe_next_ddcb_ready() - Figure out if the next DDCB is already finished
973
+ * @cd: pointer to genwqe device descriptor
977974 *
978975 * We use this as condition for our wait-queue code.
979976 */
....@@ -1002,6 +999,7 @@
1002999
10031000 /**
10041001 * genwqe_ddcbs_in_flight() - Check how many DDCBs are in flight
1002
+ * @cd: pointer to genwqe device descriptor
10051003 *
10061004 * Keep track on the number of DDCBs which ware currently in the
10071005 * queue. This is needed for statistics as well as conditon if we want
....@@ -1093,7 +1091,7 @@
10931091 queue->ddcb_daddr);
10941092 queue->ddcb_vaddr = NULL;
10951093 queue->ddcb_daddr = 0ull;
1096
- return -ENODEV;
1094
+ return rc;
10971095
10981096 }
10991097
....@@ -1180,6 +1178,7 @@
11801178
11811179 /**
11821180 * genwqe_card_thread() - Work thread for the DDCB queue
1181
+ * @data: pointer to genwqe device descriptor
11831182 *
11841183 * The idea is to check if there are DDCBs in processing. If there are
11851184 * some finished DDCBs, we process them and wakeup the
....@@ -1188,7 +1187,7 @@
11881187 */
11891188 static int genwqe_card_thread(void *data)
11901189 {
1191
- int should_stop = 0, rc = 0;
1190
+ int should_stop = 0;
11921191 struct genwqe_dev *cd = (struct genwqe_dev *)data;
11931192
11941193 while (!kthread_should_stop()) {
....@@ -1196,12 +1195,12 @@
11961195 genwqe_check_ddcb_queue(cd, &cd->queue);
11971196
11981197 if (GENWQE_POLLING_ENABLED) {
1199
- rc = wait_event_interruptible_timeout(
1198
+ wait_event_interruptible_timeout(
12001199 cd->queue_waitq,
12011200 genwqe_ddcbs_in_flight(cd) ||
12021201 (should_stop = kthread_should_stop()), 1);
12031202 } else {
1204
- rc = wait_event_interruptible_timeout(
1203
+ wait_event_interruptible_timeout(
12051204 cd->queue_waitq,
12061205 genwqe_next_ddcb_ready(cd) ||
12071206 (should_stop = kthread_should_stop()), HZ);
....@@ -1308,6 +1307,7 @@
13081307
13091308 /**
13101309 * queue_wake_up_all() - Handles fatal error case
1310
+ * @cd: pointer to genwqe device descriptor
13111311 *
13121312 * The PCI device got unusable and we have to stop all pending
13131313 * requests as fast as we can. The code after this must purge the
....@@ -1332,6 +1332,7 @@
13321332
13331333 /**
13341334 * genwqe_finish_queue() - Remove any genwqe devices and user-interfaces
1335
+ * @cd: pointer to genwqe device descriptor
13351336 *
13361337 * Relies on the pre-condition that there are no users of the card
13371338 * device anymore e.g. with open file-descriptors.