kvm-s390.c (9134d02bc0af4a8747d448d1f811ec5f8eb96df6) kvm-s390.c (9ace903d171db7dc2fed96e44ac62b6f4c3ccb3d)
1/*
2 * s390host.c -- hosting zSeries kernel virtual machines
3 *
4 * Copyright IBM Corp. 2008
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.

--- 476 unchanged lines hidden (view full) ---

485
486int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
487{
488 int rc;
489 sigset_t sigsaved;
490
491 vcpu_load(vcpu);
492
1/*
2 * s390host.c -- hosting zSeries kernel virtual machines
3 *
4 * Copyright IBM Corp. 2008
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.

--- 476 unchanged lines hidden (view full) ---

485
486int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
487{
488 int rc;
489 sigset_t sigsaved;
490
491 vcpu_load(vcpu);
492
493rerun_vcpu:
493 /* verify, that memory has been registered */
494 if (!vcpu->kvm->arch.guest_memsize) {
495 vcpu_put(vcpu);
496 return -EINVAL;
497 }
498
499 if (vcpu->sigset_active)
500 sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
501
502 atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
503
504 BUG_ON(vcpu->kvm->arch.float_int.local_int[vcpu->vcpu_id] == NULL);
505
506 switch (kvm_run->exit_reason) {
507 case KVM_EXIT_S390_SIEIC:
508 vcpu->arch.sie_block->gpsw.mask = kvm_run->s390_sieic.mask;
509 vcpu->arch.sie_block->gpsw.addr = kvm_run->s390_sieic.addr;
510 break;
511 case KVM_EXIT_UNKNOWN:
494 /* verify, that memory has been registered */
495 if (!vcpu->kvm->arch.guest_memsize) {
496 vcpu_put(vcpu);
497 return -EINVAL;
498 }
499
500 if (vcpu->sigset_active)
501 sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
502
503 atomic_set_mask(CPUSTAT_RUNNING, &vcpu->arch.sie_block->cpuflags);
504
505 BUG_ON(vcpu->kvm->arch.float_int.local_int[vcpu->vcpu_id] == NULL);
506
507 switch (kvm_run->exit_reason) {
508 case KVM_EXIT_S390_SIEIC:
509 vcpu->arch.sie_block->gpsw.mask = kvm_run->s390_sieic.mask;
510 vcpu->arch.sie_block->gpsw.addr = kvm_run->s390_sieic.addr;
511 break;
512 case KVM_EXIT_UNKNOWN:
513 case KVM_EXIT_INTR:
512 case KVM_EXIT_S390_RESET:
513 break;
514 default:
515 BUG();
516 }
517
518 might_fault();
519
520 do {
521 __vcpu_run(vcpu);
522 rc = kvm_handle_sie_intercept(vcpu);
523 } while (!signal_pending(current) && !rc);
524
514 case KVM_EXIT_S390_RESET:
515 break;
516 default:
517 BUG();
518 }
519
520 might_fault();
521
522 do {
523 __vcpu_run(vcpu);
524 rc = kvm_handle_sie_intercept(vcpu);
525 } while (!signal_pending(current) && !rc);
526
527 if (rc == SIE_INTERCEPT_RERUNVCPU)
528 goto rerun_vcpu;
529
525 if (signal_pending(current) && !rc)
526 rc = -EINTR;
527
528 if (rc == -ENOTSUPP) {
529 /* intercept cannot be handled in-kernel, prepare kvm-run */
530 kvm_run->exit_reason = KVM_EXIT_S390_SIEIC;
531 kvm_run->s390_sieic.icptcode = vcpu->arch.sie_block->icptcode;
532 kvm_run->s390_sieic.mask = vcpu->arch.sie_block->gpsw.mask;

--- 240 unchanged lines hidden ---
530 if (signal_pending(current) && !rc)
531 rc = -EINTR;
532
533 if (rc == -ENOTSUPP) {
534 /* intercept cannot be handled in-kernel, prepare kvm-run */
535 kvm_run->exit_reason = KVM_EXIT_S390_SIEIC;
536 kvm_run->s390_sieic.icptcode = vcpu->arch.sie_block->icptcode;
537 kvm_run->s390_sieic.mask = vcpu->arch.sie_block->gpsw.mask;

--- 240 unchanged lines hidden ---