aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/Kconfig3
-rw-r--r--arch/s390/Makefile3
-rw-r--r--arch/s390/appldata/appldata_net_sum.c3
-rw-r--r--arch/s390/crypto/Makefile2
-rw-r--r--arch/s390/crypto/crypto_des.h2
-rw-r--r--arch/s390/crypto/des_s390.c238
-rw-r--r--arch/s390/hypfs/inode.c6
-rw-r--r--arch/s390/include/asm/ccwdev.h2
-rw-r--r--arch/s390/include/asm/ioctls.h2
-rw-r--r--arch/s390/include/asm/kvm_host.h5
-rw-r--r--arch/s390/include/asm/local64.h1
-rw-r--r--arch/s390/include/asm/mmu.h5
-rw-r--r--arch/s390/include/asm/qdio.h6
-rw-r--r--arch/s390/include/asm/statfs.h9
-rw-r--r--arch/s390/include/asm/topology.h2
-rw-r--r--arch/s390/kernel/head.S2
-rw-r--r--arch/s390/kernel/time.c8
-rw-r--r--arch/s390/kvm/intercept.c2
-rw-r--r--arch/s390/kvm/kvm-s390.c64
-rw-r--r--arch/s390/kvm/kvm-s390.h2
-rw-r--r--arch/s390/mm/cmm.c11
-rw-r--r--arch/s390/mm/vmem.c4
22 files changed, 90 insertions, 292 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index bee1c0f794cf..f0777a47e3a5 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -40,9 +40,6 @@ config ARCH_HAS_ILOG2_U64
40config GENERIC_HWEIGHT 40config GENERIC_HWEIGHT
41 def_bool y 41 def_bool y
42 42
43config GENERIC_TIME
44 def_bool y
45
46config GENERIC_TIME_VSYSCALL 43config GENERIC_TIME_VSYSCALL
47 def_bool y 44 def_bool y
48 45
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 30c5f01f93b0..0c9e6c6d2a64 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -24,7 +24,8 @@ CHECKFLAGS += -D__s390__ -msize-long
24else 24else
25LD_BFD := elf64-s390 25LD_BFD := elf64-s390
26LDFLAGS := -m elf64_s390 26LDFLAGS := -m elf64_s390
27MODFLAGS += -fpic -D__PIC__ 27KBUILD_AFLAGS_MODULE += -fpic -D__PIC__
28KBUILD_CFLAGS_MODULE += -fpic -D__PIC__
28KBUILD_CFLAGS += -m64 29KBUILD_CFLAGS += -m64
29KBUILD_AFLAGS += -m64 30KBUILD_AFLAGS += -m64
30UTS_MACHINE := s390x 31UTS_MACHINE := s390x
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c
index 9a9586f4103f..f02e89ce4df1 100644
--- a/arch/s390/appldata/appldata_net_sum.c
+++ b/arch/s390/appldata/appldata_net_sum.c
@@ -85,7 +85,8 @@ static void appldata_get_net_sum_data(void *data)
85 85
86 rcu_read_lock(); 86 rcu_read_lock();
87 for_each_netdev_rcu(&init_net, dev) { 87 for_each_netdev_rcu(&init_net, dev) {
88 const struct net_device_stats *stats = dev_get_stats(dev); 88 struct rtnl_link_stats64 temp;
89 const struct net_device_stats *stats = dev_get_stats(dev, &temp);
89 90
90 rx_packets += stats->rx_packets; 91 rx_packets += stats->rx_packets;
91 tx_packets += stats->tx_packets; 92 tx_packets += stats->tx_packets;
diff --git a/arch/s390/crypto/Makefile b/arch/s390/crypto/Makefile
index 6a1157fa4f98..1cf81d77c5a5 100644
--- a/arch/s390/crypto/Makefile
+++ b/arch/s390/crypto/Makefile
@@ -5,6 +5,6 @@
5obj-$(CONFIG_CRYPTO_SHA1_S390) += sha1_s390.o sha_common.o 5obj-$(CONFIG_CRYPTO_SHA1_S390) += sha1_s390.o sha_common.o
6obj-$(CONFIG_CRYPTO_SHA256_S390) += sha256_s390.o sha_common.o 6obj-$(CONFIG_CRYPTO_SHA256_S390) += sha256_s390.o sha_common.o
7obj-$(CONFIG_CRYPTO_SHA512_S390) += sha512_s390.o sha_common.o 7obj-$(CONFIG_CRYPTO_SHA512_S390) += sha512_s390.o sha_common.o
8obj-$(CONFIG_CRYPTO_DES_S390) += des_s390.o des_check_key.o 8obj-$(CONFIG_CRYPTO_DES_S390) += des_s390.o
9obj-$(CONFIG_CRYPTO_AES_S390) += aes_s390.o 9obj-$(CONFIG_CRYPTO_AES_S390) += aes_s390.o
10obj-$(CONFIG_S390_PRNG) += prng.o 10obj-$(CONFIG_S390_PRNG) += prng.o
diff --git a/arch/s390/crypto/crypto_des.h b/arch/s390/crypto/crypto_des.h
index c964b64111dd..6210457ceebb 100644
--- a/arch/s390/crypto/crypto_des.h
+++ b/arch/s390/crypto/crypto_des.h
@@ -15,4 +15,4 @@
15 15
16extern int crypto_des_check_key(const u8*, unsigned int, u32*); 16extern int crypto_des_check_key(const u8*, unsigned int, u32*);
17 17
18#endif //__CRYPTO_DES_H__ 18#endif /*__CRYPTO_DES_H__*/
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
index 2bc479ab3a66..cc5420118393 100644
--- a/arch/s390/crypto/des_s390.c
+++ b/arch/s390/crypto/des_s390.c
@@ -14,32 +14,21 @@
14 * 14 *
15 */ 15 */
16 16
17#include <crypto/algapi.h>
18#include <linux/init.h> 17#include <linux/init.h>
19#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/crypto.h>
20#include <crypto/algapi.h>
21#include <crypto/des.h>
20 22
21#include "crypt_s390.h" 23#include "crypt_s390.h"
22#include "crypto_des.h"
23
24#define DES_BLOCK_SIZE 8
25#define DES_KEY_SIZE 8
26
27#define DES3_128_KEY_SIZE (2 * DES_KEY_SIZE)
28#define DES3_128_BLOCK_SIZE DES_BLOCK_SIZE
29 24
30#define DES3_192_KEY_SIZE (3 * DES_KEY_SIZE) 25#define DES3_192_KEY_SIZE (3 * DES_KEY_SIZE)
31#define DES3_192_BLOCK_SIZE DES_BLOCK_SIZE
32 26
33struct crypt_s390_des_ctx { 27struct crypt_s390_des_ctx {
34 u8 iv[DES_BLOCK_SIZE]; 28 u8 iv[DES_BLOCK_SIZE];
35 u8 key[DES_KEY_SIZE]; 29 u8 key[DES_KEY_SIZE];
36}; 30};
37 31
38struct crypt_s390_des3_128_ctx {
39 u8 iv[DES_BLOCK_SIZE];
40 u8 key[DES3_128_KEY_SIZE];
41};
42
43struct crypt_s390_des3_192_ctx { 32struct crypt_s390_des3_192_ctx {
44 u8 iv[DES_BLOCK_SIZE]; 33 u8 iv[DES_BLOCK_SIZE];
45 u8 key[DES3_192_KEY_SIZE]; 34 u8 key[DES3_192_KEY_SIZE];
@@ -50,13 +39,16 @@ static int des_setkey(struct crypto_tfm *tfm, const u8 *key,
50{ 39{
51 struct crypt_s390_des_ctx *dctx = crypto_tfm_ctx(tfm); 40 struct crypt_s390_des_ctx *dctx = crypto_tfm_ctx(tfm);
52 u32 *flags = &tfm->crt_flags; 41 u32 *flags = &tfm->crt_flags;
53 int ret; 42 u32 tmp[DES_EXPKEY_WORDS];
54 43
55 /* test if key is valid (not a weak key) */ 44 /* check for weak keys */
56 ret = crypto_des_check_key(key, keylen, flags); 45 if (!des_ekey(tmp, key) && (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) {
57 if (ret == 0) 46 *flags |= CRYPTO_TFM_RES_WEAK_KEY;
58 memcpy(dctx->key, key, keylen); 47 return -EINVAL;
59 return ret; 48 }
49
50 memcpy(dctx->key, key, keylen);
51 return 0;
60} 52}
61 53
62static void des_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) 54static void des_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
@@ -237,165 +229,6 @@ static struct crypto_alg cbc_des_alg = {
237 * complementation keys. Any weakness is obviated by the use of 229 * complementation keys. Any weakness is obviated by the use of
238 * multiple keys. 230 * multiple keys.
239 * 231 *
240 * However, if the two independent 64-bit keys are equal,
241 * then the DES3 operation is simply the same as DES.
242 * Implementers MUST reject keys that exhibit this property.
243 *
244 */
245static int des3_128_setkey(struct crypto_tfm *tfm, const u8 *key,
246 unsigned int keylen)
247{
248 int i, ret;
249 struct crypt_s390_des3_128_ctx *dctx = crypto_tfm_ctx(tfm);
250 const u8 *temp_key = key;
251 u32 *flags = &tfm->crt_flags;
252
253 if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE)) &&
254 (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) {
255 *flags |= CRYPTO_TFM_RES_WEAK_KEY;
256 return -EINVAL;
257 }
258 for (i = 0; i < 2; i++, temp_key += DES_KEY_SIZE) {
259 ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags);
260 if (ret < 0)
261 return ret;
262 }
263 memcpy(dctx->key, key, keylen);
264 return 0;
265}
266
267static void des3_128_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
268{
269 struct crypt_s390_des3_128_ctx *dctx = crypto_tfm_ctx(tfm);
270
271 crypt_s390_km(KM_TDEA_128_ENCRYPT, dctx->key, dst, (void*)src,
272 DES3_128_BLOCK_SIZE);
273}
274
275static void des3_128_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
276{
277 struct crypt_s390_des3_128_ctx *dctx = crypto_tfm_ctx(tfm);
278
279 crypt_s390_km(KM_TDEA_128_DECRYPT, dctx->key, dst, (void*)src,
280 DES3_128_BLOCK_SIZE);
281}
282
283static struct crypto_alg des3_128_alg = {
284 .cra_name = "des3_ede128",
285 .cra_driver_name = "des3_ede128-s390",
286 .cra_priority = CRYPT_S390_PRIORITY,
287 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
288 .cra_blocksize = DES3_128_BLOCK_SIZE,
289 .cra_ctxsize = sizeof(struct crypt_s390_des3_128_ctx),
290 .cra_module = THIS_MODULE,
291 .cra_list = LIST_HEAD_INIT(des3_128_alg.cra_list),
292 .cra_u = {
293 .cipher = {
294 .cia_min_keysize = DES3_128_KEY_SIZE,
295 .cia_max_keysize = DES3_128_KEY_SIZE,
296 .cia_setkey = des3_128_setkey,
297 .cia_encrypt = des3_128_encrypt,
298 .cia_decrypt = des3_128_decrypt,
299 }
300 }
301};
302
303static int ecb_des3_128_encrypt(struct blkcipher_desc *desc,
304 struct scatterlist *dst,
305 struct scatterlist *src, unsigned int nbytes)
306{
307 struct crypt_s390_des3_128_ctx *sctx = crypto_blkcipher_ctx(desc->tfm);
308 struct blkcipher_walk walk;
309
310 blkcipher_walk_init(&walk, dst, src, nbytes);
311 return ecb_desall_crypt(desc, KM_TDEA_128_ENCRYPT, sctx->key, &walk);
312}
313
314static int ecb_des3_128_decrypt(struct blkcipher_desc *desc,
315 struct scatterlist *dst,
316 struct scatterlist *src, unsigned int nbytes)
317{
318 struct crypt_s390_des3_128_ctx *sctx = crypto_blkcipher_ctx(desc->tfm);
319 struct blkcipher_walk walk;
320
321 blkcipher_walk_init(&walk, dst, src, nbytes);
322 return ecb_desall_crypt(desc, KM_TDEA_128_DECRYPT, sctx->key, &walk);
323}
324
325static struct crypto_alg ecb_des3_128_alg = {
326 .cra_name = "ecb(des3_ede128)",
327 .cra_driver_name = "ecb-des3_ede128-s390",
328 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY,
329 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
330 .cra_blocksize = DES3_128_BLOCK_SIZE,
331 .cra_ctxsize = sizeof(struct crypt_s390_des3_128_ctx),
332 .cra_type = &crypto_blkcipher_type,
333 .cra_module = THIS_MODULE,
334 .cra_list = LIST_HEAD_INIT(
335 ecb_des3_128_alg.cra_list),
336 .cra_u = {
337 .blkcipher = {
338 .min_keysize = DES3_128_KEY_SIZE,
339 .max_keysize = DES3_128_KEY_SIZE,
340 .setkey = des3_128_setkey,
341 .encrypt = ecb_des3_128_encrypt,
342 .decrypt = ecb_des3_128_decrypt,
343 }
344 }
345};
346
347static int cbc_des3_128_encrypt(struct blkcipher_desc *desc,
348 struct scatterlist *dst,
349 struct scatterlist *src, unsigned int nbytes)
350{
351 struct crypt_s390_des3_128_ctx *sctx = crypto_blkcipher_ctx(desc->tfm);
352 struct blkcipher_walk walk;
353
354 blkcipher_walk_init(&walk, dst, src, nbytes);
355 return cbc_desall_crypt(desc, KMC_TDEA_128_ENCRYPT, sctx->iv, &walk);
356}
357
358static int cbc_des3_128_decrypt(struct blkcipher_desc *desc,
359 struct scatterlist *dst,
360 struct scatterlist *src, unsigned int nbytes)
361{
362 struct crypt_s390_des3_128_ctx *sctx = crypto_blkcipher_ctx(desc->tfm);
363 struct blkcipher_walk walk;
364
365 blkcipher_walk_init(&walk, dst, src, nbytes);
366 return cbc_desall_crypt(desc, KMC_TDEA_128_DECRYPT, sctx->iv, &walk);
367}
368
369static struct crypto_alg cbc_des3_128_alg = {
370 .cra_name = "cbc(des3_ede128)",
371 .cra_driver_name = "cbc-des3_ede128-s390",
372 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY,
373 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
374 .cra_blocksize = DES3_128_BLOCK_SIZE,
375 .cra_ctxsize = sizeof(struct crypt_s390_des3_128_ctx),
376 .cra_type = &crypto_blkcipher_type,
377 .cra_module = THIS_MODULE,
378 .cra_list = LIST_HEAD_INIT(
379 cbc_des3_128_alg.cra_list),
380 .cra_u = {
381 .blkcipher = {
382 .min_keysize = DES3_128_KEY_SIZE,
383 .max_keysize = DES3_128_KEY_SIZE,
384 .ivsize = DES3_128_BLOCK_SIZE,
385 .setkey = des3_128_setkey,
386 .encrypt = cbc_des3_128_encrypt,
387 .decrypt = cbc_des3_128_decrypt,
388 }
389 }
390};
391
392/*
393 * RFC2451:
394 *
395 * For DES-EDE3, there is no known need to reject weak or
396 * complementation keys. Any weakness is obviated by the use of
397 * multiple keys.
398 *
399 * However, if the first two or last two independent 64-bit keys are 232 * However, if the first two or last two independent 64-bit keys are
400 * equal (k1 == k2 or k2 == k3), then the DES3 operation is simply the 233 * equal (k1 == k2 or k2 == k3), then the DES3 operation is simply the
401 * same as DES. Implementers MUST reject keys that exhibit this 234 * same as DES. Implementers MUST reject keys that exhibit this
@@ -405,9 +238,7 @@ static struct crypto_alg cbc_des3_128_alg = {
405static int des3_192_setkey(struct crypto_tfm *tfm, const u8 *key, 238static int des3_192_setkey(struct crypto_tfm *tfm, const u8 *key,
406 unsigned int keylen) 239 unsigned int keylen)
407{ 240{
408 int i, ret;
409 struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); 241 struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm);
410 const u8 *temp_key = key;
411 u32 *flags = &tfm->crt_flags; 242 u32 *flags = &tfm->crt_flags;
412 243
413 if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && 244 if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) &&
@@ -417,11 +248,6 @@ static int des3_192_setkey(struct crypto_tfm *tfm, const u8 *key,
417 *flags |= CRYPTO_TFM_RES_WEAK_KEY; 248 *flags |= CRYPTO_TFM_RES_WEAK_KEY;
418 return -EINVAL; 249 return -EINVAL;
419 } 250 }
420 for (i = 0; i < 3; i++, temp_key += DES_KEY_SIZE) {
421 ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags);
422 if (ret < 0)
423 return ret;
424 }
425 memcpy(dctx->key, key, keylen); 251 memcpy(dctx->key, key, keylen);
426 return 0; 252 return 0;
427} 253}
@@ -431,7 +257,7 @@ static void des3_192_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
431 struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); 257 struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm);
432 258
433 crypt_s390_km(KM_TDEA_192_ENCRYPT, dctx->key, dst, (void*)src, 259 crypt_s390_km(KM_TDEA_192_ENCRYPT, dctx->key, dst, (void*)src,
434 DES3_192_BLOCK_SIZE); 260 DES_BLOCK_SIZE);
435} 261}
436 262
437static void des3_192_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) 263static void des3_192_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
@@ -439,7 +265,7 @@ static void des3_192_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
439 struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); 265 struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm);
440 266
441 crypt_s390_km(KM_TDEA_192_DECRYPT, dctx->key, dst, (void*)src, 267 crypt_s390_km(KM_TDEA_192_DECRYPT, dctx->key, dst, (void*)src,
442 DES3_192_BLOCK_SIZE); 268 DES_BLOCK_SIZE);
443} 269}
444 270
445static struct crypto_alg des3_192_alg = { 271static struct crypto_alg des3_192_alg = {
@@ -447,7 +273,7 @@ static struct crypto_alg des3_192_alg = {
447 .cra_driver_name = "des3_ede-s390", 273 .cra_driver_name = "des3_ede-s390",
448 .cra_priority = CRYPT_S390_PRIORITY, 274 .cra_priority = CRYPT_S390_PRIORITY,
449 .cra_flags = CRYPTO_ALG_TYPE_CIPHER, 275 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
450 .cra_blocksize = DES3_192_BLOCK_SIZE, 276 .cra_blocksize = DES_BLOCK_SIZE,
451 .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), 277 .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx),
452 .cra_module = THIS_MODULE, 278 .cra_module = THIS_MODULE,
453 .cra_list = LIST_HEAD_INIT(des3_192_alg.cra_list), 279 .cra_list = LIST_HEAD_INIT(des3_192_alg.cra_list),
@@ -489,7 +315,7 @@ static struct crypto_alg ecb_des3_192_alg = {
489 .cra_driver_name = "ecb-des3_ede-s390", 315 .cra_driver_name = "ecb-des3_ede-s390",
490 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY, 316 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY,
491 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, 317 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
492 .cra_blocksize = DES3_192_BLOCK_SIZE, 318 .cra_blocksize = DES_BLOCK_SIZE,
493 .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), 319 .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx),
494 .cra_type = &crypto_blkcipher_type, 320 .cra_type = &crypto_blkcipher_type,
495 .cra_module = THIS_MODULE, 321 .cra_module = THIS_MODULE,
@@ -533,7 +359,7 @@ static struct crypto_alg cbc_des3_192_alg = {
533 .cra_driver_name = "cbc-des3_ede-s390", 359 .cra_driver_name = "cbc-des3_ede-s390",
534 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY, 360 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY,
535 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, 361 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
536 .cra_blocksize = DES3_192_BLOCK_SIZE, 362 .cra_blocksize = DES_BLOCK_SIZE,
537 .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), 363 .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx),
538 .cra_type = &crypto_blkcipher_type, 364 .cra_type = &crypto_blkcipher_type,
539 .cra_module = THIS_MODULE, 365 .cra_module = THIS_MODULE,
@@ -543,7 +369,7 @@ static struct crypto_alg cbc_des3_192_alg = {
543 .blkcipher = { 369 .blkcipher = {
544 .min_keysize = DES3_192_KEY_SIZE, 370 .min_keysize = DES3_192_KEY_SIZE,
545 .max_keysize = DES3_192_KEY_SIZE, 371 .max_keysize = DES3_192_KEY_SIZE,
546 .ivsize = DES3_192_BLOCK_SIZE, 372 .ivsize = DES_BLOCK_SIZE,
547 .setkey = des3_192_setkey, 373 .setkey = des3_192_setkey,
548 .encrypt = cbc_des3_192_encrypt, 374 .encrypt = cbc_des3_192_encrypt,
549 .decrypt = cbc_des3_192_decrypt, 375 .decrypt = cbc_des3_192_decrypt,
@@ -553,10 +379,9 @@ static struct crypto_alg cbc_des3_192_alg = {
553 379
554static int des_s390_init(void) 380static int des_s390_init(void)
555{ 381{
556 int ret = 0; 382 int ret;
557 383
558 if (!crypt_s390_func_available(KM_DEA_ENCRYPT) || 384 if (!crypt_s390_func_available(KM_DEA_ENCRYPT) ||
559 !crypt_s390_func_available(KM_TDEA_128_ENCRYPT) ||
560 !crypt_s390_func_available(KM_TDEA_192_ENCRYPT)) 385 !crypt_s390_func_available(KM_TDEA_192_ENCRYPT))
561 return -EOPNOTSUPP; 386 return -EOPNOTSUPP;
562 387
@@ -569,17 +394,6 @@ static int des_s390_init(void)
569 ret = crypto_register_alg(&cbc_des_alg); 394 ret = crypto_register_alg(&cbc_des_alg);
570 if (ret) 395 if (ret)
571 goto cbc_des_err; 396 goto cbc_des_err;
572
573 ret = crypto_register_alg(&des3_128_alg);
574 if (ret)
575 goto des3_128_err;
576 ret = crypto_register_alg(&ecb_des3_128_alg);
577 if (ret)
578 goto ecb_des3_128_err;
579 ret = crypto_register_alg(&cbc_des3_128_alg);
580 if (ret)
581 goto cbc_des3_128_err;
582
583 ret = crypto_register_alg(&des3_192_alg); 397 ret = crypto_register_alg(&des3_192_alg);
584 if (ret) 398 if (ret)
585 goto des3_192_err; 399 goto des3_192_err;
@@ -589,7 +403,6 @@ static int des_s390_init(void)
589 ret = crypto_register_alg(&cbc_des3_192_alg); 403 ret = crypto_register_alg(&cbc_des3_192_alg);
590 if (ret) 404 if (ret)
591 goto cbc_des3_192_err; 405 goto cbc_des3_192_err;
592
593out: 406out:
594 return ret; 407 return ret;
595 408
@@ -598,12 +411,6 @@ cbc_des3_192_err:
598ecb_des3_192_err: 411ecb_des3_192_err:
599 crypto_unregister_alg(&des3_192_alg); 412 crypto_unregister_alg(&des3_192_alg);
600des3_192_err: 413des3_192_err:
601 crypto_unregister_alg(&cbc_des3_128_alg);
602cbc_des3_128_err:
603 crypto_unregister_alg(&ecb_des3_128_alg);
604ecb_des3_128_err:
605 crypto_unregister_alg(&des3_128_alg);
606des3_128_err:
607 crypto_unregister_alg(&cbc_des_alg); 414 crypto_unregister_alg(&cbc_des_alg);
608cbc_des_err: 415cbc_des_err:
609 crypto_unregister_alg(&ecb_des_alg); 416 crypto_unregister_alg(&ecb_des_alg);
@@ -613,21 +420,18 @@ des_err:
613 goto out; 420 goto out;
614} 421}
615 422
616static void __exit des_s390_fini(void) 423static void __exit des_s390_exit(void)
617{ 424{
618 crypto_unregister_alg(&cbc_des3_192_alg); 425 crypto_unregister_alg(&cbc_des3_192_alg);
619 crypto_unregister_alg(&ecb_des3_192_alg); 426 crypto_unregister_alg(&ecb_des3_192_alg);
620 crypto_unregister_alg(&des3_192_alg); 427 crypto_unregister_alg(&des3_192_alg);
621 crypto_unregister_alg(&cbc_des3_128_alg);
622 crypto_unregister_alg(&ecb_des3_128_alg);
623 crypto_unregister_alg(&des3_128_alg);
624 crypto_unregister_alg(&cbc_des_alg); 428 crypto_unregister_alg(&cbc_des_alg);
625 crypto_unregister_alg(&ecb_des_alg); 429 crypto_unregister_alg(&ecb_des_alg);
626 crypto_unregister_alg(&des_alg); 430 crypto_unregister_alg(&des_alg);
627} 431}
628 432
629module_init(des_s390_init); 433module_init(des_s390_init);
630module_exit(des_s390_fini); 434module_exit(des_s390_exit);
631 435
632MODULE_ALIAS("des"); 436MODULE_ALIAS("des");
633MODULE_ALIAS("des3_ede"); 437MODULE_ALIAS("des3_ede");
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 6b120f073043..98a4a4c267a7 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -117,10 +117,10 @@ static struct inode *hypfs_make_inode(struct super_block *sb, int mode)
117 return ret; 117 return ret;
118} 118}
119 119
120static void hypfs_drop_inode(struct inode *inode) 120static void hypfs_evict_inode(struct inode *inode)
121{ 121{
122 end_writeback(inode);
122 kfree(inode->i_private); 123 kfree(inode->i_private);
123 generic_delete_inode(inode);
124} 124}
125 125
126static int hypfs_open(struct inode *inode, struct file *filp) 126static int hypfs_open(struct inode *inode, struct file *filp)
@@ -460,7 +460,7 @@ static struct file_system_type hypfs_type = {
460 460
461static const struct super_operations hypfs_s_ops = { 461static const struct super_operations hypfs_s_ops = {
462 .statfs = simple_statfs, 462 .statfs = simple_statfs,
463 .drop_inode = hypfs_drop_inode, 463 .evict_inode = hypfs_evict_inode,
464 .show_options = hypfs_show_options, 464 .show_options = hypfs_show_options,
465}; 465};
466 466
diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h
index 1c0030f9b890..f3ba0fa98de6 100644
--- a/arch/s390/include/asm/ccwdev.h
+++ b/arch/s390/include/asm/ccwdev.h
@@ -208,6 +208,8 @@ extern void ccw_device_get_id(struct ccw_device *, struct ccw_dev_id *);
208extern struct ccw_device *ccw_device_probe_console(void); 208extern struct ccw_device *ccw_device_probe_console(void);
209extern int ccw_device_force_console(void); 209extern int ccw_device_force_console(void);
210 210
211int ccw_device_siosl(struct ccw_device *);
212
211// FIXME: these have to go 213// FIXME: these have to go
212extern int _ccw_device_get_subchannel_number(struct ccw_device *); 214extern int _ccw_device_get_subchannel_number(struct ccw_device *);
213 215
diff --git a/arch/s390/include/asm/ioctls.h b/arch/s390/include/asm/ioctls.h
index 40e481b1b461..2f3d8736361f 100644
--- a/arch/s390/include/asm/ioctls.h
+++ b/arch/s390/include/asm/ioctls.h
@@ -60,6 +60,7 @@
60#define TCSETSF2 _IOW('T',0x2D, struct termios2) 60#define TCSETSF2 _IOW('T',0x2D, struct termios2)
61#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 61#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
62#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 62#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
63#define TIOCSIG _IOW('T',0x36, int) /* Generate signal on Pty slave */
63 64
64#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ 65#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
65#define FIOCLEX 0x5451 66#define FIOCLEX 0x5451
@@ -86,6 +87,7 @@
86#define TIOCPKT_START 8 87#define TIOCPKT_START 8
87#define TIOCPKT_NOSTOP 16 88#define TIOCPKT_NOSTOP 16
88#define TIOCPKT_DOSTOP 32 89#define TIOCPKT_DOSTOP 32
90#define TIOCPKT_IOCTL 64
89 91
90#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ 92#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
91 93
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index 27605b62b980..cef7dbf69dfc 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -26,7 +26,7 @@
26 26
27struct sca_entry { 27struct sca_entry {
28 atomic_t scn; 28 atomic_t scn;
29 __u64 reserved; 29 __u32 reserved;
30 __u64 sda; 30 __u64 sda;
31 __u64 reserved2[2]; 31 __u64 reserved2[2];
32} __attribute__((packed)); 32} __attribute__((packed));
@@ -41,7 +41,8 @@ struct sca_block {
41} __attribute__((packed)); 41} __attribute__((packed));
42 42
43#define KVM_NR_PAGE_SIZES 2 43#define KVM_NR_PAGE_SIZES 2
44#define KVM_HPAGE_SHIFT(x) (PAGE_SHIFT + ((x) - 1) * 8) 44#define KVM_HPAGE_GFN_SHIFT(x) (((x) - 1) * 8)
45#define KVM_HPAGE_SHIFT(x) (PAGE_SHIFT + KVM_HPAGE_GFN_SHIFT(x))
45#define KVM_HPAGE_SIZE(x) (1UL << KVM_HPAGE_SHIFT(x)) 46#define KVM_HPAGE_SIZE(x) (1UL << KVM_HPAGE_SHIFT(x))
46#define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1)) 47#define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1))
47#define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE) 48#define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE)
diff --git a/arch/s390/include/asm/local64.h b/arch/s390/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/s390/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/s390/include/asm/mmu.h b/arch/s390/include/asm/mmu.h
index 03be99919d62..99e3409102b9 100644
--- a/arch/s390/include/asm/mmu.h
+++ b/arch/s390/include/asm/mmu.h
@@ -13,4 +13,9 @@ typedef struct {
13 int alloc_pgste; /* cloned contexts will have extended page tables */ 13 int alloc_pgste; /* cloned contexts will have extended page tables */
14} mm_context_t; 14} mm_context_t;
15 15
16#define INIT_MM_CONTEXT(name) \
17 .context.list_lock = __SPIN_LOCK_UNLOCKED(name.context.list_lock), \
18 .context.crst_list = LIST_HEAD_INIT(name.context.crst_list), \
19 .context.pgtable_list = LIST_HEAD_INIT(name.context.pgtable_list),
20
16#endif 21#endif
diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h
index 0eaae6260274..2ba630276295 100644
--- a/arch/s390/include/asm/qdio.h
+++ b/arch/s390/include/asm/qdio.h
@@ -84,6 +84,7 @@ struct qdr {
84 84
85#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40 85#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40
86#define QIB_RFLAGS_ENABLE_QEBSM 0x80 86#define QIB_RFLAGS_ENABLE_QEBSM 0x80
87#define QIB_RFLAGS_ENABLE_DATA_DIV 0x02
87 88
88/** 89/**
89 * struct qib - queue information block (QIB) 90 * struct qib - queue information block (QIB)
@@ -284,6 +285,9 @@ struct slsb {
284 u8 val[QDIO_MAX_BUFFERS_PER_Q]; 285 u8 val[QDIO_MAX_BUFFERS_PER_Q];
285} __attribute__ ((packed, aligned(256))); 286} __attribute__ ((packed, aligned(256)));
286 287
288#define CHSC_AC2_DATA_DIV_AVAILABLE 0x0010
289#define CHSC_AC2_DATA_DIV_ENABLED 0x0002
290
287struct qdio_ssqd_desc { 291struct qdio_ssqd_desc {
288 u8 flags; 292 u8 flags;
289 u8:8; 293 u8:8;
@@ -332,6 +336,7 @@ typedef void qdio_handler_t(struct ccw_device *, unsigned int, int,
332 * @adapter_name: name for the adapter 336 * @adapter_name: name for the adapter
333 * @qib_param_field_format: format for qib_parm_field 337 * @qib_param_field_format: format for qib_parm_field
334 * @qib_param_field: pointer to 128 bytes or NULL, if no param field 338 * @qib_param_field: pointer to 128 bytes or NULL, if no param field
339 * @qib_rflags: rflags to set
335 * @input_slib_elements: pointer to no_input_qs * 128 words of data or NULL 340 * @input_slib_elements: pointer to no_input_qs * 128 words of data or NULL
336 * @output_slib_elements: pointer to no_output_qs * 128 words of data or NULL 341 * @output_slib_elements: pointer to no_output_qs * 128 words of data or NULL
337 * @no_input_qs: number of input queues 342 * @no_input_qs: number of input queues
@@ -348,6 +353,7 @@ struct qdio_initialize {
348 unsigned char adapter_name[8]; 353 unsigned char adapter_name[8];
349 unsigned int qib_param_field_format; 354 unsigned int qib_param_field_format;
350 unsigned char *qib_param_field; 355 unsigned char *qib_param_field;
356 unsigned char qib_rflags;
351 unsigned long *input_slib_elements; 357 unsigned long *input_slib_elements;
352 unsigned long *output_slib_elements; 358 unsigned long *output_slib_elements;
353 unsigned int no_input_qs; 359 unsigned int no_input_qs;
diff --git a/arch/s390/include/asm/statfs.h b/arch/s390/include/asm/statfs.h
index 06cc70307ece..3be7fbd406c8 100644
--- a/arch/s390/include/asm/statfs.h
+++ b/arch/s390/include/asm/statfs.h
@@ -33,7 +33,8 @@ struct statfs {
33 __kernel_fsid_t f_fsid; 33 __kernel_fsid_t f_fsid;
34 int f_namelen; 34 int f_namelen;
35 int f_frsize; 35 int f_frsize;
36 int f_spare[5]; 36 int f_flags;
37 int f_spare[4];
37}; 38};
38 39
39struct statfs64 { 40struct statfs64 {
@@ -47,7 +48,8 @@ struct statfs64 {
47 __kernel_fsid_t f_fsid; 48 __kernel_fsid_t f_fsid;
48 int f_namelen; 49 int f_namelen;
49 int f_frsize; 50 int f_frsize;
50 int f_spare[5]; 51 int f_flags;
52 int f_spare[4];
51}; 53};
52 54
53struct compat_statfs64 { 55struct compat_statfs64 {
@@ -61,7 +63,8 @@ struct compat_statfs64 {
61 __kernel_fsid_t f_fsid; 63 __kernel_fsid_t f_fsid;
62 __u32 f_namelen; 64 __u32 f_namelen;
63 __u32 f_frsize; 65 __u32 f_frsize;
64 __u32 f_spare[5]; 66 __u32 f_flags;
67 __u32 f_spare[4];
65}; 68};
66 69
67#endif /* __s390x__ */ 70#endif /* __s390x__ */
diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h
index dc8a67297d0f..831bd033ea77 100644
--- a/arch/s390/include/asm/topology.h
+++ b/arch/s390/include/asm/topology.h
@@ -30,8 +30,6 @@ static inline void s390_init_cpu_topology(void)
30}; 30};
31#endif 31#endif
32 32
33#define SD_MC_INIT SD_CPU_INIT
34
35#include <asm-generic/topology.h> 33#include <asm-generic/topology.h>
36 34
37#endif /* _ASM_S390_TOPOLOGY_H */ 35#endif /* _ASM_S390_TOPOLOGY_H */
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index 51838ad42d56..db1696e210af 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -366,7 +366,7 @@ iplstart:
366 l %r1,.Lstartup 366 l %r1,.Lstartup
367 br %r1 367 br %r1
368 368
369.Linitrd:.long _end + 0x400000 # default address of initrd 369.Linitrd:.long _end # default address of initrd
370.Lparm: .long PARMAREA 370.Lparm: .long PARMAREA
371.Lstartup: .long startup 371.Lstartup: .long startup
372.Lreset:.byte 0xc3,0xc8,0xc1,0xd5,0xc7,0xc5,0x40,0xd9,0xc4,0xd9,0x40 372.Lreset:.byte 0xc3,0xc8,0xc1,0xd5,0xc7,0xc5,0x40,0xd9,0xc4,0xd9,0x40
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 15a7536452d5..2896cac9c14a 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -207,8 +207,8 @@ struct clocksource * __init clocksource_default_clock(void)
207 return &clocksource_tod; 207 return &clocksource_tod;
208} 208}
209 209
210void update_vsyscall(struct timespec *wall_time, struct clocksource *clock, 210void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
211 u32 mult) 211 struct clocksource *clock, u32 mult)
212{ 212{
213 if (clock != &clocksource_tod) 213 if (clock != &clocksource_tod)
214 return; 214 return;
@@ -219,8 +219,8 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
219 vdso_data->xtime_tod_stamp = clock->cycle_last; 219 vdso_data->xtime_tod_stamp = clock->cycle_last;
220 vdso_data->xtime_clock_sec = wall_time->tv_sec; 220 vdso_data->xtime_clock_sec = wall_time->tv_sec;
221 vdso_data->xtime_clock_nsec = wall_time->tv_nsec; 221 vdso_data->xtime_clock_nsec = wall_time->tv_nsec;
222 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; 222 vdso_data->wtom_clock_sec = wtm->tv_sec;
223 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; 223 vdso_data->wtom_clock_nsec = wtm->tv_nsec;
224 vdso_data->ntp_mult = mult; 224 vdso_data->ntp_mult = mult;
225 smp_wmb(); 225 smp_wmb();
226 ++vdso_data->tb_update_count; 226 ++vdso_data->tb_update_count;
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index 3ddc30895e31..f7b6df45d8be 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -135,7 +135,7 @@ static int handle_stop(struct kvm_vcpu *vcpu)
135 spin_lock_bh(&vcpu->arch.local_int.lock); 135 spin_lock_bh(&vcpu->arch.local_int.lock);
136 if (vcpu->arch.local_int.action_bits & ACTION_STORE_ON_STOP) { 136 if (vcpu->arch.local_int.action_bits & ACTION_STORE_ON_STOP) {
137 vcpu->arch.local_int.action_bits &= ~ACTION_STORE_ON_STOP; 137 vcpu->arch.local_int.action_bits &= ~ACTION_STORE_ON_STOP;
138 rc = __kvm_s390_vcpu_store_status(vcpu, 138 rc = kvm_s390_vcpu_store_status(vcpu,
139 KVM_S390_STORE_STATUS_NOADDR); 139 KVM_S390_STORE_STATUS_NOADDR);
140 if (rc >= 0) 140 if (rc >= 0)
141 rc = -EOPNOTSUPP; 141 rc = -EOPNOTSUPP;
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index ae3705816878..4fe68650535c 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -207,6 +207,7 @@ out_nokvm:
207void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) 207void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
208{ 208{
209 VCPU_EVENT(vcpu, 3, "%s", "free cpu"); 209 VCPU_EVENT(vcpu, 3, "%s", "free cpu");
210 clear_bit(63 - vcpu->vcpu_id, (unsigned long *) &vcpu->kvm->arch.sca->mcn);
210 if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda == 211 if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda ==
211 (__u64) vcpu->arch.sie_block) 212 (__u64) vcpu->arch.sie_block)
212 vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda = 0; 213 vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda = 0;
@@ -296,7 +297,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
296{ 297{
297 atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH); 298 atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH);
298 set_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests); 299 set_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests);
299 vcpu->arch.sie_block->ecb = 2; 300 vcpu->arch.sie_block->ecb = 6;
300 vcpu->arch.sie_block->eca = 0xC1002001U; 301 vcpu->arch.sie_block->eca = 0xC1002001U;
301 vcpu->arch.sie_block->fac = (int) (long) facilities; 302 vcpu->arch.sie_block->fac = (int) (long) facilities;
302 hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); 303 hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
@@ -329,6 +330,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
329 kvm->arch.sca->cpu[id].sda = (__u64) vcpu->arch.sie_block; 330 kvm->arch.sca->cpu[id].sda = (__u64) vcpu->arch.sie_block;
330 vcpu->arch.sie_block->scaoh = (__u32)(((__u64)kvm->arch.sca) >> 32); 331 vcpu->arch.sie_block->scaoh = (__u32)(((__u64)kvm->arch.sca) >> 32);
331 vcpu->arch.sie_block->scaol = (__u32)(__u64)kvm->arch.sca; 332 vcpu->arch.sie_block->scaol = (__u32)(__u64)kvm->arch.sca;
333 set_bit(63 - id, (unsigned long *) &kvm->arch.sca->mcn);
332 334
333 spin_lock_init(&vcpu->arch.local_int.lock); 335 spin_lock_init(&vcpu->arch.local_int.lock);
334 INIT_LIST_HEAD(&vcpu->arch.local_int.list); 336 INIT_LIST_HEAD(&vcpu->arch.local_int.list);
@@ -363,63 +365,49 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
363 365
364static int kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu) 366static int kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
365{ 367{
366 vcpu_load(vcpu);
367 kvm_s390_vcpu_initial_reset(vcpu); 368 kvm_s390_vcpu_initial_reset(vcpu);
368 vcpu_put(vcpu);
369 return 0; 369 return 0;
370} 370}
371 371
372int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) 372int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
373{ 373{
374 vcpu_load(vcpu);
375 memcpy(&vcpu->arch.guest_gprs, &regs->gprs, sizeof(regs->gprs)); 374 memcpy(&vcpu->arch.guest_gprs, &regs->gprs, sizeof(regs->gprs));
376 vcpu_put(vcpu);
377 return 0; 375 return 0;
378} 376}
379 377
380int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) 378int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
381{ 379{
382 vcpu_load(vcpu);
383 memcpy(&regs->gprs, &vcpu->arch.guest_gprs, sizeof(regs->gprs)); 380 memcpy(&regs->gprs, &vcpu->arch.guest_gprs, sizeof(regs->gprs));
384 vcpu_put(vcpu);
385 return 0; 381 return 0;
386} 382}
387 383
388int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, 384int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
389 struct kvm_sregs *sregs) 385 struct kvm_sregs *sregs)
390{ 386{
391 vcpu_load(vcpu);
392 memcpy(&vcpu->arch.guest_acrs, &sregs->acrs, sizeof(sregs->acrs)); 387 memcpy(&vcpu->arch.guest_acrs, &sregs->acrs, sizeof(sregs->acrs));
393 memcpy(&vcpu->arch.sie_block->gcr, &sregs->crs, sizeof(sregs->crs)); 388 memcpy(&vcpu->arch.sie_block->gcr, &sregs->crs, sizeof(sregs->crs));
394 vcpu_put(vcpu);
395 return 0; 389 return 0;
396} 390}
397 391
398int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, 392int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
399 struct kvm_sregs *sregs) 393 struct kvm_sregs *sregs)
400{ 394{
401 vcpu_load(vcpu);
402 memcpy(&sregs->acrs, &vcpu->arch.guest_acrs, sizeof(sregs->acrs)); 395 memcpy(&sregs->acrs, &vcpu->arch.guest_acrs, sizeof(sregs->acrs));
403 memcpy(&sregs->crs, &vcpu->arch.sie_block->gcr, sizeof(sregs->crs)); 396 memcpy(&sregs->crs, &vcpu->arch.sie_block->gcr, sizeof(sregs->crs));
404 vcpu_put(vcpu);
405 return 0; 397 return 0;
406} 398}
407 399
408int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 400int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
409{ 401{
410 vcpu_load(vcpu);
411 memcpy(&vcpu->arch.guest_fpregs.fprs, &fpu->fprs, sizeof(fpu->fprs)); 402 memcpy(&vcpu->arch.guest_fpregs.fprs, &fpu->fprs, sizeof(fpu->fprs));
412 vcpu->arch.guest_fpregs.fpc = fpu->fpc; 403 vcpu->arch.guest_fpregs.fpc = fpu->fpc;
413 vcpu_put(vcpu);
414 return 0; 404 return 0;
415} 405}
416 406
417int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 407int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
418{ 408{
419 vcpu_load(vcpu);
420 memcpy(&fpu->fprs, &vcpu->arch.guest_fpregs.fprs, sizeof(fpu->fprs)); 409 memcpy(&fpu->fprs, &vcpu->arch.guest_fpregs.fprs, sizeof(fpu->fprs));
421 fpu->fpc = vcpu->arch.guest_fpregs.fpc; 410 fpu->fpc = vcpu->arch.guest_fpregs.fpc;
422 vcpu_put(vcpu);
423 return 0; 411 return 0;
424} 412}
425 413
@@ -427,14 +415,12 @@ static int kvm_arch_vcpu_ioctl_set_initial_psw(struct kvm_vcpu *vcpu, psw_t psw)
427{ 415{
428 int rc = 0; 416 int rc = 0;
429 417
430 vcpu_load(vcpu);
431 if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING) 418 if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING)
432 rc = -EBUSY; 419 rc = -EBUSY;
433 else { 420 else {
434 vcpu->run->psw_mask = psw.mask; 421 vcpu->run->psw_mask = psw.mask;
435 vcpu->run->psw_addr = psw.addr; 422 vcpu->run->psw_addr = psw.addr;
436 } 423 }
437 vcpu_put(vcpu);
438 return rc; 424 return rc;
439} 425}
440 426
@@ -498,8 +484,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
498 int rc; 484 int rc;
499 sigset_t sigsaved; 485 sigset_t sigsaved;
500 486
501 vcpu_load(vcpu);
502
503rerun_vcpu: 487rerun_vcpu:
504 if (vcpu->requests) 488 if (vcpu->requests)
505 if (test_and_clear_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests)) 489 if (test_and_clear_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests))
@@ -568,8 +552,6 @@ rerun_vcpu:
568 if (vcpu->sigset_active) 552 if (vcpu->sigset_active)
569 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 553 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
570 554
571 vcpu_put(vcpu);
572
573 vcpu->stat.exit_userspace++; 555 vcpu->stat.exit_userspace++;
574 return rc; 556 return rc;
575} 557}
@@ -589,7 +571,7 @@ static int __guestcopy(struct kvm_vcpu *vcpu, u64 guestdest, const void *from,
589 * KVM_S390_STORE_STATUS_NOADDR: -> 0x1200 on 64 bit 571 * KVM_S390_STORE_STATUS_NOADDR: -> 0x1200 on 64 bit
590 * KVM_S390_STORE_STATUS_PREFIXED: -> prefix 572 * KVM_S390_STORE_STATUS_PREFIXED: -> prefix
591 */ 573 */
592int __kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr) 574int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
593{ 575{
594 const unsigned char archmode = 1; 576 const unsigned char archmode = 1;
595 int prefix; 577 int prefix;
@@ -651,45 +633,42 @@ int __kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
651 return 0; 633 return 0;
652} 634}
653 635
654static int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
655{
656 int rc;
657
658 vcpu_load(vcpu);
659 rc = __kvm_s390_vcpu_store_status(vcpu, addr);
660 vcpu_put(vcpu);
661 return rc;
662}
663
664long kvm_arch_vcpu_ioctl(struct file *filp, 636long kvm_arch_vcpu_ioctl(struct file *filp,
665 unsigned int ioctl, unsigned long arg) 637 unsigned int ioctl, unsigned long arg)
666{ 638{
667 struct kvm_vcpu *vcpu = filp->private_data; 639 struct kvm_vcpu *vcpu = filp->private_data;
668 void __user *argp = (void __user *)arg; 640 void __user *argp = (void __user *)arg;
641 long r;
669 642
670 switch (ioctl) { 643 switch (ioctl) {
671 case KVM_S390_INTERRUPT: { 644 case KVM_S390_INTERRUPT: {
672 struct kvm_s390_interrupt s390int; 645 struct kvm_s390_interrupt s390int;
673 646
647 r = -EFAULT;
674 if (copy_from_user(&s390int, argp, sizeof(s390int))) 648 if (copy_from_user(&s390int, argp, sizeof(s390int)))
675 return -EFAULT; 649 break;
676 return kvm_s390_inject_vcpu(vcpu, &s390int); 650 r = kvm_s390_inject_vcpu(vcpu, &s390int);
651 break;
677 } 652 }
678 case KVM_S390_STORE_STATUS: 653 case KVM_S390_STORE_STATUS:
679 return kvm_s390_vcpu_store_status(vcpu, arg); 654 r = kvm_s390_vcpu_store_status(vcpu, arg);
655 break;
680 case KVM_S390_SET_INITIAL_PSW: { 656 case KVM_S390_SET_INITIAL_PSW: {
681 psw_t psw; 657 psw_t psw;
682 658
659 r = -EFAULT;
683 if (copy_from_user(&psw, argp, sizeof(psw))) 660 if (copy_from_user(&psw, argp, sizeof(psw)))
684 return -EFAULT; 661 break;
685 return kvm_arch_vcpu_ioctl_set_initial_psw(vcpu, psw); 662 r = kvm_arch_vcpu_ioctl_set_initial_psw(vcpu, psw);
663 break;
686 } 664 }
687 case KVM_S390_INITIAL_RESET: 665 case KVM_S390_INITIAL_RESET:
688 return kvm_arch_vcpu_ioctl_initial_reset(vcpu); 666 r = kvm_arch_vcpu_ioctl_initial_reset(vcpu);
667 break;
689 default: 668 default:
690 ; 669 r = -EINVAL;
691 } 670 }
692 return -EINVAL; 671 return r;
693} 672}
694 673
695/* Section: memory related */ 674/* Section: memory related */
@@ -744,11 +723,6 @@ void kvm_arch_flush_shadow(struct kvm *kvm)
744{ 723{
745} 724}
746 725
747gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
748{
749 return gfn;
750}
751
752static int __init kvm_s390_init(void) 726static int __init kvm_s390_init(void)
753{ 727{
754 int ret; 728 int ret;
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index cfa9d1777457..a7b7586626db 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -92,7 +92,7 @@ int kvm_s390_handle_b2(struct kvm_vcpu *vcpu);
92int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu); 92int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu);
93 93
94/* implemented in kvm-s390.c */ 94/* implemented in kvm-s390.c */
95int __kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, 95int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu,
96 unsigned long addr); 96 unsigned long addr);
97/* implemented in diag.c */ 97/* implemented in diag.c */
98int kvm_s390_handle_diag(struct kvm_vcpu *vcpu); 98int kvm_s390_handle_diag(struct kvm_vcpu *vcpu);
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index eb6a2ef5f82e..a9550dca3e4b 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -427,7 +427,7 @@ static struct notifier_block cmm_power_notifier = {
427 .notifier_call = cmm_power_event, 427 .notifier_call = cmm_power_event,
428}; 428};
429 429
430static int cmm_init(void) 430static int __init cmm_init(void)
431{ 431{
432 int rc = -ENOMEM; 432 int rc = -ENOMEM;
433 433
@@ -435,6 +435,13 @@ static int cmm_init(void)
435 if (!cmm_sysctl_header) 435 if (!cmm_sysctl_header)
436 goto out_sysctl; 436 goto out_sysctl;
437#ifdef CONFIG_CMM_IUCV 437#ifdef CONFIG_CMM_IUCV
438 /* convert sender to uppercase characters */
439 if (sender) {
440 int len = strlen(sender);
441 while (len--)
442 sender[len] = toupper(sender[len]);
443 }
444
438 rc = smsg_register_callback(SMSG_PREFIX, cmm_smsg_target); 445 rc = smsg_register_callback(SMSG_PREFIX, cmm_smsg_target);
439 if (rc < 0) 446 if (rc < 0)
440 goto out_smsg; 447 goto out_smsg;
@@ -467,7 +474,7 @@ out_sysctl:
467} 474}
468module_init(cmm_init); 475module_init(cmm_init);
469 476
470static void cmm_exit(void) 477static void __exit cmm_exit(void)
471{ 478{
472 unregister_sysctl_table(cmm_sysctl_header); 479 unregister_sysctl_table(cmm_sysctl_header);
473#ifdef CONFIG_CMM_IUCV 480#ifdef CONFIG_CMM_IUCV
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index 90165e7ca04e..34c43f23b28c 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -332,10 +332,6 @@ void __init vmem_map_init(void)
332 unsigned long start, end; 332 unsigned long start, end;
333 int i; 333 int i;
334 334
335 spin_lock_init(&init_mm.context.list_lock);
336 INIT_LIST_HEAD(&init_mm.context.crst_list);
337 INIT_LIST_HEAD(&init_mm.context.pgtable_list);
338 init_mm.context.noexec = 0;
339 ro_start = ((unsigned long)&_stext) & PAGE_MASK; 335 ro_start = ((unsigned long)&_stext) & PAGE_MASK;
340 ro_end = PFN_ALIGN((unsigned long)&_eshared); 336 ro_end = PFN_ALIGN((unsigned long)&_eshared);
341 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { 337 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) {