diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-19 23:04:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-19 23:04:26 -0400 |
commit | 511b00a3194167bad447d4c81027d6a44920dfd2 (patch) | |
tree | 080c076f994f701e40c03e7d5f7ce7f50115d2dc /drivers/s390 | |
parent | fbeb1f19229baa9ee80f315e9d24635045455082 (diff) | |
parent | 43a867a2d2a119c744bab6dc8d3e1da6809d7141 (diff) |
Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6:
[S390] zcrypt: fix possible race when unloading zcrypt driver modules
[S390] zcrypt: fix possible dead lock in AP bus module
[S390] Wire up sys_utimes.
[S390] reboot from and dump to SCSI under z/VM fails.
[S390] Wire up compat_sys_epoll_pwait.
[S390] strlcpy is smart enough
[S390] memory detection: fix off by one bug.
[S390] cio: qdio slsb setup
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/cio/qdio.c | 26 | ||||
-rw-r--r-- | drivers/s390/crypto/ap_bus.c | 30 | ||||
-rw-r--r-- | drivers/s390/crypto/ap_bus.h | 1 | ||||
-rw-r--r-- | drivers/s390/crypto/zcrypt_api.c | 12 |
4 files changed, 48 insertions, 21 deletions
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index 5b1e3ff26c0b..05fac0733f3d 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c | |||
@@ -210,9 +210,11 @@ again: | |||
210 | goto again; | 210 | goto again; |
211 | } | 211 | } |
212 | if (rc < 0) { | 212 | if (rc < 0) { |
213 | QDIO_DBF_TEXT3(1,trace,"sqberr"); | 213 | QDIO_DBF_TEXT3(1,trace,"sqberr"); |
214 | sprintf(dbf_text,"%2x,%2x,%d,%d",tmp_cnt,*cnt,ccq,q_no); | 214 | sprintf(dbf_text,"%2x,%2x",tmp_cnt,*cnt); |
215 | QDIO_DBF_TEXT3(1,trace,dbf_text); | 215 | QDIO_DBF_TEXT3(1,trace,dbf_text); |
216 | sprintf(dbf_text,"%d,%d",ccq,q_no); | ||
217 | QDIO_DBF_TEXT3(1,trace,dbf_text); | ||
216 | q->handler(q->cdev,QDIO_STATUS_ACTIVATE_CHECK_CONDITION| | 218 | q->handler(q->cdev,QDIO_STATUS_ACTIVATE_CHECK_CONDITION| |
217 | QDIO_STATUS_LOOK_FOR_ERROR, | 219 | QDIO_STATUS_LOOK_FOR_ERROR, |
218 | 0, 0, 0, -1, -1, q->int_parm); | 220 | 0, 0, 0, -1, -1, q->int_parm); |
@@ -1250,7 +1252,6 @@ qdio_is_inbound_q_done(struct qdio_q *q) | |||
1250 | if (!no_used) { | 1252 | if (!no_used) { |
1251 | QDIO_DBF_TEXT4(0,trace,"inqisdnA"); | 1253 | QDIO_DBF_TEXT4(0,trace,"inqisdnA"); |
1252 | QDIO_DBF_HEX4(0,trace,&q,sizeof(void*)); | 1254 | QDIO_DBF_HEX4(0,trace,&q,sizeof(void*)); |
1253 | QDIO_DBF_TEXT4(0,trace,dbf_text); | ||
1254 | return 1; | 1255 | return 1; |
1255 | } | 1256 | } |
1256 | if (irq->is_qebsm) { | 1257 | if (irq->is_qebsm) { |
@@ -3371,10 +3372,15 @@ qdio_do_qdio_fill_input(struct qdio_q *q, unsigned int qidx, | |||
3371 | unsigned int count, struct qdio_buffer *buffers) | 3372 | unsigned int count, struct qdio_buffer *buffers) |
3372 | { | 3373 | { |
3373 | struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr; | 3374 | struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr; |
3375 | int tmp = 0; | ||
3376 | |||
3374 | qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1); | 3377 | qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1); |
3375 | if (irq->is_qebsm) { | 3378 | if (irq->is_qebsm) { |
3376 | while (count) | 3379 | while (count) { |
3377 | set_slsb(q, &qidx, SLSB_CU_INPUT_EMPTY, &count); | 3380 | tmp = set_slsb(q, &qidx, SLSB_CU_INPUT_EMPTY, &count); |
3381 | if (!tmp) | ||
3382 | return; | ||
3383 | } | ||
3378 | return; | 3384 | return; |
3379 | } | 3385 | } |
3380 | for (;;) { | 3386 | for (;;) { |
@@ -3390,11 +3396,15 @@ qdio_do_qdio_fill_output(struct qdio_q *q, unsigned int qidx, | |||
3390 | unsigned int count, struct qdio_buffer *buffers) | 3396 | unsigned int count, struct qdio_buffer *buffers) |
3391 | { | 3397 | { |
3392 | struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr; | 3398 | struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr; |
3399 | int tmp = 0; | ||
3393 | 3400 | ||
3394 | qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1); | 3401 | qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1); |
3395 | if (irq->is_qebsm) { | 3402 | if (irq->is_qebsm) { |
3396 | while (count) | 3403 | while (count) { |
3397 | set_slsb(q, &qidx, SLSB_CU_OUTPUT_PRIMED, &count); | 3404 | tmp = set_slsb(q, &qidx, SLSB_CU_OUTPUT_PRIMED, &count); |
3405 | if (!tmp) | ||
3406 | return; | ||
3407 | } | ||
3398 | return; | 3408 | return; |
3399 | } | 3409 | } |
3400 | 3410 | ||
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index c7d1355237b6..181b51772b1b 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -65,6 +65,8 @@ module_param_named(poll_thread, ap_thread_flag, int, 0000); | |||
65 | MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 1 (on)."); | 65 | MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 1 (on)."); |
66 | 66 | ||
67 | static struct device *ap_root_device = NULL; | 67 | static struct device *ap_root_device = NULL; |
68 | static DEFINE_SPINLOCK(ap_device_lock); | ||
69 | static LIST_HEAD(ap_device_list); | ||
68 | 70 | ||
69 | /** | 71 | /** |
70 | * Workqueue & timer for bus rescan. | 72 | * Workqueue & timer for bus rescan. |
@@ -457,6 +459,9 @@ static int ap_device_probe(struct device *dev) | |||
457 | int rc; | 459 | int rc; |
458 | 460 | ||
459 | ap_dev->drv = ap_drv; | 461 | ap_dev->drv = ap_drv; |
462 | spin_lock_bh(&ap_device_lock); | ||
463 | list_add(&ap_dev->list, &ap_device_list); | ||
464 | spin_unlock_bh(&ap_device_lock); | ||
460 | rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV; | 465 | rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV; |
461 | return rc; | 466 | return rc; |
462 | } | 467 | } |
@@ -497,6 +502,9 @@ static int ap_device_remove(struct device *dev) | |||
497 | ap_flush_queue(ap_dev); | 502 | ap_flush_queue(ap_dev); |
498 | if (ap_drv->remove) | 503 | if (ap_drv->remove) |
499 | ap_drv->remove(ap_dev); | 504 | ap_drv->remove(ap_dev); |
505 | spin_lock_bh(&ap_device_lock); | ||
506 | list_del_init(&ap_dev->list); | ||
507 | spin_unlock_bh(&ap_device_lock); | ||
500 | return 0; | 508 | return 0; |
501 | } | 509 | } |
502 | 510 | ||
@@ -772,6 +780,7 @@ static void ap_scan_bus(struct work_struct *unused) | |||
772 | spin_lock_init(&ap_dev->lock); | 780 | spin_lock_init(&ap_dev->lock); |
773 | INIT_LIST_HEAD(&ap_dev->pendingq); | 781 | INIT_LIST_HEAD(&ap_dev->pendingq); |
774 | INIT_LIST_HEAD(&ap_dev->requestq); | 782 | INIT_LIST_HEAD(&ap_dev->requestq); |
783 | INIT_LIST_HEAD(&ap_dev->list); | ||
775 | if (device_type == 0) | 784 | if (device_type == 0) |
776 | ap_probe_device_type(ap_dev); | 785 | ap_probe_device_type(ap_dev); |
777 | else | 786 | else |
@@ -1033,14 +1042,13 @@ static void ap_poll_timeout(unsigned long unused) | |||
1033 | * polling until bit 2^0 of the control flags is not set. If bit 2^1 | 1042 | * polling until bit 2^0 of the control flags is not set. If bit 2^1 |
1034 | * of the control flags has been set arm the poll timer. | 1043 | * of the control flags has been set arm the poll timer. |
1035 | */ | 1044 | */ |
1036 | static int __ap_poll_all(struct device *dev, void *data) | 1045 | static int __ap_poll_all(struct ap_device *ap_dev, unsigned long *flags) |
1037 | { | 1046 | { |
1038 | struct ap_device *ap_dev = to_ap_dev(dev); | ||
1039 | int rc; | 1047 | int rc; |
1040 | 1048 | ||
1041 | spin_lock(&ap_dev->lock); | 1049 | spin_lock(&ap_dev->lock); |
1042 | if (!ap_dev->unregistered) { | 1050 | if (!ap_dev->unregistered) { |
1043 | rc = ap_poll_queue(to_ap_dev(dev), (unsigned long *) data); | 1051 | rc = ap_poll_queue(ap_dev, flags); |
1044 | if (rc) | 1052 | if (rc) |
1045 | ap_dev->unregistered = 1; | 1053 | ap_dev->unregistered = 1; |
1046 | } else | 1054 | } else |
@@ -1054,10 +1062,15 @@ static int __ap_poll_all(struct device *dev, void *data) | |||
1054 | static void ap_poll_all(unsigned long dummy) | 1062 | static void ap_poll_all(unsigned long dummy) |
1055 | { | 1063 | { |
1056 | unsigned long flags; | 1064 | unsigned long flags; |
1065 | struct ap_device *ap_dev; | ||
1057 | 1066 | ||
1058 | do { | 1067 | do { |
1059 | flags = 0; | 1068 | flags = 0; |
1060 | bus_for_each_dev(&ap_bus_type, NULL, &flags, __ap_poll_all); | 1069 | spin_lock(&ap_device_lock); |
1070 | list_for_each_entry(ap_dev, &ap_device_list, list) { | ||
1071 | __ap_poll_all(ap_dev, &flags); | ||
1072 | } | ||
1073 | spin_unlock(&ap_device_lock); | ||
1061 | } while (flags & 1); | 1074 | } while (flags & 1); |
1062 | if (flags & 2) | 1075 | if (flags & 2) |
1063 | ap_schedule_poll_timer(); | 1076 | ap_schedule_poll_timer(); |
@@ -1075,6 +1088,7 @@ static int ap_poll_thread(void *data) | |||
1075 | DECLARE_WAITQUEUE(wait, current); | 1088 | DECLARE_WAITQUEUE(wait, current); |
1076 | unsigned long flags; | 1089 | unsigned long flags; |
1077 | int requests; | 1090 | int requests; |
1091 | struct ap_device *ap_dev; | ||
1078 | 1092 | ||
1079 | set_user_nice(current, 19); | 1093 | set_user_nice(current, 19); |
1080 | while (1) { | 1094 | while (1) { |
@@ -1092,10 +1106,12 @@ static int ap_poll_thread(void *data) | |||
1092 | set_current_state(TASK_RUNNING); | 1106 | set_current_state(TASK_RUNNING); |
1093 | remove_wait_queue(&ap_poll_wait, &wait); | 1107 | remove_wait_queue(&ap_poll_wait, &wait); |
1094 | 1108 | ||
1095 | local_bh_disable(); | ||
1096 | flags = 0; | 1109 | flags = 0; |
1097 | bus_for_each_dev(&ap_bus_type, NULL, &flags, __ap_poll_all); | 1110 | spin_lock_bh(&ap_device_lock); |
1098 | local_bh_enable(); | 1111 | list_for_each_entry(ap_dev, &ap_device_list, list) { |
1112 | __ap_poll_all(ap_dev, &flags); | ||
1113 | } | ||
1114 | spin_unlock_bh(&ap_device_lock); | ||
1099 | } | 1115 | } |
1100 | set_current_state(TASK_RUNNING); | 1116 | set_current_state(TASK_RUNNING); |
1101 | remove_wait_queue(&ap_poll_wait, &wait); | 1117 | remove_wait_queue(&ap_poll_wait, &wait); |
diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h index 83b69c01cd6e..008559ea742b 100644 --- a/drivers/s390/crypto/ap_bus.h +++ b/drivers/s390/crypto/ap_bus.h | |||
@@ -106,6 +106,7 @@ struct ap_device { | |||
106 | struct device device; | 106 | struct device device; |
107 | struct ap_driver *drv; /* Pointer to AP device driver. */ | 107 | struct ap_driver *drv; /* Pointer to AP device driver. */ |
108 | spinlock_t lock; /* Per device lock. */ | 108 | spinlock_t lock; /* Per device lock. */ |
109 | struct list_head list; /* private list of all AP devices. */ | ||
109 | 110 | ||
110 | ap_qid_t qid; /* AP queue id. */ | 111 | ap_qid_t qid; /* AP queue id. */ |
111 | int queue_depth; /* AP queue depth.*/ | 112 | int queue_depth; /* AP queue depth.*/ |
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 99761391f340..e3625a47a596 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c | |||
@@ -298,14 +298,14 @@ static long zcrypt_rsa_modexpo(struct ica_rsa_modexpo *mex) | |||
298 | get_device(&zdev->ap_dev->device); | 298 | get_device(&zdev->ap_dev->device); |
299 | zdev->request_count++; | 299 | zdev->request_count++; |
300 | __zcrypt_decrease_preference(zdev); | 300 | __zcrypt_decrease_preference(zdev); |
301 | spin_unlock_bh(&zcrypt_device_lock); | ||
302 | if (try_module_get(zdev->ap_dev->drv->driver.owner)) { | 301 | if (try_module_get(zdev->ap_dev->drv->driver.owner)) { |
302 | spin_unlock_bh(&zcrypt_device_lock); | ||
303 | rc = zdev->ops->rsa_modexpo(zdev, mex); | 303 | rc = zdev->ops->rsa_modexpo(zdev, mex); |
304 | spin_lock_bh(&zcrypt_device_lock); | ||
304 | module_put(zdev->ap_dev->drv->driver.owner); | 305 | module_put(zdev->ap_dev->drv->driver.owner); |
305 | } | 306 | } |
306 | else | 307 | else |
307 | rc = -EAGAIN; | 308 | rc = -EAGAIN; |
308 | spin_lock_bh(&zcrypt_device_lock); | ||
309 | zdev->request_count--; | 309 | zdev->request_count--; |
310 | __zcrypt_increase_preference(zdev); | 310 | __zcrypt_increase_preference(zdev); |
311 | put_device(&zdev->ap_dev->device); | 311 | put_device(&zdev->ap_dev->device); |
@@ -373,14 +373,14 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt) | |||
373 | get_device(&zdev->ap_dev->device); | 373 | get_device(&zdev->ap_dev->device); |
374 | zdev->request_count++; | 374 | zdev->request_count++; |
375 | __zcrypt_decrease_preference(zdev); | 375 | __zcrypt_decrease_preference(zdev); |
376 | spin_unlock_bh(&zcrypt_device_lock); | ||
377 | if (try_module_get(zdev->ap_dev->drv->driver.owner)) { | 376 | if (try_module_get(zdev->ap_dev->drv->driver.owner)) { |
377 | spin_unlock_bh(&zcrypt_device_lock); | ||
378 | rc = zdev->ops->rsa_modexpo_crt(zdev, crt); | 378 | rc = zdev->ops->rsa_modexpo_crt(zdev, crt); |
379 | spin_lock_bh(&zcrypt_device_lock); | ||
379 | module_put(zdev->ap_dev->drv->driver.owner); | 380 | module_put(zdev->ap_dev->drv->driver.owner); |
380 | } | 381 | } |
381 | else | 382 | else |
382 | rc = -EAGAIN; | 383 | rc = -EAGAIN; |
383 | spin_lock_bh(&zcrypt_device_lock); | ||
384 | zdev->request_count--; | 384 | zdev->request_count--; |
385 | __zcrypt_increase_preference(zdev); | 385 | __zcrypt_increase_preference(zdev); |
386 | put_device(&zdev->ap_dev->device); | 386 | put_device(&zdev->ap_dev->device); |
@@ -408,14 +408,14 @@ static long zcrypt_send_cprb(struct ica_xcRB *xcRB) | |||
408 | get_device(&zdev->ap_dev->device); | 408 | get_device(&zdev->ap_dev->device); |
409 | zdev->request_count++; | 409 | zdev->request_count++; |
410 | __zcrypt_decrease_preference(zdev); | 410 | __zcrypt_decrease_preference(zdev); |
411 | spin_unlock_bh(&zcrypt_device_lock); | ||
412 | if (try_module_get(zdev->ap_dev->drv->driver.owner)) { | 411 | if (try_module_get(zdev->ap_dev->drv->driver.owner)) { |
412 | spin_unlock_bh(&zcrypt_device_lock); | ||
413 | rc = zdev->ops->send_cprb(zdev, xcRB); | 413 | rc = zdev->ops->send_cprb(zdev, xcRB); |
414 | spin_lock_bh(&zcrypt_device_lock); | ||
414 | module_put(zdev->ap_dev->drv->driver.owner); | 415 | module_put(zdev->ap_dev->drv->driver.owner); |
415 | } | 416 | } |
416 | else | 417 | else |
417 | rc = -EAGAIN; | 418 | rc = -EAGAIN; |
418 | spin_lock_bh(&zcrypt_device_lock); | ||
419 | zdev->request_count--; | 419 | zdev->request_count--; |
420 | __zcrypt_increase_preference(zdev); | 420 | __zcrypt_increase_preference(zdev); |
421 | put_device(&zdev->ap_dev->device); | 421 | put_device(&zdev->ap_dev->device); |