aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/s390/crypto/ap_bus.c189
-rw-r--r--drivers/s390/crypto/ap_bus.h15
-rw-r--r--drivers/s390/crypto/zcrypt_api.c63
-rw-r--r--drivers/s390/crypto/zcrypt_cca_key.h4
-rw-r--r--drivers/s390/crypto/zcrypt_error.h2
-rw-r--r--drivers/s390/crypto/zcrypt_pcicc.c4
-rw-r--r--drivers/s390/crypto/zcrypt_pcixcc.c2
7 files changed, 184 insertions, 95 deletions
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index 7b0b81901297..a1ab3e3efd11 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -45,7 +45,7 @@ static int ap_poll_thread_start(void);
45static void ap_poll_thread_stop(void); 45static void ap_poll_thread_stop(void);
46static void ap_request_timeout(unsigned long); 46static void ap_request_timeout(unsigned long);
47 47
48/** 48/*
49 * Module description. 49 * Module description.
50 */ 50 */
51MODULE_AUTHOR("IBM Corporation"); 51MODULE_AUTHOR("IBM Corporation");
@@ -53,7 +53,7 @@ MODULE_DESCRIPTION("Adjunct Processor Bus driver, "
53 "Copyright 2006 IBM Corporation"); 53 "Copyright 2006 IBM Corporation");
54MODULE_LICENSE("GPL"); 54MODULE_LICENSE("GPL");
55 55
56/** 56/*
57 * Module parameter 57 * Module parameter
58 */ 58 */
59int ap_domain_index = -1; /* Adjunct Processor Domain Index */ 59int ap_domain_index = -1; /* Adjunct Processor Domain Index */
@@ -69,7 +69,7 @@ static struct device *ap_root_device = NULL;
69static DEFINE_SPINLOCK(ap_device_lock); 69static DEFINE_SPINLOCK(ap_device_lock);
70static LIST_HEAD(ap_device_list); 70static LIST_HEAD(ap_device_list);
71 71
72/** 72/*
73 * Workqueue & timer for bus rescan. 73 * Workqueue & timer for bus rescan.
74 */ 74 */
75static struct workqueue_struct *ap_work_queue; 75static struct workqueue_struct *ap_work_queue;
@@ -77,7 +77,7 @@ static struct timer_list ap_config_timer;
77static int ap_config_time = AP_CONFIG_TIME; 77static int ap_config_time = AP_CONFIG_TIME;
78static DECLARE_WORK(ap_config_work, ap_scan_bus); 78static DECLARE_WORK(ap_config_work, ap_scan_bus);
79 79
80/** 80/*
81 * Tasklet & timer for AP request polling. 81 * Tasklet & timer for AP request polling.
82 */ 82 */
83static struct timer_list ap_poll_timer = TIMER_INITIALIZER(ap_poll_timeout,0,0); 83static struct timer_list ap_poll_timer = TIMER_INITIALIZER(ap_poll_timeout,0,0);
@@ -88,9 +88,9 @@ static struct task_struct *ap_poll_kthread = NULL;
88static DEFINE_MUTEX(ap_poll_thread_mutex); 88static DEFINE_MUTEX(ap_poll_thread_mutex);
89 89
90/** 90/**
91 * Test if ap instructions are available. 91 * ap_intructions_available() - Test if AP instructions are available.
92 * 92 *
93 * Returns 0 if the ap instructions are installed. 93 * Returns 0 if the AP instructions are installed.
94 */ 94 */
95static inline int ap_instructions_available(void) 95static inline int ap_instructions_available(void)
96{ 96{
@@ -108,12 +108,12 @@ static inline int ap_instructions_available(void)
108} 108}
109 109
110/** 110/**
111 * Test adjunct processor queue. 111 * ap_test_queue(): Test adjunct processor queue.
112 * @qid: the ap queue number 112 * @qid: The AP queue number
113 * @queue_depth: pointer to queue depth value 113 * @queue_depth: Pointer to queue depth value
114 * @device_type: pointer to device type value 114 * @device_type: Pointer to device type value
115 * 115 *
116 * Returns ap queue status structure. 116 * Returns AP queue status structure.
117 */ 117 */
118static inline struct ap_queue_status 118static inline struct ap_queue_status
119ap_test_queue(ap_qid_t qid, int *queue_depth, int *device_type) 119ap_test_queue(ap_qid_t qid, int *queue_depth, int *device_type)
@@ -130,10 +130,10 @@ ap_test_queue(ap_qid_t qid, int *queue_depth, int *device_type)
130} 130}
131 131
132/** 132/**
133 * Reset adjunct processor queue. 133 * ap_reset_queue(): Reset adjunct processor queue.
134 * @qid: the ap queue number 134 * @qid: The AP queue number
135 * 135 *
136 * Returns ap queue status structure. 136 * Returns AP queue status structure.
137 */ 137 */
138static inline struct ap_queue_status ap_reset_queue(ap_qid_t qid) 138static inline struct ap_queue_status ap_reset_queue(ap_qid_t qid)
139{ 139{
@@ -148,16 +148,14 @@ static inline struct ap_queue_status ap_reset_queue(ap_qid_t qid)
148} 148}
149 149
150/** 150/**
151 * Send message to adjunct processor queue. 151 * __ap_send(): Send message to adjunct processor queue.
152 * @qid: the ap queue number 152 * @qid: The AP queue number
153 * @psmid: the program supplied message identifier 153 * @psmid: The program supplied message identifier
154 * @msg: the message text 154 * @msg: The message text
155 * @length: the message length 155 * @length: The message length
156 *
157 * Returns ap queue status structure.
158 * 156 *
157 * Returns AP queue status structure.
159 * Condition code 1 on NQAP can't happen because the L bit is 1. 158 * Condition code 1 on NQAP can't happen because the L bit is 1.
160 *
161 * Condition code 2 on NQAP also means the send is incomplete, 159 * Condition code 2 on NQAP also means the send is incomplete,
162 * because a segment boundary was reached. The NQAP is repeated. 160 * because a segment boundary was reached. The NQAP is repeated.
163 */ 161 */
@@ -198,23 +196,20 @@ int ap_send(ap_qid_t qid, unsigned long long psmid, void *msg, size_t length)
198} 196}
199EXPORT_SYMBOL(ap_send); 197EXPORT_SYMBOL(ap_send);
200 198
201/* 199/**
202 * Receive message from adjunct processor queue. 200 * __ap_recv(): Receive message from adjunct processor queue.
203 * @qid: the ap queue number 201 * @qid: The AP queue number
204 * @psmid: pointer to program supplied message identifier 202 * @psmid: Pointer to program supplied message identifier
205 * @msg: the message text 203 * @msg: The message text
206 * @length: the message length 204 * @length: The message length
207 *
208 * Returns ap queue status structure.
209 * 205 *
206 * Returns AP queue status structure.
210 * Condition code 1 on DQAP means the receive has taken place 207 * Condition code 1 on DQAP means the receive has taken place
211 * but only partially. The response is incomplete, hence the 208 * but only partially. The response is incomplete, hence the
212 * DQAP is repeated. 209 * DQAP is repeated.
213 *
214 * Condition code 2 on DQAP also means the receive is incomplete, 210 * Condition code 2 on DQAP also means the receive is incomplete,
215 * this time because a segment boundary was reached. Again, the 211 * this time because a segment boundary was reached. Again, the
216 * DQAP is repeated. 212 * DQAP is repeated.
217 *
218 * Note that gpr2 is used by the DQAP instruction to keep track of 213 * Note that gpr2 is used by the DQAP instruction to keep track of
219 * any 'residual' length, in case the instruction gets interrupted. 214 * any 'residual' length, in case the instruction gets interrupted.
220 * Hence it gets zeroed before the instruction. 215 * Hence it gets zeroed before the instruction.
@@ -263,11 +258,12 @@ int ap_recv(ap_qid_t qid, unsigned long long *psmid, void *msg, size_t length)
263EXPORT_SYMBOL(ap_recv); 258EXPORT_SYMBOL(ap_recv);
264 259
265/** 260/**
266 * Check if an AP queue is available. The test is repeated for 261 * ap_query_queue(): Check if an AP queue is available.
267 * AP_MAX_RESET times. 262 * @qid: The AP queue number
268 * @qid: the ap queue number 263 * @queue_depth: Pointer to queue depth value
269 * @queue_depth: pointer to queue depth value 264 * @device_type: Pointer to device type value
270 * @device_type: pointer to device type value 265 *
266 * The test is repeated for AP_MAX_RESET times.
271 */ 267 */
272static int ap_query_queue(ap_qid_t qid, int *queue_depth, int *device_type) 268static int ap_query_queue(ap_qid_t qid, int *queue_depth, int *device_type)
273{ 269{
@@ -308,8 +304,10 @@ static int ap_query_queue(ap_qid_t qid, int *queue_depth, int *device_type)
308} 304}
309 305
310/** 306/**
307 * ap_init_queue(): Reset an AP queue.
308 * @qid: The AP queue number
309 *
311 * Reset an AP queue and wait for it to become available again. 310 * Reset an AP queue and wait for it to become available again.
312 * @qid: the ap queue number
313 */ 311 */
314static int ap_init_queue(ap_qid_t qid) 312static int ap_init_queue(ap_qid_t qid)
315{ 313{
@@ -346,7 +344,10 @@ static int ap_init_queue(ap_qid_t qid)
346} 344}
347 345
348/** 346/**
349 * Arm request timeout if a AP device was idle and a new request is submitted. 347 * ap_increase_queue_count(): Arm request timeout.
348 * @ap_dev: Pointer to an AP device.
349 *
350 * Arm request timeout if an AP device was idle and a new request is submitted.
350 */ 351 */
351static void ap_increase_queue_count(struct ap_device *ap_dev) 352static void ap_increase_queue_count(struct ap_device *ap_dev)
352{ 353{
@@ -360,7 +361,10 @@ static void ap_increase_queue_count(struct ap_device *ap_dev)
360} 361}
361 362
362/** 363/**
363 * AP device is still alive, re-schedule request timeout if there are still 364 * ap_decrease_queue_count(): Decrease queue count.
365 * @ap_dev: Pointer to an AP device.
366 *
367 * If AP device is still alive, re-schedule request timeout if there are still
364 * pending requests. 368 * pending requests.
365 */ 369 */
366static void ap_decrease_queue_count(struct ap_device *ap_dev) 370static void ap_decrease_queue_count(struct ap_device *ap_dev)
@@ -371,7 +375,7 @@ static void ap_decrease_queue_count(struct ap_device *ap_dev)
371 if (ap_dev->queue_count > 0) 375 if (ap_dev->queue_count > 0)
372 mod_timer(&ap_dev->timeout, jiffies + timeout); 376 mod_timer(&ap_dev->timeout, jiffies + timeout);
373 else 377 else
374 /** 378 /*
375 * The timeout timer should to be disabled now - since 379 * The timeout timer should to be disabled now - since
376 * del_timer_sync() is very expensive, we just tell via the 380 * del_timer_sync() is very expensive, we just tell via the
377 * reset flag to ignore the pending timeout timer. 381 * reset flag to ignore the pending timeout timer.
@@ -379,7 +383,7 @@ static void ap_decrease_queue_count(struct ap_device *ap_dev)
379 ap_dev->reset = AP_RESET_IGNORE; 383 ap_dev->reset = AP_RESET_IGNORE;
380} 384}
381 385
382/** 386/*
383 * AP device related attributes. 387 * AP device related attributes.
384 */ 388 */
385static ssize_t ap_hwtype_show(struct device *dev, 389static ssize_t ap_hwtype_show(struct device *dev,
@@ -433,6 +437,10 @@ static struct attribute_group ap_dev_attr_group = {
433}; 437};
434 438
435/** 439/**
440 * ap_bus_match()
441 * @dev: Pointer to device
442 * @drv: Pointer to device_driver
443 *
436 * AP bus driver registration/unregistration. 444 * AP bus driver registration/unregistration.
437 */ 445 */
438static int ap_bus_match(struct device *dev, struct device_driver *drv) 446static int ap_bus_match(struct device *dev, struct device_driver *drv)
@@ -441,7 +449,7 @@ static int ap_bus_match(struct device *dev, struct device_driver *drv)
441 struct ap_driver *ap_drv = to_ap_drv(drv); 449 struct ap_driver *ap_drv = to_ap_drv(drv);
442 struct ap_device_id *id; 450 struct ap_device_id *id;
443 451
444 /** 452 /*
445 * Compare device type of the device with the list of 453 * Compare device type of the device with the list of
446 * supported types of the device_driver. 454 * supported types of the device_driver.
447 */ 455 */
@@ -455,8 +463,12 @@ static int ap_bus_match(struct device *dev, struct device_driver *drv)
455} 463}
456 464
457/** 465/**
458 * uevent function for AP devices. It sets up a single environment 466 * ap_uevent(): Uevent function for AP devices.
459 * variable DEV_TYPE which contains the hardware device type. 467 * @dev: Pointer to device
468 * @env: Pointer to kobj_uevent_env
469 *
470 * It sets up a single environment variable DEV_TYPE which contains the
471 * hardware device type.
460 */ 472 */
461static int ap_uevent (struct device *dev, struct kobj_uevent_env *env) 473static int ap_uevent (struct device *dev, struct kobj_uevent_env *env)
462{ 474{
@@ -500,8 +512,10 @@ static int ap_device_probe(struct device *dev)
500} 512}
501 513
502/** 514/**
515 * __ap_flush_queue(): Flush requests.
516 * @ap_dev: Pointer to the AP device
517 *
503 * Flush all requests from the request/pending queue of an AP device. 518 * Flush all requests from the request/pending queue of an AP device.
504 * @ap_dev: pointer to the AP device.
505 */ 519 */
506static void __ap_flush_queue(struct ap_device *ap_dev) 520static void __ap_flush_queue(struct ap_device *ap_dev)
507{ 521{
@@ -565,7 +579,7 @@ void ap_driver_unregister(struct ap_driver *ap_drv)
565} 579}
566EXPORT_SYMBOL(ap_driver_unregister); 580EXPORT_SYMBOL(ap_driver_unregister);
567 581
568/** 582/*
569 * AP bus attributes. 583 * AP bus attributes.
570 */ 584 */
571static ssize_t ap_domain_show(struct bus_type *bus, char *buf) 585static ssize_t ap_domain_show(struct bus_type *bus, char *buf)
@@ -630,14 +644,16 @@ static struct bus_attribute *const ap_bus_attrs[] = {
630}; 644};
631 645
632/** 646/**
633 * Pick one of the 16 ap domains. 647 * ap_select_domain(): Select an AP domain.
648 *
649 * Pick one of the 16 AP domains.
634 */ 650 */
635static int ap_select_domain(void) 651static int ap_select_domain(void)
636{ 652{
637 int queue_depth, device_type, count, max_count, best_domain; 653 int queue_depth, device_type, count, max_count, best_domain;
638 int rc, i, j; 654 int rc, i, j;
639 655
640 /** 656 /*
641 * We want to use a single domain. Either the one specified with 657 * We want to use a single domain. Either the one specified with
642 * the "domain=" parameter or the domain with the maximum number 658 * the "domain=" parameter or the domain with the maximum number
643 * of devices. 659 * of devices.
@@ -669,8 +685,10 @@ static int ap_select_domain(void)
669} 685}
670 686
671/** 687/**
672 * Find the device type if query queue returned a device type of 0. 688 * ap_probe_device_type(): Find the device type of an AP.
673 * @ap_dev: pointer to the AP device. 689 * @ap_dev: pointer to the AP device.
690 *
691 * Find the device type if query queue returned a device type of 0.
674 */ 692 */
675static int ap_probe_device_type(struct ap_device *ap_dev) 693static int ap_probe_device_type(struct ap_device *ap_dev)
676{ 694{
@@ -764,7 +782,11 @@ out:
764} 782}
765 783
766/** 784/**
767 * Scan the ap bus for new devices. 785 * __ap_scan_bus(): Scan the AP bus.
786 * @dev: Pointer to device
787 * @data: Pointer to data
788 *
789 * Scan the AP bus for new devices.
768 */ 790 */
769static int __ap_scan_bus(struct device *dev, void *data) 791static int __ap_scan_bus(struct device *dev, void *data)
770{ 792{
@@ -867,6 +889,8 @@ ap_config_timeout(unsigned long ptr)
867} 889}
868 890
869/** 891/**
892 * ap_schedule_poll_timer(): Schedule poll timer.
893 *
870 * Set up the timer to run the poll tasklet 894 * Set up the timer to run the poll tasklet
871 */ 895 */
872static inline void ap_schedule_poll_timer(void) 896static inline void ap_schedule_poll_timer(void)
@@ -877,10 +901,11 @@ static inline void ap_schedule_poll_timer(void)
877} 901}
878 902
879/** 903/**
880 * Receive pending reply messages from an AP device. 904 * ap_poll_read(): Receive pending reply messages from an AP device.
881 * @ap_dev: pointer to the AP device 905 * @ap_dev: pointer to the AP device
882 * @flags: pointer to control flags, bit 2^0 is set if another poll is 906 * @flags: pointer to control flags, bit 2^0 is set if another poll is
883 * required, bit 2^1 is set if the poll timer needs to get armed 907 * required, bit 2^1 is set if the poll timer needs to get armed
908 *
884 * Returns 0 if the device is still present, -ENODEV if not. 909 * Returns 0 if the device is still present, -ENODEV if not.
885 */ 910 */
886static int ap_poll_read(struct ap_device *ap_dev, unsigned long *flags) 911static int ap_poll_read(struct ap_device *ap_dev, unsigned long *flags)
@@ -925,10 +950,11 @@ static int ap_poll_read(struct ap_device *ap_dev, unsigned long *flags)
925} 950}
926 951
927/** 952/**
928 * Send messages from the request queue to an AP device. 953 * ap_poll_write(): Send messages from the request queue to an AP device.
929 * @ap_dev: pointer to the AP device 954 * @ap_dev: pointer to the AP device
930 * @flags: pointer to control flags, bit 2^0 is set if another poll is 955 * @flags: pointer to control flags, bit 2^0 is set if another poll is
931 * required, bit 2^1 is set if the poll timer needs to get armed 956 * required, bit 2^1 is set if the poll timer needs to get armed
957 *
932 * Returns 0 if the device is still present, -ENODEV if not. 958 * Returns 0 if the device is still present, -ENODEV if not.
933 */ 959 */
934static int ap_poll_write(struct ap_device *ap_dev, unsigned long *flags) 960static int ap_poll_write(struct ap_device *ap_dev, unsigned long *flags)
@@ -968,11 +994,13 @@ static int ap_poll_write(struct ap_device *ap_dev, unsigned long *flags)
968} 994}
969 995
970/** 996/**
971 * Poll AP device for pending replies and send new messages. If either 997 * ap_poll_queue(): Poll AP device for pending replies and send new messages.
972 * ap_poll_read or ap_poll_write returns -ENODEV unregister the device.
973 * @ap_dev: pointer to the bus device 998 * @ap_dev: pointer to the bus device
974 * @flags: pointer to control flags, bit 2^0 is set if another poll is 999 * @flags: pointer to control flags, bit 2^0 is set if another poll is
975 * required, bit 2^1 is set if the poll timer needs to get armed 1000 * required, bit 2^1 is set if the poll timer needs to get armed
1001 *
1002 * Poll AP device for pending replies and send new messages. If either
1003 * ap_poll_read or ap_poll_write returns -ENODEV unregister the device.
976 * Returns 0. 1004 * Returns 0.
977 */ 1005 */
978static inline int ap_poll_queue(struct ap_device *ap_dev, unsigned long *flags) 1006static inline int ap_poll_queue(struct ap_device *ap_dev, unsigned long *flags)
@@ -986,9 +1014,11 @@ static inline int ap_poll_queue(struct ap_device *ap_dev, unsigned long *flags)
986} 1014}
987 1015
988/** 1016/**
989 * Queue a message to a device. 1017 * __ap_queue_message(): Queue a message to a device.
990 * @ap_dev: pointer to the AP device 1018 * @ap_dev: pointer to the AP device
991 * @ap_msg: the message to be queued 1019 * @ap_msg: the message to be queued
1020 *
1021 * Queue a message to a device. Returns 0 if successful.
992 */ 1022 */
993static int __ap_queue_message(struct ap_device *ap_dev, struct ap_message *ap_msg) 1023static int __ap_queue_message(struct ap_device *ap_dev, struct ap_message *ap_msg)
994{ 1024{
@@ -1055,12 +1085,14 @@ void ap_queue_message(struct ap_device *ap_dev, struct ap_message *ap_msg)
1055EXPORT_SYMBOL(ap_queue_message); 1085EXPORT_SYMBOL(ap_queue_message);
1056 1086
1057/** 1087/**
1088 * ap_cancel_message(): Cancel a crypto request.
1089 * @ap_dev: The AP device that has the message queued
1090 * @ap_msg: The message that is to be removed
1091 *
1058 * Cancel a crypto request. This is done by removing the request 1092 * Cancel a crypto request. This is done by removing the request
1059 * from the devive pendingq or requestq queue. Note that the 1093 * from the device pending or request queue. Note that the
1060 * request stays on the AP queue. When it finishes the message 1094 * request stays on the AP queue. When it finishes the message
1061 * reply will be discarded because the psmid can't be found. 1095 * reply will be discarded because the psmid can't be found.
1062 * @ap_dev: AP device that has the message queued
1063 * @ap_msg: the message that is to be removed
1064 */ 1096 */
1065void ap_cancel_message(struct ap_device *ap_dev, struct ap_message *ap_msg) 1097void ap_cancel_message(struct ap_device *ap_dev, struct ap_message *ap_msg)
1066{ 1098{
@@ -1082,7 +1114,10 @@ void ap_cancel_message(struct ap_device *ap_dev, struct ap_message *ap_msg)
1082EXPORT_SYMBOL(ap_cancel_message); 1114EXPORT_SYMBOL(ap_cancel_message);
1083 1115
1084/** 1116/**
1085 * AP receive polling for finished AP requests 1117 * ap_poll_timeout(): AP receive polling for finished AP requests.
1118 * @unused: Unused variable.
1119 *
1120 * Schedules the AP tasklet.
1086 */ 1121 */
1087static void ap_poll_timeout(unsigned long unused) 1122static void ap_poll_timeout(unsigned long unused)
1088{ 1123{
@@ -1090,6 +1125,9 @@ static void ap_poll_timeout(unsigned long unused)
1090} 1125}
1091 1126
1092/** 1127/**
1128 * ap_reset(): Reset a not responding AP device.
1129 * @ap_dev: Pointer to the AP device
1130 *
1093 * Reset a not responding AP device and move all requests from the 1131 * Reset a not responding AP device and move all requests from the
1094 * pending queue to the request queue. 1132 * pending queue to the request queue.
1095 */ 1133 */
@@ -1108,11 +1146,6 @@ static void ap_reset(struct ap_device *ap_dev)
1108 ap_dev->unregistered = 1; 1146 ap_dev->unregistered = 1;
1109} 1147}
1110 1148
1111/**
1112 * Poll all AP devices on the bus in a round robin fashion. Continue
1113 * polling until bit 2^0 of the control flags is not set. If bit 2^1
1114 * of the control flags has been set arm the poll timer.
1115 */
1116static int __ap_poll_all(struct ap_device *ap_dev, unsigned long *flags) 1149static int __ap_poll_all(struct ap_device *ap_dev, unsigned long *flags)
1117{ 1150{
1118 spin_lock(&ap_dev->lock); 1151 spin_lock(&ap_dev->lock);
@@ -1126,6 +1159,14 @@ static int __ap_poll_all(struct ap_device *ap_dev, unsigned long *flags)
1126 return 0; 1159 return 0;
1127} 1160}
1128 1161
1162/**
1163 * ap_poll_all(): Poll all AP devices.
1164 * @dummy: Unused variable
1165 *
1166 * Poll all AP devices on the bus in a round robin fashion. Continue
1167 * polling until bit 2^0 of the control flags is not set. If bit 2^1
1168 * of the control flags has been set arm the poll timer.
1169 */
1129static void ap_poll_all(unsigned long dummy) 1170static void ap_poll_all(unsigned long dummy)
1130{ 1171{
1131 unsigned long flags; 1172 unsigned long flags;
@@ -1144,6 +1185,9 @@ static void ap_poll_all(unsigned long dummy)
1144} 1185}
1145 1186
1146/** 1187/**
1188 * ap_poll_thread(): Thread that polls for finished requests.
1189 * @data: Unused pointer
1190 *
1147 * AP bus poll thread. The purpose of this thread is to poll for 1191 * AP bus poll thread. The purpose of this thread is to poll for
1148 * finished requests in a loop if there is a "free" cpu - that is 1192 * finished requests in a loop if there is a "free" cpu - that is
1149 * a cpu that doesn't have anything better to do. The polling stops 1193 * a cpu that doesn't have anything better to do. The polling stops
@@ -1213,7 +1257,10 @@ static void ap_poll_thread_stop(void)
1213} 1257}
1214 1258
1215/** 1259/**
1216 * Handling of request timeouts 1260 * ap_request_timeout(): Handling of request timeouts
1261 * @data: Holds the AP device.
1262 *
1263 * Handles request timeouts.
1217 */ 1264 */
1218static void ap_request_timeout(unsigned long data) 1265static void ap_request_timeout(unsigned long data)
1219{ 1266{
@@ -1246,7 +1293,9 @@ static struct reset_call ap_reset_call = {
1246}; 1293};
1247 1294
1248/** 1295/**
1249 * The module initialization code. 1296 * ap_module_init(): The module initialization code.
1297 *
1298 * Initializes the module.
1250 */ 1299 */
1251int __init ap_module_init(void) 1300int __init ap_module_init(void)
1252{ 1301{
@@ -1288,7 +1337,7 @@ int __init ap_module_init(void)
1288 if (ap_select_domain() == 0) 1337 if (ap_select_domain() == 0)
1289 ap_scan_bus(NULL); 1338 ap_scan_bus(NULL);
1290 1339
1291 /* Setup the ap bus rescan timer. */ 1340 /* Setup the AP bus rescan timer. */
1292 init_timer(&ap_config_timer); 1341 init_timer(&ap_config_timer);
1293 ap_config_timer.function = ap_config_timeout; 1342 ap_config_timer.function = ap_config_timeout;
1294 ap_config_timer.data = 0; 1343 ap_config_timer.data = 0;
@@ -1325,7 +1374,9 @@ static int __ap_match_all(struct device *dev, void *data)
1325} 1374}
1326 1375
1327/** 1376/**
1328 * The module termination code 1377 * ap_modules_exit(): The module termination code
1378 *
1379 * Terminates the module.
1329 */ 1380 */
1330void ap_module_exit(void) 1381void ap_module_exit(void)
1331{ 1382{
diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h
index 87c2d6442875..c1e1200c43fc 100644
--- a/drivers/s390/crypto/ap_bus.h
+++ b/drivers/s390/crypto/ap_bus.h
@@ -50,6 +50,15 @@ typedef unsigned int ap_qid_t;
50#define AP_QID_QUEUE(_qid) ((_qid) & 15) 50#define AP_QID_QUEUE(_qid) ((_qid) & 15)
51 51
52/** 52/**
53 * structy ap_queue_status - Holds the AP queue status.
54 * @queue_empty: Shows if queue is empty
55 * @replies_waiting: Waiting replies
56 * @queue_full: Is 1 if the queue is full
57 * @pad: A 4 bit pad
58 * @int_enabled: Shows if interrupts are enabled for the AP
59 * @response_conde: Holds the 8 bit response code
60 * @pad2: A 16 bit pad
61 *
53 * The ap queue status word is returned by all three AP functions 62 * The ap queue status word is returned by all three AP functions
54 * (PQAP, NQAP and DQAP). There's a set of flags in the first 63 * (PQAP, NQAP and DQAP). There's a set of flags in the first
55 * byte, followed by a 1 byte response code. 64 * byte, followed by a 1 byte response code.
@@ -75,7 +84,7 @@ struct ap_queue_status {
75#define AP_RESPONSE_NO_FIRST_PART 0x13 84#define AP_RESPONSE_NO_FIRST_PART 0x13
76#define AP_RESPONSE_MESSAGE_TOO_BIG 0x15 85#define AP_RESPONSE_MESSAGE_TOO_BIG 0x15
77 86
78/** 87/*
79 * Known device types 88 * Known device types
80 */ 89 */
81#define AP_DEVICE_TYPE_PCICC 3 90#define AP_DEVICE_TYPE_PCICC 3
@@ -84,7 +93,7 @@ struct ap_queue_status {
84#define AP_DEVICE_TYPE_CEX2A 6 93#define AP_DEVICE_TYPE_CEX2A 6
85#define AP_DEVICE_TYPE_CEX2C 7 94#define AP_DEVICE_TYPE_CEX2C 7
86 95
87/** 96/*
88 * AP reset flag states 97 * AP reset flag states
89 */ 98 */
90#define AP_RESET_IGNORE 0 /* request timeout will be ignored */ 99#define AP_RESET_IGNORE 0 /* request timeout will be ignored */
@@ -152,7 +161,7 @@ struct ap_message {
152 .dev_type=(dt), \ 161 .dev_type=(dt), \
153 .match_flags=AP_DEVICE_ID_MATCH_DEVICE_TYPE, 162 .match_flags=AP_DEVICE_ID_MATCH_DEVICE_TYPE,
154 163
155/** 164/*
156 * Note: don't use ap_send/ap_recv after using ap_queue_message 165 * Note: don't use ap_send/ap_recv after using ap_queue_message
157 * for the first time. Otherwise the ap message queue will get 166 * for the first time. Otherwise the ap message queue will get
158 * confused. 167 * confused.
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
index b2740ff2e615..4d36e805a234 100644
--- a/drivers/s390/crypto/zcrypt_api.c
+++ b/drivers/s390/crypto/zcrypt_api.c
@@ -40,7 +40,7 @@
40 40
41#include "zcrypt_api.h" 41#include "zcrypt_api.h"
42 42
43/** 43/*
44 * Module description. 44 * Module description.
45 */ 45 */
46MODULE_AUTHOR("IBM Corporation"); 46MODULE_AUTHOR("IBM Corporation");
@@ -56,7 +56,7 @@ static atomic_t zcrypt_open_count = ATOMIC_INIT(0);
56static int zcrypt_rng_device_add(void); 56static int zcrypt_rng_device_add(void);
57static void zcrypt_rng_device_remove(void); 57static void zcrypt_rng_device_remove(void);
58 58
59/** 59/*
60 * Device attributes common for all crypto devices. 60 * Device attributes common for all crypto devices.
61 */ 61 */
62static ssize_t zcrypt_type_show(struct device *dev, 62static ssize_t zcrypt_type_show(struct device *dev,
@@ -103,6 +103,9 @@ static struct attribute_group zcrypt_device_attr_group = {
103}; 103};
104 104
105/** 105/**
106 * __zcrypt_increase_preference(): Increase preference of a crypto device.
107 * @zdev: Pointer the crypto device
108 *
106 * Move the device towards the head of the device list. 109 * Move the device towards the head of the device list.
107 * Need to be called while holding the zcrypt device list lock. 110 * Need to be called while holding the zcrypt device list lock.
108 * Note: cards with speed_rating of 0 are kept at the end of the list. 111 * Note: cards with speed_rating of 0 are kept at the end of the list.
@@ -129,6 +132,9 @@ static void __zcrypt_increase_preference(struct zcrypt_device *zdev)
129} 132}
130 133
131/** 134/**
135 * __zcrypt_decrease_preference(): Decrease preference of a crypto device.
136 * @zdev: Pointer to a crypto device.
137 *
132 * Move the device towards the tail of the device list. 138 * Move the device towards the tail of the device list.
133 * Need to be called while holding the zcrypt device list lock. 139 * Need to be called while holding the zcrypt device list lock.
134 * Note: cards with speed_rating of 0 are kept at the end of the list. 140 * Note: cards with speed_rating of 0 are kept at the end of the list.
@@ -202,7 +208,10 @@ void zcrypt_device_free(struct zcrypt_device *zdev)
202EXPORT_SYMBOL(zcrypt_device_free); 208EXPORT_SYMBOL(zcrypt_device_free);
203 209
204/** 210/**
205 * Register a crypto device. 211 * zcrypt_device_register() - Register a crypto device.
212 * @zdev: Pointer to a crypto device
213 *
214 * Register a crypto device. Returns 0 if successful.
206 */ 215 */
207int zcrypt_device_register(struct zcrypt_device *zdev) 216int zcrypt_device_register(struct zcrypt_device *zdev)
208{ 217{
@@ -242,6 +251,9 @@ out:
242EXPORT_SYMBOL(zcrypt_device_register); 251EXPORT_SYMBOL(zcrypt_device_register);
243 252
244/** 253/**
254 * zcrypt_device_unregister(): Unregister a crypto device.
255 * @zdev: Pointer to crypto device
256 *
245 * Unregister a crypto device. 257 * Unregister a crypto device.
246 */ 258 */
247void zcrypt_device_unregister(struct zcrypt_device *zdev) 259void zcrypt_device_unregister(struct zcrypt_device *zdev)
@@ -260,7 +272,9 @@ void zcrypt_device_unregister(struct zcrypt_device *zdev)
260EXPORT_SYMBOL(zcrypt_device_unregister); 272EXPORT_SYMBOL(zcrypt_device_unregister);
261 273
262/** 274/**
263 * zcrypt_read is not be supported beyond zcrypt 1.3.1 275 * zcrypt_read (): Not supported beyond zcrypt 1.3.1.
276 *
277 * This function is not supported beyond zcrypt 1.3.1.
264 */ 278 */
265static ssize_t zcrypt_read(struct file *filp, char __user *buf, 279static ssize_t zcrypt_read(struct file *filp, char __user *buf,
266 size_t count, loff_t *f_pos) 280 size_t count, loff_t *f_pos)
@@ -269,6 +283,8 @@ static ssize_t zcrypt_read(struct file *filp, char __user *buf,
269} 283}
270 284
271/** 285/**
286 * zcrypt_write(): Not allowed.
287 *
272 * Write is is not allowed 288 * Write is is not allowed
273 */ 289 */
274static ssize_t zcrypt_write(struct file *filp, const char __user *buf, 290static ssize_t zcrypt_write(struct file *filp, const char __user *buf,
@@ -278,7 +294,9 @@ static ssize_t zcrypt_write(struct file *filp, const char __user *buf,
278} 294}
279 295
280/** 296/**
281 * Device open/close functions to count number of users. 297 * zcrypt_open(): Count number of users.
298 *
299 * Device open function to count number of users.
282 */ 300 */
283static int zcrypt_open(struct inode *inode, struct file *filp) 301static int zcrypt_open(struct inode *inode, struct file *filp)
284{ 302{
@@ -286,13 +304,18 @@ static int zcrypt_open(struct inode *inode, struct file *filp)
286 return 0; 304 return 0;
287} 305}
288 306
307/**
308 * zcrypt_release(): Count number of users.
309 *
310 * Device close function to count number of users.
311 */
289static int zcrypt_release(struct inode *inode, struct file *filp) 312static int zcrypt_release(struct inode *inode, struct file *filp)
290{ 313{
291 atomic_dec(&zcrypt_open_count); 314 atomic_dec(&zcrypt_open_count);
292 return 0; 315 return 0;
293} 316}
294 317
295/** 318/*
296 * zcrypt ioctls. 319 * zcrypt ioctls.
297 */ 320 */
298static long zcrypt_rsa_modexpo(struct ica_rsa_modexpo *mex) 321static long zcrypt_rsa_modexpo(struct ica_rsa_modexpo *mex)
@@ -302,7 +325,7 @@ static long zcrypt_rsa_modexpo(struct ica_rsa_modexpo *mex)
302 325
303 if (mex->outputdatalength < mex->inputdatalength) 326 if (mex->outputdatalength < mex->inputdatalength)
304 return -EINVAL; 327 return -EINVAL;
305 /** 328 /*
306 * As long as outputdatalength is big enough, we can set the 329 * As long as outputdatalength is big enough, we can set the
307 * outputdatalength equal to the inputdatalength, since that is the 330 * outputdatalength equal to the inputdatalength, since that is the
308 * number of bytes we will copy in any case 331 * number of bytes we will copy in any case
@@ -348,7 +371,7 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt)
348 if (crt->outputdatalength < crt->inputdatalength || 371 if (crt->outputdatalength < crt->inputdatalength ||
349 (crt->inputdatalength & 1)) 372 (crt->inputdatalength & 1))
350 return -EINVAL; 373 return -EINVAL;
351 /** 374 /*
352 * As long as outputdatalength is big enough, we can set the 375 * As long as outputdatalength is big enough, we can set the
353 * outputdatalength equal to the inputdatalength, since that is the 376 * outputdatalength equal to the inputdatalength, since that is the
354 * number of bytes we will copy in any case 377 * number of bytes we will copy in any case
@@ -365,7 +388,7 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt)
365 zdev->max_mod_size < crt->inputdatalength) 388 zdev->max_mod_size < crt->inputdatalength)
366 continue; 389 continue;
367 if (zdev->short_crt && crt->inputdatalength > 240) { 390 if (zdev->short_crt && crt->inputdatalength > 240) {
368 /** 391 /*
369 * Check inputdata for leading zeros for cards 392 * Check inputdata for leading zeros for cards
370 * that can't handle np_prime, bp_key, or 393 * that can't handle np_prime, bp_key, or
371 * u_mult_inv > 128 bytes. 394 * u_mult_inv > 128 bytes.
@@ -381,7 +404,7 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt)
381 copy_from_user(&z3, crt->u_mult_inv, len)) 404 copy_from_user(&z3, crt->u_mult_inv, len))
382 return -EFAULT; 405 return -EFAULT;
383 copied = 1; 406 copied = 1;
384 /** 407 /*
385 * We have to restart device lookup - 408 * We have to restart device lookup -
386 * the device list may have changed by now. 409 * the device list may have changed by now.
387 */ 410 */
@@ -567,6 +590,8 @@ static int zcrypt_count_type(int type)
567} 590}
568 591
569/** 592/**
593 * zcrypt_ica_status(): Old, depracted combi status call.
594 *
570 * Old, deprecated combi status call. 595 * Old, deprecated combi status call.
571 */ 596 */
572static long zcrypt_ica_status(struct file *filp, unsigned long arg) 597static long zcrypt_ica_status(struct file *filp, unsigned long arg)
@@ -668,7 +693,7 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd,
668 (int __user *) arg); 693 (int __user *) arg);
669 case Z90STAT_DOMAIN_INDEX: 694 case Z90STAT_DOMAIN_INDEX:
670 return put_user(ap_domain_index, (int __user *) arg); 695 return put_user(ap_domain_index, (int __user *) arg);
671 /** 696 /*
672 * Deprecated ioctls. Don't add another device count ioctl, 697 * Deprecated ioctls. Don't add another device count ioctl,
673 * you can count them yourself in the user space with the 698 * you can count them yourself in the user space with the
674 * output of the Z90STAT_STATUS_MASK ioctl. 699 * output of the Z90STAT_STATUS_MASK ioctl.
@@ -706,7 +731,7 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd,
706} 731}
707 732
708#ifdef CONFIG_COMPAT 733#ifdef CONFIG_COMPAT
709/** 734/*
710 * ioctl32 conversion routines 735 * ioctl32 conversion routines
711 */ 736 */
712struct compat_ica_rsa_modexpo { 737struct compat_ica_rsa_modexpo {
@@ -857,7 +882,7 @@ static long zcrypt_compat_ioctl(struct file *filp, unsigned int cmd,
857} 882}
858#endif 883#endif
859 884
860/** 885/*
861 * Misc device file operations. 886 * Misc device file operations.
862 */ 887 */
863static const struct file_operations zcrypt_fops = { 888static const struct file_operations zcrypt_fops = {
@@ -872,7 +897,7 @@ static const struct file_operations zcrypt_fops = {
872 .release = zcrypt_release 897 .release = zcrypt_release
873}; 898};
874 899
875/** 900/*
876 * Misc device. 901 * Misc device.
877 */ 902 */
878static struct miscdevice zcrypt_misc_device = { 903static struct miscdevice zcrypt_misc_device = {
@@ -881,7 +906,7 @@ static struct miscdevice zcrypt_misc_device = {
881 .fops = &zcrypt_fops, 906 .fops = &zcrypt_fops,
882}; 907};
883 908
884/** 909/*
885 * Deprecated /proc entry support. 910 * Deprecated /proc entry support.
886 */ 911 */
887static struct proc_dir_entry *zcrypt_entry; 912static struct proc_dir_entry *zcrypt_entry;
@@ -1075,7 +1100,7 @@ static int zcrypt_status_write(struct file *file, const char __user *buffer,
1075 } 1100 }
1076 1101
1077 for (j = 0; j < 64 && *ptr; ptr++) { 1102 for (j = 0; j < 64 && *ptr; ptr++) {
1078 /** 1103 /*
1079 * '0' for no device, '1' for PCICA, '2' for PCICC, 1104 * '0' for no device, '1' for PCICA, '2' for PCICC,
1080 * '3' for PCIXCC_MCL2, '4' for PCIXCC_MCL3, 1105 * '3' for PCIXCC_MCL2, '4' for PCIXCC_MCL3,
1081 * '5' for CEX2C and '6' for CEX2A' 1106 * '5' for CEX2C and '6' for CEX2A'
@@ -1103,7 +1128,7 @@ static int zcrypt_rng_data_read(struct hwrng *rng, u32 *data)
1103{ 1128{
1104 int rc; 1129 int rc;
1105 1130
1106 /** 1131 /*
1107 * We don't need locking here because the RNG API guarantees serialized 1132 * We don't need locking here because the RNG API guarantees serialized
1108 * read method calls. 1133 * read method calls.
1109 */ 1134 */
@@ -1162,6 +1187,8 @@ static void zcrypt_rng_device_remove(void)
1162} 1187}
1163 1188
1164/** 1189/**
1190 * zcrypt_api_init(): Module initialization.
1191 *
1165 * The module initialization code. 1192 * The module initialization code.
1166 */ 1193 */
1167int __init zcrypt_api_init(void) 1194int __init zcrypt_api_init(void)
@@ -1196,6 +1223,8 @@ out:
1196} 1223}
1197 1224
1198/** 1225/**
1226 * zcrypt_api_exit(): Module termination.
1227 *
1199 * The module termination code. 1228 * The module termination code.
1200 */ 1229 */
1201void zcrypt_api_exit(void) 1230void zcrypt_api_exit(void)
diff --git a/drivers/s390/crypto/zcrypt_cca_key.h b/drivers/s390/crypto/zcrypt_cca_key.h
index 8dbcf0eef3e5..ed82f2f59b17 100644
--- a/drivers/s390/crypto/zcrypt_cca_key.h
+++ b/drivers/s390/crypto/zcrypt_cca_key.h
@@ -174,7 +174,7 @@ static inline int zcrypt_type6_mex_key_de(struct ica_rsa_modexpo *mex,
174 key->pvtMeHdr = static_pvt_me_hdr; 174 key->pvtMeHdr = static_pvt_me_hdr;
175 key->pvtMeSec = static_pvt_me_sec; 175 key->pvtMeSec = static_pvt_me_sec;
176 key->pubMeSec = static_pub_me_sec; 176 key->pubMeSec = static_pub_me_sec;
177 /** 177 /*
178 * In a private key, the modulus doesn't appear in the public 178 * In a private key, the modulus doesn't appear in the public
179 * section. So, an arbitrary public exponent of 0x010001 will be 179 * section. So, an arbitrary public exponent of 0x010001 will be
180 * used. 180 * used.
@@ -338,7 +338,7 @@ static inline int zcrypt_type6_crt_key(struct ica_rsa_modexpo_crt *crt,
338 pub = (struct cca_public_sec *)(key->key_parts + key_len); 338 pub = (struct cca_public_sec *)(key->key_parts + key_len);
339 *pub = static_cca_pub_sec; 339 *pub = static_cca_pub_sec;
340 pub->modulus_bit_len = 8 * crt->inputdatalength; 340 pub->modulus_bit_len = 8 * crt->inputdatalength;
341 /** 341 /*
342 * In a private key, the modulus doesn't appear in the public 342 * In a private key, the modulus doesn't appear in the public
343 * section. So, an arbitrary public exponent of 0x010001 will be 343 * section. So, an arbitrary public exponent of 0x010001 will be
344 * used. 344 * used.
diff --git a/drivers/s390/crypto/zcrypt_error.h b/drivers/s390/crypto/zcrypt_error.h
index 2cb616ba8bec..3e27fe77d207 100644
--- a/drivers/s390/crypto/zcrypt_error.h
+++ b/drivers/s390/crypto/zcrypt_error.h
@@ -108,7 +108,7 @@ static inline int convert_error(struct zcrypt_device *zdev,
108 return -EINVAL; 108 return -EINVAL;
109 case REP82_ERROR_MESSAGE_TYPE: 109 case REP82_ERROR_MESSAGE_TYPE:
110 // REP88_ERROR_MESSAGE_TYPE // '20' CEX2A 110 // REP88_ERROR_MESSAGE_TYPE // '20' CEX2A
111 /** 111 /*
112 * To sent a message of the wrong type is a bug in the 112 * To sent a message of the wrong type is a bug in the
113 * device driver. Warn about it, disable the device 113 * device driver. Warn about it, disable the device
114 * and then repeat the request. 114 * and then repeat the request.
diff --git a/drivers/s390/crypto/zcrypt_pcicc.c b/drivers/s390/crypto/zcrypt_pcicc.c
index d6d59bf9ac38..17ea56ce1c11 100644
--- a/drivers/s390/crypto/zcrypt_pcicc.c
+++ b/drivers/s390/crypto/zcrypt_pcicc.c
@@ -42,7 +42,7 @@
42#define PCICC_MAX_MOD_SIZE_OLD 128 /* 1024 bits */ 42#define PCICC_MAX_MOD_SIZE_OLD 128 /* 1024 bits */
43#define PCICC_MAX_MOD_SIZE 256 /* 2048 bits */ 43#define PCICC_MAX_MOD_SIZE 256 /* 2048 bits */
44 44
45/** 45/*
46 * PCICC cards need a speed rating of 0. This keeps them at the end of 46 * PCICC cards need a speed rating of 0. This keeps them at the end of
47 * the zcrypt device list (see zcrypt_api.c). PCICC cards are only 47 * the zcrypt device list (see zcrypt_api.c). PCICC cards are only
48 * used if no other cards are present because they are slow and can only 48 * used if no other cards are present because they are slow and can only
@@ -388,7 +388,7 @@ static int convert_type86(struct zcrypt_device *zdev,
388 reply_len = le16_to_cpu(msg->length) - 2; 388 reply_len = le16_to_cpu(msg->length) - 2;
389 if (reply_len > outputdatalength) 389 if (reply_len > outputdatalength)
390 return -EINVAL; 390 return -EINVAL;
391 /** 391 /*
392 * For all encipher requests, the length of the ciphertext (reply_len) 392 * For all encipher requests, the length of the ciphertext (reply_len)
393 * will always equal the modulus length. For MEX decipher requests 393 * will always equal the modulus length. For MEX decipher requests
394 * the output needs to get padded. Minimum pad size is 10. 394 * the output needs to get padded. Minimum pad size is 10.
diff --git a/drivers/s390/crypto/zcrypt_pcixcc.c b/drivers/s390/crypto/zcrypt_pcixcc.c
index 3674bfa82b65..0bc9b3188e64 100644
--- a/drivers/s390/crypto/zcrypt_pcixcc.c
+++ b/drivers/s390/crypto/zcrypt_pcixcc.c
@@ -501,7 +501,7 @@ static int convert_type86_ica(struct zcrypt_device *zdev,
501 reply_len = msg->length - 2; 501 reply_len = msg->length - 2;
502 if (reply_len > outputdatalength) 502 if (reply_len > outputdatalength)
503 return -EINVAL; 503 return -EINVAL;
504 /** 504 /*
505 * For all encipher requests, the length of the ciphertext (reply_len) 505 * For all encipher requests, the length of the ciphertext (reply_len)
506 * will always equal the modulus length. For MEX decipher requests 506 * will always equal the modulus length. For MEX decipher requests
507 * the output needs to get padded. Minimum pad size is 10. 507 * the output needs to get padded. Minimum pad size is 10.