• Home
  • Raw
  • Download

Lines Matching full:arch

285 			kvm_clock_sync_scb(vcpu->arch.sie_block, *delta);  in kvm_clock_sync()
287 kvm->arch.epoch = vcpu->arch.sie_block->epoch; in kvm_clock_sync()
288 kvm->arch.epdx = vcpu->arch.sie_block->epdx; in kvm_clock_sync()
290 if (vcpu->arch.cputm_enabled) in kvm_clock_sync()
291 vcpu->arch.cputm_start += *delta; in kvm_clock_sync()
292 if (vcpu->arch.vsie_block) in kvm_clock_sync()
293 kvm_clock_sync_scb(vcpu->arch.vsie_block, in kvm_clock_sync()
597 struct gmap *gmap = kvm->arch.gmap; in kvm_arch_sync_dirty_log()
680 kvm->arch.use_irqchip = 1; in kvm_vm_ioctl_enable_cap()
685 kvm->arch.user_sigp = 1; in kvm_vm_ioctl_enable_cap()
693 set_kvm_facility(kvm->arch.model.fac_mask, 129); in kvm_vm_ioctl_enable_cap()
694 set_kvm_facility(kvm->arch.model.fac_list, 129); in kvm_vm_ioctl_enable_cap()
696 set_kvm_facility(kvm->arch.model.fac_mask, 134); in kvm_vm_ioctl_enable_cap()
697 set_kvm_facility(kvm->arch.model.fac_list, 134); in kvm_vm_ioctl_enable_cap()
700 set_kvm_facility(kvm->arch.model.fac_mask, 135); in kvm_vm_ioctl_enable_cap()
701 set_kvm_facility(kvm->arch.model.fac_list, 135); in kvm_vm_ioctl_enable_cap()
704 set_kvm_facility(kvm->arch.model.fac_mask, 148); in kvm_vm_ioctl_enable_cap()
705 set_kvm_facility(kvm->arch.model.fac_list, 148); in kvm_vm_ioctl_enable_cap()
708 set_kvm_facility(kvm->arch.model.fac_mask, 152); in kvm_vm_ioctl_enable_cap()
709 set_kvm_facility(kvm->arch.model.fac_list, 152); in kvm_vm_ioctl_enable_cap()
724 set_kvm_facility(kvm->arch.model.fac_mask, 64); in kvm_vm_ioctl_enable_cap()
725 set_kvm_facility(kvm->arch.model.fac_list, 64); in kvm_vm_ioctl_enable_cap()
737 set_kvm_facility(kvm->arch.model.fac_mask, 72); in kvm_vm_ioctl_enable_cap()
738 set_kvm_facility(kvm->arch.model.fac_list, 72); in kvm_vm_ioctl_enable_cap()
751 set_kvm_facility(kvm->arch.model.fac_mask, 133); in kvm_vm_ioctl_enable_cap()
752 set_kvm_facility(kvm->arch.model.fac_list, 133); in kvm_vm_ioctl_enable_cap()
763 else if (!hpage || kvm->arch.use_cmma || kvm_is_ucontrol(kvm)) in kvm_vm_ioctl_enable_cap()
775 kvm->arch.use_skf = 0; in kvm_vm_ioctl_enable_cap()
776 kvm->arch.use_pfmfi = 0; in kvm_vm_ioctl_enable_cap()
784 kvm->arch.user_stsi = 1; in kvm_vm_ioctl_enable_cap()
789 kvm->arch.user_instr0 = 1; in kvm_vm_ioctl_enable_cap()
808 kvm->arch.mem_limit); in kvm_s390_get_mem_control()
809 if (put_user(kvm->arch.mem_limit, (u64 __user *)attr->addr)) in kvm_s390_get_mem_control()
836 kvm->arch.use_cmma = 1; in kvm_s390_set_mem_control()
838 kvm->arch.use_pfmfi = 0; in kvm_s390_set_mem_control()
848 if (!kvm->arch.use_cmma) in kvm_s390_set_mem_control()
854 s390_reset_cmma(kvm->arch.gmap->mm); in kvm_s390_set_mem_control()
868 if (kvm->arch.mem_limit != KVM_S390_NO_MEM_LIMIT && in kvm_s390_set_mem_control()
869 new_limit > kvm->arch.mem_limit) in kvm_s390_set_mem_control()
888 gmap_remove(kvm->arch.gmap); in kvm_s390_set_mem_control()
890 kvm->arch.gmap = new; in kvm_s390_set_mem_control()
897 (void *) kvm->arch.gmap->asce); in kvm_s390_set_mem_control()
935 kvm->arch.crypto.crycb->aes_wrapping_key_mask, in kvm_s390_vm_set_crypto()
936 sizeof(kvm->arch.crypto.crycb->aes_wrapping_key_mask)); in kvm_s390_vm_set_crypto()
937 kvm->arch.crypto.aes_kw = 1; in kvm_s390_vm_set_crypto()
946 kvm->arch.crypto.crycb->dea_wrapping_key_mask, in kvm_s390_vm_set_crypto()
947 sizeof(kvm->arch.crypto.crycb->dea_wrapping_key_mask)); in kvm_s390_vm_set_crypto()
948 kvm->arch.crypto.dea_kw = 1; in kvm_s390_vm_set_crypto()
956 kvm->arch.crypto.aes_kw = 0; in kvm_s390_vm_set_crypto()
957 memset(kvm->arch.crypto.crycb->aes_wrapping_key_mask, 0, in kvm_s390_vm_set_crypto()
958 sizeof(kvm->arch.crypto.crycb->aes_wrapping_key_mask)); in kvm_s390_vm_set_crypto()
966 kvm->arch.crypto.dea_kw = 0; in kvm_s390_vm_set_crypto()
967 memset(kvm->arch.crypto.crycb->dea_wrapping_key_mask, 0, in kvm_s390_vm_set_crypto()
968 sizeof(kvm->arch.crypto.crycb->dea_wrapping_key_mask)); in kvm_s390_vm_set_crypto()
976 kvm->arch.crypto.apie = 1; in kvm_s390_vm_set_crypto()
983 kvm->arch.crypto.apie = 0; in kvm_s390_vm_set_crypto()
1016 if (kvm->arch.migration_mode) in kvm_s390_vm_start_migration()
1022 if (!kvm->arch.use_cmma) { in kvm_s390_vm_start_migration()
1023 kvm->arch.migration_mode = 1; in kvm_s390_vm_start_migration()
1040 atomic64_set(&kvm->arch.cmma_dirty_pages, ram_pages); in kvm_s390_vm_start_migration()
1041 kvm->arch.migration_mode = 1; in kvm_s390_vm_start_migration()
1053 if (!kvm->arch.migration_mode) in kvm_s390_vm_stop_migration()
1055 kvm->arch.migration_mode = 0; in kvm_s390_vm_stop_migration()
1056 if (kvm->arch.use_cmma) in kvm_s390_vm_stop_migration()
1085 u64 mig = kvm->arch.migration_mode; in kvm_s390_vm_get_migration()
1173 gtod->tod = htod.tod + kvm->arch.epoch; in kvm_s390_get_tod_clock()
1176 gtod->epoch_idx = htod.epoch_idx + kvm->arch.epdx; in kvm_s390_get_tod_clock()
1264 kvm->arch.model.cpuid = proc->cpuid; in kvm_s390_set_processor()
1269 kvm->arch.model.ibc = unblocked_ibc; in kvm_s390_set_processor()
1271 kvm->arch.model.ibc = lowest_ibc; in kvm_s390_set_processor()
1273 kvm->arch.model.ibc = proc->ibc; in kvm_s390_set_processor()
1275 memcpy(kvm->arch.model.fac_list, proc->fac_list, in kvm_s390_set_processor()
1278 kvm->arch.model.ibc, in kvm_s390_set_processor()
1279 kvm->arch.model.cpuid); in kvm_s390_set_processor()
1281 kvm->arch.model.fac_list[0], in kvm_s390_set_processor()
1282 kvm->arch.model.fac_list[1], in kvm_s390_set_processor()
1283 kvm->arch.model.fac_list[2]); in kvm_s390_set_processor()
1309 bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat, in kvm_s390_set_processor_feat()
1328 if (copy_from_user(&kvm->arch.model.subfuncs, (void __user *)attr->addr, in kvm_s390_set_processor_subfunc()
1336 ((unsigned long *) &kvm->arch.model.subfuncs.plo)[0], in kvm_s390_set_processor_subfunc()
1337 ((unsigned long *) &kvm->arch.model.subfuncs.plo)[1], in kvm_s390_set_processor_subfunc()
1338 ((unsigned long *) &kvm->arch.model.subfuncs.plo)[2], in kvm_s390_set_processor_subfunc()
1339 ((unsigned long *) &kvm->arch.model.subfuncs.plo)[3]); in kvm_s390_set_processor_subfunc()
1341 ((unsigned long *) &kvm->arch.model.subfuncs.ptff)[0], in kvm_s390_set_processor_subfunc()
1342 ((unsigned long *) &kvm->arch.model.subfuncs.ptff)[1]); in kvm_s390_set_processor_subfunc()
1344 ((unsigned long *) &kvm->arch.model.subfuncs.kmac)[0], in kvm_s390_set_processor_subfunc()
1345 ((unsigned long *) &kvm->arch.model.subfuncs.kmac)[1]); in kvm_s390_set_processor_subfunc()
1347 ((unsigned long *) &kvm->arch.model.subfuncs.kmc)[0], in kvm_s390_set_processor_subfunc()
1348 ((unsigned long *) &kvm->arch.model.subfuncs.kmc)[1]); in kvm_s390_set_processor_subfunc()
1350 ((unsigned long *) &kvm->arch.model.subfuncs.km)[0], in kvm_s390_set_processor_subfunc()
1351 ((unsigned long *) &kvm->arch.model.subfuncs.km)[1]); in kvm_s390_set_processor_subfunc()
1353 ((unsigned long *) &kvm->arch.model.subfuncs.kimd)[0], in kvm_s390_set_processor_subfunc()
1354 ((unsigned long *) &kvm->arch.model.subfuncs.kimd)[1]); in kvm_s390_set_processor_subfunc()
1356 ((unsigned long *) &kvm->arch.model.subfuncs.klmd)[0], in kvm_s390_set_processor_subfunc()
1357 ((unsigned long *) &kvm->arch.model.subfuncs.klmd)[1]); in kvm_s390_set_processor_subfunc()
1359 ((unsigned long *) &kvm->arch.model.subfuncs.pckmo)[0], in kvm_s390_set_processor_subfunc()
1360 ((unsigned long *) &kvm->arch.model.subfuncs.pckmo)[1]); in kvm_s390_set_processor_subfunc()
1362 ((unsigned long *) &kvm->arch.model.subfuncs.kmctr)[0], in kvm_s390_set_processor_subfunc()
1363 ((unsigned long *) &kvm->arch.model.subfuncs.kmctr)[1]); in kvm_s390_set_processor_subfunc()
1365 ((unsigned long *) &kvm->arch.model.subfuncs.kmf)[0], in kvm_s390_set_processor_subfunc()
1366 ((unsigned long *) &kvm->arch.model.subfuncs.kmf)[1]); in kvm_s390_set_processor_subfunc()
1368 ((unsigned long *) &kvm->arch.model.subfuncs.kmo)[0], in kvm_s390_set_processor_subfunc()
1369 ((unsigned long *) &kvm->arch.model.subfuncs.kmo)[1]); in kvm_s390_set_processor_subfunc()
1371 ((unsigned long *) &kvm->arch.model.subfuncs.pcc)[0], in kvm_s390_set_processor_subfunc()
1372 ((unsigned long *) &kvm->arch.model.subfuncs.pcc)[1]); in kvm_s390_set_processor_subfunc()
1374 ((unsigned long *) &kvm->arch.model.subfuncs.ppno)[0], in kvm_s390_set_processor_subfunc()
1375 ((unsigned long *) &kvm->arch.model.subfuncs.ppno)[1]); in kvm_s390_set_processor_subfunc()
1377 ((unsigned long *) &kvm->arch.model.subfuncs.kma)[0], in kvm_s390_set_processor_subfunc()
1378 ((unsigned long *) &kvm->arch.model.subfuncs.kma)[1]); in kvm_s390_set_processor_subfunc()
1380 ((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[0], in kvm_s390_set_processor_subfunc()
1381 ((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[1]); in kvm_s390_set_processor_subfunc()
1383 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[0], in kvm_s390_set_processor_subfunc()
1384 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[1], in kvm_s390_set_processor_subfunc()
1385 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[2], in kvm_s390_set_processor_subfunc()
1386 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[3]); in kvm_s390_set_processor_subfunc()
1388 ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[0], in kvm_s390_set_processor_subfunc()
1389 ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[1], in kvm_s390_set_processor_subfunc()
1390 ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[2], in kvm_s390_set_processor_subfunc()
1391 ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[3]); in kvm_s390_set_processor_subfunc()
1424 proc->cpuid = kvm->arch.model.cpuid; in kvm_s390_get_processor()
1425 proc->ibc = kvm->arch.model.ibc; in kvm_s390_get_processor()
1426 memcpy(&proc->fac_list, kvm->arch.model.fac_list, in kvm_s390_get_processor()
1429 kvm->arch.model.ibc, in kvm_s390_get_processor()
1430 kvm->arch.model.cpuid); in kvm_s390_get_processor()
1432 kvm->arch.model.fac_list[0], in kvm_s390_get_processor()
1433 kvm->arch.model.fac_list[1], in kvm_s390_get_processor()
1434 kvm->arch.model.fac_list[2]); in kvm_s390_get_processor()
1454 memcpy(&mach->fac_mask, kvm->arch.model.fac_mask, in kvm_s390_get_machine()
1459 kvm->arch.model.ibc, in kvm_s390_get_machine()
1460 kvm->arch.model.cpuid); in kvm_s390_get_machine()
1481 bitmap_copy((unsigned long *) data.feat, kvm->arch.cpu_feat, in kvm_s390_get_processor_feat()
1512 if (copy_to_user((void __user *)attr->addr, &kvm->arch.model.subfuncs, in kvm_s390_get_processor_subfunc()
1517 ((unsigned long *) &kvm->arch.model.subfuncs.plo)[0], in kvm_s390_get_processor_subfunc()
1518 ((unsigned long *) &kvm->arch.model.subfuncs.plo)[1], in kvm_s390_get_processor_subfunc()
1519 ((unsigned long *) &kvm->arch.model.subfuncs.plo)[2], in kvm_s390_get_processor_subfunc()
1520 ((unsigned long *) &kvm->arch.model.subfuncs.plo)[3]); in kvm_s390_get_processor_subfunc()
1522 ((unsigned long *) &kvm->arch.model.subfuncs.ptff)[0], in kvm_s390_get_processor_subfunc()
1523 ((unsigned long *) &kvm->arch.model.subfuncs.ptff)[1]); in kvm_s390_get_processor_subfunc()
1525 ((unsigned long *) &kvm->arch.model.subfuncs.kmac)[0], in kvm_s390_get_processor_subfunc()
1526 ((unsigned long *) &kvm->arch.model.subfuncs.kmac)[1]); in kvm_s390_get_processor_subfunc()
1528 ((unsigned long *) &kvm->arch.model.subfuncs.kmc)[0], in kvm_s390_get_processor_subfunc()
1529 ((unsigned long *) &kvm->arch.model.subfuncs.kmc)[1]); in kvm_s390_get_processor_subfunc()
1531 ((unsigned long *) &kvm->arch.model.subfuncs.km)[0], in kvm_s390_get_processor_subfunc()
1532 ((unsigned long *) &kvm->arch.model.subfuncs.km)[1]); in kvm_s390_get_processor_subfunc()
1534 ((unsigned long *) &kvm->arch.model.subfuncs.kimd)[0], in kvm_s390_get_processor_subfunc()
1535 ((unsigned long *) &kvm->arch.model.subfuncs.kimd)[1]); in kvm_s390_get_processor_subfunc()
1537 ((unsigned long *) &kvm->arch.model.subfuncs.klmd)[0], in kvm_s390_get_processor_subfunc()
1538 ((unsigned long *) &kvm->arch.model.subfuncs.klmd)[1]); in kvm_s390_get_processor_subfunc()
1540 ((unsigned long *) &kvm->arch.model.subfuncs.pckmo)[0], in kvm_s390_get_processor_subfunc()
1541 ((unsigned long *) &kvm->arch.model.subfuncs.pckmo)[1]); in kvm_s390_get_processor_subfunc()
1543 ((unsigned long *) &kvm->arch.model.subfuncs.kmctr)[0], in kvm_s390_get_processor_subfunc()
1544 ((unsigned long *) &kvm->arch.model.subfuncs.kmctr)[1]); in kvm_s390_get_processor_subfunc()
1546 ((unsigned long *) &kvm->arch.model.subfuncs.kmf)[0], in kvm_s390_get_processor_subfunc()
1547 ((unsigned long *) &kvm->arch.model.subfuncs.kmf)[1]); in kvm_s390_get_processor_subfunc()
1549 ((unsigned long *) &kvm->arch.model.subfuncs.kmo)[0], in kvm_s390_get_processor_subfunc()
1550 ((unsigned long *) &kvm->arch.model.subfuncs.kmo)[1]); in kvm_s390_get_processor_subfunc()
1552 ((unsigned long *) &kvm->arch.model.subfuncs.pcc)[0], in kvm_s390_get_processor_subfunc()
1553 ((unsigned long *) &kvm->arch.model.subfuncs.pcc)[1]); in kvm_s390_get_processor_subfunc()
1555 ((unsigned long *) &kvm->arch.model.subfuncs.ppno)[0], in kvm_s390_get_processor_subfunc()
1556 ((unsigned long *) &kvm->arch.model.subfuncs.ppno)[1]); in kvm_s390_get_processor_subfunc()
1558 ((unsigned long *) &kvm->arch.model.subfuncs.kma)[0], in kvm_s390_get_processor_subfunc()
1559 ((unsigned long *) &kvm->arch.model.subfuncs.kma)[1]); in kvm_s390_get_processor_subfunc()
1561 ((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[0], in kvm_s390_get_processor_subfunc()
1562 ((unsigned long *) &kvm->arch.model.subfuncs.kdsa)[1]); in kvm_s390_get_processor_subfunc()
1564 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[0], in kvm_s390_get_processor_subfunc()
1565 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[1], in kvm_s390_get_processor_subfunc()
1566 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[2], in kvm_s390_get_processor_subfunc()
1567 ((unsigned long *) &kvm->arch.model.subfuncs.sortl)[3]); in kvm_s390_get_processor_subfunc()
1569 ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[0], in kvm_s390_get_processor_subfunc()
1570 ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[1], in kvm_s390_get_processor_subfunc()
1571 ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[2], in kvm_s390_get_processor_subfunc()
1572 ((unsigned long *) &kvm->arch.model.subfuncs.dfltcc)[3]); in kvm_s390_get_processor_subfunc()
2027 atomic64_dec(&kvm->arch.cmma_dirty_pages); in kvm_s390_get_cmma()
2068 if (!kvm->arch.use_cmma) in kvm_s390_get_cmma_bits()
2075 if (!peek && !kvm->arch.migration_mode) in kvm_s390_get_cmma_bits()
2084 if (!peek && !atomic64_read(&kvm->arch.cmma_dirty_pages)) { in kvm_s390_get_cmma_bits()
2102 if (kvm->arch.migration_mode) in kvm_s390_get_cmma_bits()
2103 args->remaining = atomic64_read(&kvm->arch.cmma_dirty_pages); in kvm_s390_get_cmma_bits()
2128 if (!kvm->arch.use_cmma) in kvm_s390_set_cmma_bits()
2258 set_bit(IRQ_PEND_EXT_SERVICE, &kvm->arch.float_int.masked_irqs); in kvm_s390_handle_pv()
2277 clear_bit(IRQ_PEND_EXT_SERVICE, &kvm->arch.float_int.masked_irqs); in kvm_s390_handle_pv()
2387 if (kvm->arch.use_irqchip) { in kvm_arch_vm_ioctl()
2466 kvm->arch.user_cpu_state_ctrl = 1; in kvm_arch_vm_ioctl()
2518 kvm->arch.crypto.crycbd = (__u32)(unsigned long) kvm->arch.crypto.crycb; in kvm_s390_set_crycb_format()
2521 kvm->arch.crypto.crycbd &= ~(CRYCB_FORMAT_MASK); in kvm_s390_set_crycb_format()
2528 kvm->arch.crypto.crycbd |= CRYCB_FORMAT2; in kvm_s390_set_crycb_format()
2530 kvm->arch.crypto.crycbd |= CRYCB_FORMAT1; in kvm_s390_set_crycb_format()
2536 struct kvm_s390_crypto_cb *crycb = kvm->arch.crypto.crycb; in kvm_arch_crypto_set_masks()
2541 switch (kvm->arch.crypto.crycbd & CRYCB_FORMAT_MASK) { in kvm_arch_crypto_set_masks()
2578 memset(&kvm->arch.crypto.crycb->apcb0, 0, in kvm_arch_crypto_clear_masks()
2579 sizeof(kvm->arch.crypto.crycb->apcb0)); in kvm_arch_crypto_clear_masks()
2580 memset(&kvm->arch.crypto.crycb->apcb1, 0, in kvm_arch_crypto_clear_masks()
2581 sizeof(kvm->arch.crypto.crycb->apcb1)); in kvm_arch_crypto_clear_masks()
2602 kvm->arch.crypto.crycb = &kvm->arch.sie_page2->crycb; in kvm_s390_crypto_init()
2609 kvm->arch.crypto.aes_kw = 1; in kvm_s390_crypto_init()
2610 kvm->arch.crypto.dea_kw = 1; in kvm_s390_crypto_init()
2611 get_random_bytes(kvm->arch.crypto.crycb->aes_wrapping_key_mask, in kvm_s390_crypto_init()
2612 sizeof(kvm->arch.crypto.crycb->aes_wrapping_key_mask)); in kvm_s390_crypto_init()
2613 get_random_bytes(kvm->arch.crypto.crycb->dea_wrapping_key_mask, in kvm_s390_crypto_init()
2614 sizeof(kvm->arch.crypto.crycb->dea_wrapping_key_mask)); in kvm_s390_crypto_init()
2619 if (kvm->arch.use_esca) in sca_dispose()
2620 free_pages_exact(kvm->arch.sca, sizeof(struct esca_block)); in sca_dispose()
2622 free_page((unsigned long)(kvm->arch.sca)); in sca_dispose()
2623 kvm->arch.sca = NULL; in sca_dispose()
2652 rwlock_init(&kvm->arch.sca_lock); in kvm_arch_init_vm()
2654 kvm->arch.sca = (struct bsca_block *) get_zeroed_page(alloc_flags); in kvm_arch_init_vm()
2655 if (!kvm->arch.sca) in kvm_arch_init_vm()
2661 kvm->arch.sca = (struct bsca_block *) in kvm_arch_init_vm()
2662 ((char *) kvm->arch.sca + sca_offset); in kvm_arch_init_vm()
2667 kvm->arch.dbf = debug_register(debug_name, 32, 1, 7 * sizeof(long)); in kvm_arch_init_vm()
2668 if (!kvm->arch.dbf) in kvm_arch_init_vm()
2672 kvm->arch.sie_page2 = in kvm_arch_init_vm()
2674 if (!kvm->arch.sie_page2) in kvm_arch_init_vm()
2677 kvm->arch.sie_page2->kvm = kvm; in kvm_arch_init_vm()
2678 kvm->arch.model.fac_list = kvm->arch.sie_page2->fac_list; in kvm_arch_init_vm()
2681 kvm->arch.model.fac_mask[i] = S390_lowcore.stfle_fac_list[i] & in kvm_arch_init_vm()
2684 kvm->arch.model.fac_list[i] = S390_lowcore.stfle_fac_list[i] & in kvm_arch_init_vm()
2687 kvm->arch.model.subfuncs = kvm_s390_available_subfunc; in kvm_arch_init_vm()
2690 set_kvm_facility(kvm->arch.model.fac_mask, 138); in kvm_arch_init_vm()
2691 set_kvm_facility(kvm->arch.model.fac_list, 138); in kvm_arch_init_vm()
2693 set_kvm_facility(kvm->arch.model.fac_mask, 74); in kvm_arch_init_vm()
2694 set_kvm_facility(kvm->arch.model.fac_list, 74); in kvm_arch_init_vm()
2696 set_kvm_facility(kvm->arch.model.fac_mask, 147); in kvm_arch_init_vm()
2697 set_kvm_facility(kvm->arch.model.fac_list, 147); in kvm_arch_init_vm()
2701 set_kvm_facility(kvm->arch.model.fac_mask, 65); in kvm_arch_init_vm()
2703 kvm->arch.model.cpuid = kvm_s390_get_initial_cpuid(); in kvm_arch_init_vm()
2704 kvm->arch.model.ibc = sclp.ibc & 0x0fff; in kvm_arch_init_vm()
2708 mutex_init(&kvm->arch.float_int.ais_lock); in kvm_arch_init_vm()
2709 spin_lock_init(&kvm->arch.float_int.lock); in kvm_arch_init_vm()
2711 INIT_LIST_HEAD(&kvm->arch.float_int.lists[i]); in kvm_arch_init_vm()
2712 init_waitqueue_head(&kvm->arch.ipte_wq); in kvm_arch_init_vm()
2713 mutex_init(&kvm->arch.ipte_mutex); in kvm_arch_init_vm()
2715 debug_register_view(kvm->arch.dbf, &debug_sprintf_view); in kvm_arch_init_vm()
2719 kvm->arch.gmap = NULL; in kvm_arch_init_vm()
2720 kvm->arch.mem_limit = KVM_S390_NO_MEM_LIMIT; in kvm_arch_init_vm()
2723 kvm->arch.mem_limit = TASK_SIZE_MAX; in kvm_arch_init_vm()
2725 kvm->arch.mem_limit = min_t(unsigned long, TASK_SIZE_MAX, in kvm_arch_init_vm()
2727 kvm->arch.gmap = gmap_create(current->mm, kvm->arch.mem_limit - 1); in kvm_arch_init_vm()
2728 if (!kvm->arch.gmap) in kvm_arch_init_vm()
2730 kvm->arch.gmap->private = kvm; in kvm_arch_init_vm()
2731 kvm->arch.gmap->pfault_enabled = 0; in kvm_arch_init_vm()
2734 kvm->arch.use_pfmfi = sclp.has_pfmfi; in kvm_arch_init_vm()
2735 kvm->arch.use_skf = sclp.has_skey; in kvm_arch_init_vm()
2736 spin_lock_init(&kvm->arch.start_stop_lock); in kvm_arch_init_vm()
2744 free_page((unsigned long)kvm->arch.sie_page2); in kvm_arch_init_vm()
2745 debug_unregister(kvm->arch.dbf); in kvm_arch_init_vm()
2763 gmap_remove(vcpu->arch.gmap); in kvm_arch_vcpu_destroy()
2765 if (vcpu->kvm->arch.use_cmma) in kvm_arch_vcpu_destroy()
2770 free_page((unsigned long)(vcpu->arch.sie_block)); in kvm_arch_vcpu_destroy()
2804 debug_unregister(kvm->arch.dbf); in kvm_arch_destroy_vm()
2805 free_page((unsigned long)kvm->arch.sie_page2); in kvm_arch_destroy_vm()
2807 gmap_remove(kvm->arch.gmap); in kvm_arch_destroy_vm()
2817 vcpu->arch.gmap = gmap_create(current->mm, -1UL); in __kvm_ucontrol_vcpu_init()
2818 if (!vcpu->arch.gmap) in __kvm_ucontrol_vcpu_init()
2820 vcpu->arch.gmap->private = vcpu->kvm; in __kvm_ucontrol_vcpu_init()
2829 read_lock(&vcpu->kvm->arch.sca_lock); in sca_del_vcpu()
2830 if (vcpu->kvm->arch.use_esca) { in sca_del_vcpu()
2831 struct esca_block *sca = vcpu->kvm->arch.sca; in sca_del_vcpu()
2836 struct bsca_block *sca = vcpu->kvm->arch.sca; in sca_del_vcpu()
2841 read_unlock(&vcpu->kvm->arch.sca_lock); in sca_del_vcpu()
2847 struct bsca_block *sca = vcpu->kvm->arch.sca; in sca_add_vcpu()
2850 vcpu->arch.sie_block->scaoh = (__u32)(((__u64)sca) >> 32); in sca_add_vcpu()
2851 vcpu->arch.sie_block->scaol = (__u32)(__u64)sca; in sca_add_vcpu()
2854 read_lock(&vcpu->kvm->arch.sca_lock); in sca_add_vcpu()
2855 if (vcpu->kvm->arch.use_esca) { in sca_add_vcpu()
2856 struct esca_block *sca = vcpu->kvm->arch.sca; in sca_add_vcpu()
2858 sca->cpu[vcpu->vcpu_id].sda = (__u64) vcpu->arch.sie_block; in sca_add_vcpu()
2859 vcpu->arch.sie_block->scaoh = (__u32)(((__u64)sca) >> 32); in sca_add_vcpu()
2860 vcpu->arch.sie_block->scaol = (__u32)(__u64)sca & ~0x3fU; in sca_add_vcpu()
2861 vcpu->arch.sie_block->ecb2 |= ECB2_ESCA; in sca_add_vcpu()
2864 struct bsca_block *sca = vcpu->kvm->arch.sca; in sca_add_vcpu()
2866 sca->cpu[vcpu->vcpu_id].sda = (__u64) vcpu->arch.sie_block; in sca_add_vcpu()
2867 vcpu->arch.sie_block->scaoh = (__u32)(((__u64)sca) >> 32); in sca_add_vcpu()
2868 vcpu->arch.sie_block->scaol = (__u32)(__u64)sca; in sca_add_vcpu()
2871 read_unlock(&vcpu->kvm->arch.sca_lock); in sca_add_vcpu()
2894 struct bsca_block *old_sca = kvm->arch.sca; in sca_switch_to_extended()
2900 if (kvm->arch.use_esca) in sca_switch_to_extended()
2911 write_lock(&kvm->arch.sca_lock); in sca_switch_to_extended()
2916 vcpu->arch.sie_block->scaoh = scaoh; in sca_switch_to_extended()
2917 vcpu->arch.sie_block->scaol = scaol; in sca_switch_to_extended()
2918 vcpu->arch.sie_block->ecb2 |= ECB2_ESCA; in sca_switch_to_extended()
2920 kvm->arch.sca = new_sca; in sca_switch_to_extended()
2921 kvm->arch.use_esca = 1; in sca_switch_to_extended()
2923 write_unlock(&kvm->arch.sca_lock); in sca_switch_to_extended()
2929 old_sca, kvm->arch.sca); in sca_switch_to_extended()
2948 rc = kvm->arch.use_esca ? 0 : sca_switch_to_extended(kvm); in sca_can_add_vcpu()
2957 WARN_ON_ONCE(vcpu->arch.cputm_start != 0); in __start_cpu_timer_accounting()
2958 raw_write_seqcount_begin(&vcpu->arch.cputm_seqcount); in __start_cpu_timer_accounting()
2959 vcpu->arch.cputm_start = get_tod_clock_fast(); in __start_cpu_timer_accounting()
2960 raw_write_seqcount_end(&vcpu->arch.cputm_seqcount); in __start_cpu_timer_accounting()
2966 WARN_ON_ONCE(vcpu->arch.cputm_start == 0); in __stop_cpu_timer_accounting()
2967 raw_write_seqcount_begin(&vcpu->arch.cputm_seqcount); in __stop_cpu_timer_accounting()
2968 vcpu->arch.sie_block->cputm -= get_tod_clock_fast() - vcpu->arch.cputm_start; in __stop_cpu_timer_accounting()
2969 vcpu->arch.cputm_start = 0; in __stop_cpu_timer_accounting()
2970 raw_write_seqcount_end(&vcpu->arch.cputm_seqcount); in __stop_cpu_timer_accounting()
2976 WARN_ON_ONCE(vcpu->arch.cputm_enabled); in __enable_cpu_timer_accounting()
2977 vcpu->arch.cputm_enabled = true; in __enable_cpu_timer_accounting()
2984 WARN_ON_ONCE(!vcpu->arch.cputm_enabled); in __disable_cpu_timer_accounting()
2986 vcpu->arch.cputm_enabled = false; in __disable_cpu_timer_accounting()
3007 raw_write_seqcount_begin(&vcpu->arch.cputm_seqcount); in kvm_s390_set_cpu_timer()
3008 if (vcpu->arch.cputm_enabled) in kvm_s390_set_cpu_timer()
3009 vcpu->arch.cputm_start = get_tod_clock_fast(); in kvm_s390_set_cpu_timer()
3010 vcpu->arch.sie_block->cputm = cputm; in kvm_s390_set_cpu_timer()
3011 raw_write_seqcount_end(&vcpu->arch.cputm_seqcount); in kvm_s390_set_cpu_timer()
3021 if (unlikely(!vcpu->arch.cputm_enabled)) in kvm_s390_get_cpu_timer()
3022 return vcpu->arch.sie_block->cputm; in kvm_s390_get_cpu_timer()
3026 seq = raw_read_seqcount(&vcpu->arch.cputm_seqcount); in kvm_s390_get_cpu_timer()
3032 value = vcpu->arch.sie_block->cputm; in kvm_s390_get_cpu_timer()
3034 if (likely(vcpu->arch.cputm_start)) in kvm_s390_get_cpu_timer()
3035 value -= get_tod_clock_fast() - vcpu->arch.cputm_start; in kvm_s390_get_cpu_timer()
3036 } while (read_seqcount_retry(&vcpu->arch.cputm_seqcount, seq & ~1)); in kvm_s390_get_cpu_timer()
3044 gmap_enable(vcpu->arch.enabled_gmap); in kvm_arch_vcpu_load()
3046 if (vcpu->arch.cputm_enabled && !is_vcpu_idle(vcpu)) in kvm_arch_vcpu_load()
3054 if (vcpu->arch.cputm_enabled && !is_vcpu_idle(vcpu)) in kvm_arch_vcpu_put()
3057 vcpu->arch.enabled_gmap = gmap_get_enabled(); in kvm_arch_vcpu_put()
3058 gmap_disable(vcpu->arch.enabled_gmap); in kvm_arch_vcpu_put()
3066 vcpu->arch.sie_block->epoch = vcpu->kvm->arch.epoch; in kvm_arch_vcpu_postcreate()
3067 vcpu->arch.sie_block->epdx = vcpu->kvm->arch.epdx; in kvm_arch_vcpu_postcreate()
3071 vcpu->arch.gmap = vcpu->kvm->arch.gmap; in kvm_arch_vcpu_postcreate()
3074 if (test_kvm_facility(vcpu->kvm, 74) || vcpu->kvm->arch.user_instr0) in kvm_arch_vcpu_postcreate()
3075 vcpu->arch.sie_block->ictl |= ICTL_OPEREXC; in kvm_arch_vcpu_postcreate()
3077 vcpu->arch.enabled_gmap = vcpu->arch.gmap; in kvm_arch_vcpu_postcreate()
3082 if (test_bit_inv(nr, (unsigned long *)&kvm->arch.model.subfuncs.pckmo) && in kvm_has_pckmo_subfunc()
3105 if (!vcpu->kvm->arch.crypto.apie && !test_kvm_facility(vcpu->kvm, 76)) in kvm_s390_vcpu_crypto_setup()
3108 vcpu->arch.sie_block->crycbd = vcpu->kvm->arch.crypto.crycbd; in kvm_s390_vcpu_crypto_setup()
3109 vcpu->arch.sie_block->ecb3 &= ~(ECB3_AES | ECB3_DEA); in kvm_s390_vcpu_crypto_setup()
3110 vcpu->arch.sie_block->eca &= ~ECA_APIE; in kvm_s390_vcpu_crypto_setup()
3111 vcpu->arch.sie_block->ecd &= ~ECD_ECC; in kvm_s390_vcpu_crypto_setup()
3113 if (vcpu->kvm->arch.crypto.apie) in kvm_s390_vcpu_crypto_setup()
3114 vcpu->arch.sie_block->eca |= ECA_APIE; in kvm_s390_vcpu_crypto_setup()
3117 if (vcpu->kvm->arch.crypto.aes_kw) { in kvm_s390_vcpu_crypto_setup()
3118 vcpu->arch.sie_block->ecb3 |= ECB3_AES; in kvm_s390_vcpu_crypto_setup()
3121 vcpu->arch.sie_block->ecd |= ECD_ECC; in kvm_s390_vcpu_crypto_setup()
3124 if (vcpu->kvm->arch.crypto.dea_kw) in kvm_s390_vcpu_crypto_setup()
3125 vcpu->arch.sie_block->ecb3 |= ECB3_DEA; in kvm_s390_vcpu_crypto_setup()
3130 free_page(vcpu->arch.sie_block->cbrlo); in kvm_s390_vcpu_unsetup_cmma()
3131 vcpu->arch.sie_block->cbrlo = 0; in kvm_s390_vcpu_unsetup_cmma()
3136 vcpu->arch.sie_block->cbrlo = get_zeroed_page(GFP_KERNEL); in kvm_s390_vcpu_setup_cmma()
3137 if (!vcpu->arch.sie_block->cbrlo) in kvm_s390_vcpu_setup_cmma()
3144 struct kvm_s390_cpu_model *model = &vcpu->kvm->arch.model; in kvm_s390_vcpu_setup_model()
3146 vcpu->arch.sie_block->ibc = model->ibc; in kvm_s390_vcpu_setup_model()
3148 vcpu->arch.sie_block->fac = (u32)(u64) model->fac_list; in kvm_s390_vcpu_setup_model()
3156 atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH | in kvm_s390_vcpu_setup()
3169 vcpu->arch.sie_block->ecb |= ECB_HOSTPROTINT; in kvm_s390_vcpu_setup()
3171 vcpu->arch.sie_block->ecb |= ECB_SRSI; in kvm_s390_vcpu_setup()
3173 vcpu->arch.sie_block->ecb |= ECB_TE; in kvm_s390_vcpu_setup()
3175 if (test_kvm_facility(vcpu->kvm, 8) && vcpu->kvm->arch.use_pfmfi) in kvm_s390_vcpu_setup()
3176 vcpu->arch.sie_block->ecb2 |= ECB2_PFMFI; in kvm_s390_vcpu_setup()
3178 vcpu->arch.sie_block->ecb2 |= ECB2_IEP; in kvm_s390_vcpu_setup()
3179 vcpu->arch.sie_block->eca = ECA_MVPGI | ECA_PROTEXCI; in kvm_s390_vcpu_setup()
3181 vcpu->arch.sie_block->eca |= ECA_CEI; in kvm_s390_vcpu_setup()
3183 vcpu->arch.sie_block->eca |= ECA_IB; in kvm_s390_vcpu_setup()
3185 vcpu->arch.sie_block->eca |= ECA_SII; in kvm_s390_vcpu_setup()
3187 vcpu->arch.sie_block->eca |= ECA_SIGPI; in kvm_s390_vcpu_setup()
3189 vcpu->arch.sie_block->eca |= ECA_VX; in kvm_s390_vcpu_setup()
3190 vcpu->arch.sie_block->ecd |= ECD_HOSTREGMGMT; in kvm_s390_vcpu_setup()
3193 vcpu->arch.sie_block->ecd |= ECD_MEF; in kvm_s390_vcpu_setup()
3195 vcpu->arch.sie_block->ecd |= ECD_ETOKENF; in kvm_s390_vcpu_setup()
3196 if (vcpu->arch.sie_block->gd) { in kvm_s390_vcpu_setup()
3197 vcpu->arch.sie_block->eca |= ECA_AIV; in kvm_s390_vcpu_setup()
3199 vcpu->arch.sie_block->gd & 0x3, vcpu->vcpu_id); in kvm_s390_vcpu_setup()
3201 vcpu->arch.sie_block->sdnxo = ((unsigned long) &vcpu->run->s.regs.sdnx) in kvm_s390_vcpu_setup()
3203 vcpu->arch.sie_block->riccbd = (unsigned long) &vcpu->run->s.regs.riccb; in kvm_s390_vcpu_setup()
3208 vcpu->arch.sie_block->ictl |= ICTL_ISKE | ICTL_SSKE | ICTL_RRBE; in kvm_s390_vcpu_setup()
3210 if (vcpu->kvm->arch.use_cmma) { in kvm_s390_vcpu_setup()
3215 hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in kvm_s390_vcpu_setup()
3216 vcpu->arch.ckc_timer.function = kvm_s390_idle_wakeup; in kvm_s390_vcpu_setup()
3218 vcpu->arch.sie_block->hpid = HPID_KVM; in kvm_s390_vcpu_setup()
3250 vcpu->arch.sie_block = &sie_page->sie_block; in kvm_arch_vcpu_create()
3251 vcpu->arch.sie_block->itdba = (unsigned long) &sie_page->itdb; in kvm_arch_vcpu_create()
3254 vcpu->arch.sie_block->mso = 0; in kvm_arch_vcpu_create()
3255 vcpu->arch.sie_block->msl = sclp.hamax; in kvm_arch_vcpu_create()
3257 vcpu->arch.sie_block->icpua = vcpu->vcpu_id; in kvm_arch_vcpu_create()
3258 spin_lock_init(&vcpu->arch.local_int.lock); in kvm_arch_vcpu_create()
3259 vcpu->arch.sie_block->gd = (u32)(u64)vcpu->kvm->arch.gisa_int.origin; in kvm_arch_vcpu_create()
3260 if (vcpu->arch.sie_block->gd && sclp.has_gisaf) in kvm_arch_vcpu_create()
3261 vcpu->arch.sie_block->gd |= GISA_FORMAT1; in kvm_arch_vcpu_create()
3262 seqcount_init(&vcpu->arch.cputm_seqcount); in kvm_arch_vcpu_create()
3264 vcpu->arch.pfault_token = KVM_S390_PFAULT_TOKEN_INVALID; in kvm_arch_vcpu_create()
3297 vcpu->vcpu_id, vcpu, vcpu->arch.sie_block); in kvm_arch_vcpu_create()
3298 trace_kvm_s390_create_vcpu(vcpu->vcpu_id, vcpu, vcpu->arch.sie_block); in kvm_arch_vcpu_create()
3307 gmap_remove(vcpu->arch.gmap); in kvm_arch_vcpu_create()
3309 free_page((unsigned long)(vcpu->arch.sie_block)); in kvm_arch_vcpu_create()
3315 clear_bit(vcpu->vcpu_idx, vcpu->kvm->arch.gisa_int.kicked_mask); in kvm_arch_vcpu_runnable()
3321 return !(vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE); in kvm_arch_vcpu_in_kernel()
3326 atomic_or(PROG_BLOCK_SIE, &vcpu->arch.sie_block->prog20); in kvm_s390_vcpu_block()
3332 atomic_andnot(PROG_BLOCK_SIE, &vcpu->arch.sie_block->prog20); in kvm_s390_vcpu_unblock()
3337 atomic_or(PROG_REQUEST, &vcpu->arch.sie_block->prog20); in kvm_s390_vcpu_request()
3343 return atomic_read(&vcpu->arch.sie_block->prog20) & in kvm_s390_vcpu_sie_inhibited()
3349 atomic_andnot(PROG_REQUEST, &vcpu->arch.sie_block->prog20); in kvm_s390_vcpu_request_handled()
3360 while (vcpu->arch.sie_block->prog0c & PROG_IN_SIE) in exit_sie()
3420 r = put_user(vcpu->arch.sie_block->todpr, in kvm_arch_vcpu_ioctl_get_one_reg()
3424 r = put_user(vcpu->arch.sie_block->epoch, in kvm_arch_vcpu_ioctl_get_one_reg()
3432 r = put_user(vcpu->arch.sie_block->ckc, in kvm_arch_vcpu_ioctl_get_one_reg()
3436 r = put_user(vcpu->arch.pfault_token, in kvm_arch_vcpu_ioctl_get_one_reg()
3440 r = put_user(vcpu->arch.pfault_compare, in kvm_arch_vcpu_ioctl_get_one_reg()
3444 r = put_user(vcpu->arch.pfault_select, in kvm_arch_vcpu_ioctl_get_one_reg()
3448 r = put_user(vcpu->arch.sie_block->pp, in kvm_arch_vcpu_ioctl_get_one_reg()
3452 r = put_user(vcpu->arch.sie_block->gbea, in kvm_arch_vcpu_ioctl_get_one_reg()
3470 r = get_user(vcpu->arch.sie_block->todpr, in kvm_arch_vcpu_ioctl_set_one_reg()
3474 r = get_user(vcpu->arch.sie_block->epoch, in kvm_arch_vcpu_ioctl_set_one_reg()
3483 r = get_user(vcpu->arch.sie_block->ckc, in kvm_arch_vcpu_ioctl_set_one_reg()
3487 r = get_user(vcpu->arch.pfault_token, in kvm_arch_vcpu_ioctl_set_one_reg()
3489 if (vcpu->arch.pfault_token == KVM_S390_PFAULT_TOKEN_INVALID) in kvm_arch_vcpu_ioctl_set_one_reg()
3493 r = get_user(vcpu->arch.pfault_compare, in kvm_arch_vcpu_ioctl_set_one_reg()
3497 r = get_user(vcpu->arch.pfault_select, in kvm_arch_vcpu_ioctl_set_one_reg()
3501 r = get_user(vcpu->arch.sie_block->pp, in kvm_arch_vcpu_ioctl_set_one_reg()
3505 r = get_user(vcpu->arch.sie_block->gbea, in kvm_arch_vcpu_ioctl_set_one_reg()
3517 vcpu->arch.sie_block->gpsw.mask &= ~PSW_MASK_RI; in kvm_arch_vcpu_ioctl_normal_reset()
3518 vcpu->arch.pfault_token = KVM_S390_PFAULT_TOKEN_INVALID; in kvm_arch_vcpu_ioctl_normal_reset()
3536 vcpu->arch.sie_block->gpsw.mask = 0; in kvm_arch_vcpu_ioctl_initial_reset()
3537 vcpu->arch.sie_block->gpsw.addr = 0; in kvm_arch_vcpu_ioctl_initial_reset()
3540 vcpu->arch.sie_block->ckc = 0; in kvm_arch_vcpu_ioctl_initial_reset()
3541 memset(vcpu->arch.sie_block->gcr, 0, sizeof(vcpu->arch.sie_block->gcr)); in kvm_arch_vcpu_ioctl_initial_reset()
3542 vcpu->arch.sie_block->gcr[0] = CR0_INITIAL_MASK; in kvm_arch_vcpu_ioctl_initial_reset()
3543 vcpu->arch.sie_block->gcr[14] = CR14_INITIAL_MASK; in kvm_arch_vcpu_ioctl_initial_reset()
3564 vcpu->arch.sie_block->gbea = 1; in kvm_arch_vcpu_ioctl_initial_reset()
3565 vcpu->arch.sie_block->pp = 0; in kvm_arch_vcpu_ioctl_initial_reset()
3566 vcpu->arch.sie_block->fpf &= ~FPF_BPBC; in kvm_arch_vcpu_ioctl_initial_reset()
3567 vcpu->arch.sie_block->todpr = 0; in kvm_arch_vcpu_ioctl_initial_reset()
3609 memcpy(&vcpu->arch.sie_block->gcr, &sregs->crs, sizeof(sregs->crs)); in kvm_arch_vcpu_ioctl_set_sregs()
3621 memcpy(&sregs->crs, &vcpu->arch.sie_block->gcr, sizeof(sregs->crs)); in kvm_arch_vcpu_ioctl_get_sregs()
3717 vcpu->arch.guestdbg.last_bp = 0; in kvm_arch_vcpu_ioctl_set_guest_debug()
3754 vcpu->kvm->arch.user_cpu_state_ctrl = 1; in kvm_arch_vcpu_ioctl_set_mpstate()
3800 rc = gmap_mprotect_notify(vcpu->arch.gmap, in kvm_s390_handle_requests()
3811 vcpu->arch.sie_block->ihcpu = 0xffff; in kvm_s390_handle_requests()
3832 vcpu->arch.sie_block->ictl |= ICTL_OPEREXC; in kvm_s390_handle_requests()
3842 vcpu->arch.sie_block->ecb2 &= ~ECB2_CMMA; in kvm_s390_handle_requests()
3851 if ((vcpu->kvm->arch.use_cmma) && in kvm_s390_handle_requests()
3853 vcpu->arch.sie_block->ecb2 |= ECB2_CMMA; in kvm_s390_handle_requests()
3877 kvm->arch.epoch = gtod->tod - htod.tod; in kvm_s390_set_tod_clock()
3878 kvm->arch.epdx = 0; in kvm_s390_set_tod_clock()
3880 kvm->arch.epdx = gtod->epoch_idx - htod.epoch_idx; in kvm_s390_set_tod_clock()
3881 if (kvm->arch.epoch > gtod->tod) in kvm_s390_set_tod_clock()
3882 kvm->arch.epdx -= 1; in kvm_s390_set_tod_clock()
3887 vcpu->arch.sie_block->epoch = kvm->arch.epoch; in kvm_s390_set_tod_clock()
3888 vcpu->arch.sie_block->epdx = kvm->arch.epdx; in kvm_s390_set_tod_clock()
3908 return gmap_fault(vcpu->arch.gmap, gpa, in kvm_arch_fault_in_page()
3932 trace_kvm_s390_pfault_init(vcpu, work->arch.pfault_token); in kvm_arch_async_page_not_present()
3933 __kvm_inject_pfault_token(vcpu, true, work->arch.pfault_token); in kvm_arch_async_page_not_present()
3941 trace_kvm_s390_pfault_done(vcpu, work->arch.pfault_token); in kvm_arch_async_page_present()
3942 __kvm_inject_pfault_token(vcpu, false, work->arch.pfault_token); in kvm_arch_async_page_present()
3963 struct kvm_arch_async_pf arch; in kvm_arch_setup_async_pf() local
3965 if (vcpu->arch.pfault_token == KVM_S390_PFAULT_TOKEN_INVALID) in kvm_arch_setup_async_pf()
3967 if ((vcpu->arch.sie_block->gpsw.mask & vcpu->arch.pfault_select) != in kvm_arch_setup_async_pf()
3968 vcpu->arch.pfault_compare) in kvm_arch_setup_async_pf()
3974 if (!(vcpu->arch.sie_block->gcr[0] & CR0_SERVICE_SIGNAL_SUBMASK)) in kvm_arch_setup_async_pf()
3976 if (!vcpu->arch.gmap->pfault_enabled) in kvm_arch_setup_async_pf()
3981 if (read_guest_real(vcpu, vcpu->arch.pfault_token, &arch.pfault_token, 8)) in kvm_arch_setup_async_pf()
3984 return kvm_setup_async_pf(vcpu, current->thread.gmap_addr, hva, &arch); in kvm_arch_setup_async_pf()
3998 vcpu->arch.sie_block->gg14 = vcpu->run->s.regs.gprs[14]; in vcpu_pre_run()
3999 vcpu->arch.sie_block->gg15 = vcpu->run->s.regs.gprs[15]; in vcpu_pre_run()
4019 clear_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.gisa_int.kicked_mask); in vcpu_pre_run()
4021 vcpu->arch.sie_block->icptcode = 0; in vcpu_pre_run()
4022 cpuflags = atomic_read(&vcpu->arch.sie_block->cpuflags); in vcpu_pre_run()
4048 rc = read_guest_instr(vcpu, vcpu->arch.sie_block->gpsw.addr, &opcode, 1); in vcpu_post_run_fault_in_sie()
4057 pgm_info = vcpu->arch.pgm; in vcpu_post_run_fault_in_sie()
4071 vcpu->arch.sie_block->icptcode); in vcpu_post_run()
4072 trace_kvm_s390_sie_exit(vcpu, vcpu->arch.sie_block->icptcode); in vcpu_post_run()
4077 vcpu->run->s.regs.gprs[14] = vcpu->arch.sie_block->gg14; in vcpu_post_run()
4078 vcpu->run->s.regs.gprs[15] = vcpu->arch.sie_block->gg15; in vcpu_post_run()
4082 sie_page = container_of(vcpu->arch.sie_block, in vcpu_post_run()
4089 if (vcpu->arch.sie_block->icptcode > 0) { in vcpu_post_run()
4095 vcpu->run->s390_sieic.icptcode = vcpu->arch.sie_block->icptcode; in vcpu_post_run()
4096 vcpu->run->s390_sieic.ipa = vcpu->arch.sie_block->ipa; in vcpu_post_run()
4097 vcpu->run->s390_sieic.ipb = vcpu->arch.sie_block->ipb; in vcpu_post_run()
4122 struct sie_page *sie_page = (struct sie_page *)vcpu->arch.sie_block; in __vcpu_run()
4149 exit_reason = sie64a(vcpu->arch.sie_block, in __vcpu_run()
4161 if (vcpu->arch.sie_block->icptcode == ICPT_PV_INSTR || in __vcpu_run()
4162 vcpu->arch.sie_block->icptcode == ICPT_PV_PREF) { in __vcpu_run()
4163 vcpu->arch.sie_block->gpsw.mask &= ~PSW_INT_MASK; in __vcpu_run()
4187 vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask; in sync_regs_fmt2()
4188 vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr; in sync_regs_fmt2()
4190 vcpu->arch.sie_block->todpr = kvm_run->s.regs.todpr; in sync_regs_fmt2()
4191 vcpu->arch.sie_block->pp = kvm_run->s.regs.pp; in sync_regs_fmt2()
4192 vcpu->arch.sie_block->gbea = kvm_run->s.regs.gbea; in sync_regs_fmt2()
4195 vcpu->arch.pfault_token = kvm_run->s.regs.pft; in sync_regs_fmt2()
4196 vcpu->arch.pfault_select = kvm_run->s.regs.pfs; in sync_regs_fmt2()
4197 vcpu->arch.pfault_compare = kvm_run->s.regs.pfc; in sync_regs_fmt2()
4198 if (vcpu->arch.pfault_token == KVM_S390_PFAULT_TOKEN_INVALID) in sync_regs_fmt2()
4202 vcpu->arch.diag318_info.val = kvm_run->s.regs.diag318; in sync_regs_fmt2()
4203 vcpu->arch.sie_block->cpnc = vcpu->arch.diag318_info.cpnc; in sync_regs_fmt2()
4212 !(vcpu->arch.sie_block->ecb3 & ECB3_RI)) { in sync_regs_fmt2()
4214 vcpu->arch.sie_block->ecb3 |= ECB3_RI; in sync_regs_fmt2()
4223 !vcpu->arch.gs_enabled) { in sync_regs_fmt2()
4225 vcpu->arch.sie_block->ecb |= ECB_GS; in sync_regs_fmt2()
4226 vcpu->arch.sie_block->ecd |= ECD_HOSTREGMGMT; in sync_regs_fmt2()
4227 vcpu->arch.gs_enabled = 1; in sync_regs_fmt2()
4231 vcpu->arch.sie_block->fpf &= ~FPF_BPBC; in sync_regs_fmt2()
4232 vcpu->arch.sie_block->fpf |= kvm_run->s.regs.bpbc ? FPF_BPBC : 0; in sync_regs_fmt2()
4238 vcpu->arch.host_gscb = current->thread.gs_cb; in sync_regs_fmt2()
4239 save_gs_cb(vcpu->arch.host_gscb); in sync_regs_fmt2()
4241 if (vcpu->arch.gs_enabled) { in sync_regs_fmt2()
4258 memcpy(&vcpu->arch.sie_block->gcr, &kvm_run->s.regs.crs, 128); in sync_regs()
4264 vcpu->arch.sie_block->ckc = kvm_run->s.regs.ckc; in sync_regs()
4266 save_access_regs(vcpu->arch.host_acrs); in sync_regs()
4270 vcpu->arch.host_fpregs.fpc = current->thread.fpu.fpc; in sync_regs()
4271 vcpu->arch.host_fpregs.regs = current->thread.fpu.regs; in sync_regs()
4294 vcpu->arch.sie_block->gpsw.mask &= ~PSW_MASK_CC; in sync_regs()
4295 vcpu->arch.sie_block->gpsw.mask |= kvm_run->psw_mask & in sync_regs()
4306 kvm_run->s.regs.todpr = vcpu->arch.sie_block->todpr; in store_regs_fmt2()
4307 kvm_run->s.regs.pp = vcpu->arch.sie_block->pp; in store_regs_fmt2()
4308 kvm_run->s.regs.gbea = vcpu->arch.sie_block->gbea; in store_regs_fmt2()
4309 kvm_run->s.regs.bpbc = (vcpu->arch.sie_block->fpf & FPF_BPBC) == FPF_BPBC; in store_regs_fmt2()
4310 kvm_run->s.regs.diag318 = vcpu->arch.diag318_info.val; in store_regs_fmt2()
4314 if (vcpu->arch.gs_enabled) in store_regs_fmt2()
4316 current->thread.gs_cb = vcpu->arch.host_gscb; in store_regs_fmt2()
4317 restore_gs_cb(vcpu->arch.host_gscb); in store_regs_fmt2()
4318 if (!vcpu->arch.host_gscb) in store_regs_fmt2()
4320 vcpu->arch.host_gscb = NULL; in store_regs_fmt2()
4330 kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask; in store_regs()
4331 kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr; in store_regs()
4333 memcpy(&kvm_run->s.regs.crs, &vcpu->arch.sie_block->gcr, 128); in store_regs()
4335 kvm_run->s.regs.ckc = vcpu->arch.sie_block->ckc; in store_regs()
4336 kvm_run->s.regs.pft = vcpu->arch.pfault_token; in store_regs()
4337 kvm_run->s.regs.pfs = vcpu->arch.pfault_select; in store_regs()
4338 kvm_run->s.regs.pfc = vcpu->arch.pfault_compare; in store_regs()
4340 restore_access_regs(vcpu->arch.host_acrs); in store_regs()
4345 current->thread.fpu.fpc = vcpu->arch.host_fpregs.fpc; in store_regs()
4346 current->thread.fpu.regs = vcpu->arch.host_fpregs.regs; in store_regs()
4456 &vcpu->arch.sie_block->gpsw, 16); in kvm_s390_store_status_unloaded()
4462 &vcpu->arch.sie_block->todpr, 4); in kvm_s390_store_status_unloaded()
4466 clkcomp = vcpu->arch.sie_block->ckc >> 8; in kvm_s390_store_status_unloaded()
4472 &vcpu->arch.sie_block->gcr, 128); in kvm_s390_store_status_unloaded()
4523 spin_lock(&vcpu->kvm->arch.start_stop_lock); in kvm_s390_vcpu_start()
4530 spin_unlock(&vcpu->kvm->arch.start_stop_lock); in kvm_s390_vcpu_start()
4559 vcpu->arch.sie_block->gpsw.mask &= ~PSW_INT_MASK; in kvm_s390_vcpu_start()
4565 spin_unlock(&vcpu->kvm->arch.start_stop_lock); in kvm_s390_vcpu_start()
4579 spin_lock(&vcpu->kvm->arch.start_stop_lock); in kvm_s390_vcpu_stop()
4586 spin_unlock(&vcpu->kvm->arch.start_stop_lock); in kvm_s390_vcpu_stop()
4617 spin_unlock(&vcpu->kvm->arch.start_stop_lock); in kvm_s390_vcpu_stop()
4631 if (!vcpu->kvm->arch.css_support) { in kvm_vcpu_ioctl_enable_cap()
4632 vcpu->kvm->arch.css_support = 1; in kvm_vcpu_ioctl_enable_cap()
4655 if (mop->size + mop->sida_offset > sida_size(vcpu->arch.sie_block)) in kvm_s390_guest_sida_op()
4662 if (copy_to_user(uaddr, (void *)(sida_origin(vcpu->arch.sie_block) + in kvm_s390_guest_sida_op()
4668 if (copy_from_user((void *)(sida_origin(vcpu->arch.sie_block) + in kvm_s390_guest_sida_op()
4727 kvm_s390_inject_prog_irq(vcpu, &vcpu->arch.pgm); in kvm_s390_guest_mem_op()
4872 r = gmap_map_segment(vcpu->arch.gmap, ucasmap.user_addr, in kvm_arch_vcpu_ioctl()
4889 r = gmap_unmap_segment(vcpu->arch.gmap, ucasmap.vcpu_addr, in kvm_arch_vcpu_ioctl()
4895 r = gmap_fault(vcpu->arch.gmap, arg, 0); in kvm_arch_vcpu_ioctl()
4963 vmf->page = virt_to_page(vcpu->arch.sie_block); in kvm_arch_vcpu_fault()
4988 if (mem->guest_phys_addr + mem->memory_size > kvm->arch.mem_limit) in kvm_arch_prepare_memory_region()
5007 rc = gmap_unmap_segment(kvm->arch.gmap, old->base_gfn * PAGE_SIZE, in kvm_arch_commit_memory_region()
5011 rc = gmap_unmap_segment(kvm->arch.gmap, old->base_gfn * PAGE_SIZE, in kvm_arch_commit_memory_region()
5017 rc = gmap_map_segment(kvm->arch.gmap, mem->userspace_addr, in kvm_arch_commit_memory_region()