aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/s390/kernel/kprobes.c2
-rw-r--r--drivers/s390/block/dasd_diag.c10
-rw-r--r--drivers/s390/cio/device_status.c6
-rw-r--r--drivers/s390/crypto/ap_bus.c30
-rw-r--r--include/asm-s390/checksum.h59
5 files changed, 43 insertions, 64 deletions
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 8af549e95730..993f35381496 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -167,7 +167,7 @@ static int __kprobes swap_instruction(void *aref)
167 * shall not cross any page boundaries (vmalloc area!) when writing 167 * shall not cross any page boundaries (vmalloc area!) when writing
168 * the new instruction. 168 * the new instruction.
169 */ 169 */
170 addr = (u32 *)ALIGN((unsigned long)args->ptr, 4); 170 addr = (u32 *)((unsigned long)args->ptr & -4UL);
171 if ((unsigned long)args->ptr & 2) 171 if ((unsigned long)args->ptr & 2)
172 instr = ((*addr) & 0xffff0000) | args->new; 172 instr = ((*addr) & 0xffff0000) | args->new;
173 else 173 else
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c
index ab782bb46ac1..e810e4a44ed4 100644
--- a/drivers/s390/block/dasd_diag.c
+++ b/drivers/s390/block/dasd_diag.c
@@ -65,7 +65,7 @@ static const u8 DASD_DIAG_CMS1[] = { 0xc3, 0xd4, 0xe2, 0xf1 };/* EBCDIC CMS1 */
65 * resulting condition code and DIAG return code. */ 65 * resulting condition code and DIAG return code. */
66static inline int dia250(void *iob, int cmd) 66static inline int dia250(void *iob, int cmd)
67{ 67{
68 register unsigned long reg0 asm ("0") = (unsigned long) iob; 68 register unsigned long reg2 asm ("2") = (unsigned long) iob;
69 typedef union { 69 typedef union {
70 struct dasd_diag_init_io init_io; 70 struct dasd_diag_init_io init_io;
71 struct dasd_diag_rw_io rw_io; 71 struct dasd_diag_rw_io rw_io;
@@ -74,15 +74,15 @@ static inline int dia250(void *iob, int cmd)
74 74
75 rc = 3; 75 rc = 3;
76 asm volatile( 76 asm volatile(
77 " diag 0,%2,0x250\n" 77 " diag 2,%2,0x250\n"
78 "0: ipm %0\n" 78 "0: ipm %0\n"
79 " srl %0,28\n" 79 " srl %0,28\n"
80 " or %0,1\n" 80 " or %0,3\n"
81 "1:\n" 81 "1:\n"
82 EX_TABLE(0b,1b) 82 EX_TABLE(0b,1b)
83 : "+d" (rc), "=m" (*(addr_type *) iob) 83 : "+d" (rc), "=m" (*(addr_type *) iob)
84 : "d" (cmd), "d" (reg0), "m" (*(addr_type *) iob) 84 : "d" (cmd), "d" (reg2), "m" (*(addr_type *) iob)
85 : "1", "cc"); 85 : "3", "cc");
86 return rc; 86 return rc;
87} 87}
88 88
diff --git a/drivers/s390/cio/device_status.c b/drivers/s390/cio/device_status.c
index 6b1caea622ea..25d99bd28089 100644
--- a/drivers/s390/cio/device_status.c
+++ b/drivers/s390/cio/device_status.c
@@ -263,7 +263,11 @@ ccw_device_accumulate_irb(struct ccw_device *cdev, struct irb *irb)
263 cdev_irb->scsw.cpa = irb->scsw.cpa; 263 cdev_irb->scsw.cpa = irb->scsw.cpa;
264 /* Accumulate device status, but not the device busy flag. */ 264 /* Accumulate device status, but not the device busy flag. */
265 cdev_irb->scsw.dstat &= ~DEV_STAT_BUSY; 265 cdev_irb->scsw.dstat &= ~DEV_STAT_BUSY;
266 cdev_irb->scsw.dstat |= irb->scsw.dstat; 266 /* dstat is not always valid. */
267 if (irb->scsw.stctl &
268 (SCSW_STCTL_PRIM_STATUS | SCSW_STCTL_SEC_STATUS
269 | SCSW_STCTL_INTER_STATUS | SCSW_STCTL_ALERT_STATUS))
270 cdev_irb->scsw.dstat |= irb->scsw.dstat;
267 /* Accumulate subchannel status. */ 271 /* Accumulate subchannel status. */
268 cdev_irb->scsw.cstat |= irb->scsw.cstat; 272 cdev_irb->scsw.cstat |= irb->scsw.cstat;
269 /* Copy residual count if it is valid. */ 273 /* Copy residual count if it is valid. */
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index 181b51772b1b..bf37cdf43fae 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -505,6 +505,9 @@ static int ap_device_remove(struct device *dev)
505 spin_lock_bh(&ap_device_lock); 505 spin_lock_bh(&ap_device_lock);
506 list_del_init(&ap_dev->list); 506 list_del_init(&ap_dev->list);
507 spin_unlock_bh(&ap_device_lock); 507 spin_unlock_bh(&ap_device_lock);
508 spin_lock_bh(&ap_dev->lock);
509 atomic_sub(ap_dev->queue_count, &ap_poll_requests);
510 spin_unlock_bh(&ap_dev->lock);
508 return 0; 511 return 0;
509} 512}
510 513
@@ -757,10 +760,16 @@ static void ap_scan_bus(struct work_struct *unused)
757 (void *)(unsigned long)qid, 760 (void *)(unsigned long)qid,
758 __ap_scan_bus); 761 __ap_scan_bus);
759 rc = ap_query_queue(qid, &queue_depth, &device_type); 762 rc = ap_query_queue(qid, &queue_depth, &device_type);
760 if (dev && rc) { 763 if (dev) {
761 put_device(dev); 764 ap_dev = to_ap_dev(dev);
762 device_unregister(dev); 765 spin_lock_bh(&ap_dev->lock);
763 continue; 766 if (rc || ap_dev->unregistered) {
767 spin_unlock_bh(&ap_dev->lock);
768 put_device(dev);
769 device_unregister(dev);
770 continue;
771 } else
772 spin_unlock_bh(&ap_dev->lock);
764 } 773 }
765 if (dev) { 774 if (dev) {
766 put_device(dev); 775 put_device(dev);
@@ -861,6 +870,7 @@ static int ap_poll_read(struct ap_device *ap_dev, unsigned long *flags)
861 case AP_RESPONSE_NO_PENDING_REPLY: 870 case AP_RESPONSE_NO_PENDING_REPLY:
862 if (status.queue_empty) { 871 if (status.queue_empty) {
863 /* The card shouldn't forget requests but who knows. */ 872 /* The card shouldn't forget requests but who knows. */
873 atomic_sub(ap_dev->queue_count, &ap_poll_requests);
864 ap_dev->queue_count = 0; 874 ap_dev->queue_count = 0;
865 list_splice_init(&ap_dev->pendingq, &ap_dev->requestq); 875 list_splice_init(&ap_dev->pendingq, &ap_dev->requestq);
866 ap_dev->requestq_count += ap_dev->pendingq_count; 876 ap_dev->requestq_count += ap_dev->pendingq_count;
@@ -994,7 +1004,7 @@ void ap_queue_message(struct ap_device *ap_dev, struct ap_message *ap_msg)
994 ap_dev->unregistered = 1; 1004 ap_dev->unregistered = 1;
995 } else { 1005 } else {
996 ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); 1006 ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV));
997 rc = 0; 1007 rc = -ENODEV;
998 } 1008 }
999 spin_unlock_bh(&ap_dev->lock); 1009 spin_unlock_bh(&ap_dev->lock);
1000 if (rc == -ENODEV) 1010 if (rc == -ENODEV)
@@ -1044,18 +1054,12 @@ static void ap_poll_timeout(unsigned long unused)
1044 */ 1054 */
1045static int __ap_poll_all(struct ap_device *ap_dev, unsigned long *flags) 1055static int __ap_poll_all(struct ap_device *ap_dev, unsigned long *flags)
1046{ 1056{
1047 int rc;
1048
1049 spin_lock(&ap_dev->lock); 1057 spin_lock(&ap_dev->lock);
1050 if (!ap_dev->unregistered) { 1058 if (!ap_dev->unregistered) {
1051 rc = ap_poll_queue(ap_dev, flags); 1059 if (ap_poll_queue(ap_dev, flags))
1052 if (rc)
1053 ap_dev->unregistered = 1; 1060 ap_dev->unregistered = 1;
1054 } else 1061 }
1055 rc = 0;
1056 spin_unlock(&ap_dev->lock); 1062 spin_unlock(&ap_dev->lock);
1057 if (rc)
1058 device_unregister(&ap_dev->device);
1059 return 0; 1063 return 0;
1060} 1064}
1061 1065
diff --git a/include/asm-s390/checksum.h b/include/asm-s390/checksum.h
index 0a3cd7ec8451..d5a8e7c1477c 100644
--- a/include/asm-s390/checksum.h
+++ b/include/asm-s390/checksum.h
@@ -121,50 +121,21 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
121 unsigned short len, unsigned short proto, 121 unsigned short len, unsigned short proto,
122 __wsum sum) 122 __wsum sum)
123{ 123{
124#ifndef __s390x__ 124 __u32 csum = (__force __u32)sum;
125 asm volatile( 125
126 " alr %0,%1\n" /* sum += saddr */ 126 csum += (__force __u32)saddr;
127 " brc 12,0f\n" 127 if (csum < (__force __u32)saddr)
128 " ahi %0,1\n" /* add carry */ 128 csum++;
129 "0:" 129
130 : "+&d" (sum) : "d" (saddr) : "cc"); 130 csum += (__force __u32)daddr;
131 asm volatile( 131 if (csum < (__force __u32)daddr)
132 " alr %0,%1\n" /* sum += daddr */ 132 csum++;
133 " brc 12,1f\n" 133
134 " ahi %0,1\n" /* add carry */ 134 csum += len + proto;
135 "1:" 135 if (csum < len + proto)
136 : "+&d" (sum) : "d" (daddr) : "cc"); 136 csum++;
137 asm volatile( 137
138 " alr %0,%1\n" /* sum += len + proto */ 138 return (__force __wsum)csum;
139 " brc 12,2f\n"
140 " ahi %0,1\n" /* add carry */
141 "2:"
142 : "+&d" (sum)
143 : "d" (len + proto)
144 : "cc");
145#else /* __s390x__ */
146 asm volatile(
147 " lgfr %0,%0\n"
148 " algr %0,%1\n" /* sum += saddr */
149 " brc 12,0f\n"
150 " aghi %0,1\n" /* add carry */
151 "0: algr %0,%2\n" /* sum += daddr */
152 " brc 12,1f\n"
153 " aghi %0,1\n" /* add carry */
154 "1: algfr %0,%3\n" /* sum += len + proto */
155 " brc 12,2f\n"
156 " aghi %0,1\n" /* add carry */
157 "2: srlg 0,%0,32\n"
158 " alr %0,0\n" /* fold to 32 bits */
159 " brc 12,3f\n"
160 " ahi %0,1\n" /* add carry */
161 "3: llgfr %0,%0"
162 : "+&d" (sum)
163 : "d" (saddr), "d" (daddr),
164 "d" (len + proto)
165 : "cc", "0");
166#endif /* __s390x__ */
167 return sum;
168} 139}
169 140
170/* 141/*