diff options
author | Christian Borntraeger <borntraeger@de.ibm.com> | 2012-02-06 04:59:07 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-03-08 07:10:18 -0500 |
commit | 9eed0735ca6a5cf386a4998ad4b6d52d1e29353f (patch) | |
tree | 447a860fca701a519aa97c41e4413801946079bc | |
parent | 9ec2d6dc6c4d4792b85dec2f09d39387fb7157d1 (diff) |
KVM: s390: provide control registers via kvm_run
There are several cases were we need the control registers for
userspace. Lets also provide those in kvm_run.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/s390/include/asm/kvm.h | 2 | ||||
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/arch/s390/include/asm/kvm.h b/arch/s390/include/asm/kvm.h index 9acbde4af297..96076676e224 100644 --- a/arch/s390/include/asm/kvm.h +++ b/arch/s390/include/asm/kvm.h | |||
@@ -44,10 +44,12 @@ struct kvm_guest_debug_arch { | |||
44 | #define KVM_SYNC_PREFIX (1UL << 0) | 44 | #define KVM_SYNC_PREFIX (1UL << 0) |
45 | #define KVM_SYNC_GPRS (1UL << 1) | 45 | #define KVM_SYNC_GPRS (1UL << 1) |
46 | #define KVM_SYNC_ACRS (1UL << 2) | 46 | #define KVM_SYNC_ACRS (1UL << 2) |
47 | #define KVM_SYNC_CRS (1UL << 3) | ||
47 | /* definition of registers in kvm_run */ | 48 | /* definition of registers in kvm_run */ |
48 | struct kvm_sync_regs { | 49 | struct kvm_sync_regs { |
49 | __u64 prefix; /* prefix register */ | 50 | __u64 prefix; /* prefix register */ |
50 | __u64 gprs[16]; /* general purpose registers */ | 51 | __u64 gprs[16]; /* general purpose registers */ |
51 | __u32 acrs[16]; /* access registers */ | 52 | __u32 acrs[16]; /* access registers */ |
53 | __u64 crs[16]; /* control registers */ | ||
52 | }; | 54 | }; |
53 | #endif | 55 | #endif |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 121316ef2e15..cf3c0a91d046 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -291,7 +291,8 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | |||
291 | vcpu->arch.gmap = vcpu->kvm->arch.gmap; | 291 | vcpu->arch.gmap = vcpu->kvm->arch.gmap; |
292 | vcpu->run->kvm_valid_regs = KVM_SYNC_PREFIX | | 292 | vcpu->run->kvm_valid_regs = KVM_SYNC_PREFIX | |
293 | KVM_SYNC_GPRS | | 293 | KVM_SYNC_GPRS | |
294 | KVM_SYNC_ACRS; | 294 | KVM_SYNC_ACRS | |
295 | KVM_SYNC_CRS; | ||
295 | return 0; | 296 | return 0; |
296 | } | 297 | } |
297 | 298 | ||
@@ -580,6 +581,11 @@ rerun_vcpu: | |||
580 | kvm_run->kvm_dirty_regs &= ~KVM_SYNC_PREFIX; | 581 | kvm_run->kvm_dirty_regs &= ~KVM_SYNC_PREFIX; |
581 | kvm_s390_set_prefix(vcpu, kvm_run->s.regs.prefix); | 582 | kvm_s390_set_prefix(vcpu, kvm_run->s.regs.prefix); |
582 | } | 583 | } |
584 | if (kvm_run->kvm_dirty_regs & KVM_SYNC_CRS) { | ||
585 | kvm_run->kvm_dirty_regs &= ~KVM_SYNC_CRS; | ||
586 | memcpy(&vcpu->arch.sie_block->gcr, &kvm_run->s.regs.crs, 128); | ||
587 | kvm_s390_set_prefix(vcpu, kvm_run->s.regs.prefix); | ||
588 | } | ||
583 | 589 | ||
584 | might_fault(); | 590 | might_fault(); |
585 | 591 | ||
@@ -629,6 +635,7 @@ rerun_vcpu: | |||
629 | kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask; | 635 | kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask; |
630 | kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr; | 636 | kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr; |
631 | kvm_run->s.regs.prefix = vcpu->arch.sie_block->prefix; | 637 | kvm_run->s.regs.prefix = vcpu->arch.sie_block->prefix; |
638 | memcpy(&kvm_run->s.regs.crs, &vcpu->arch.sie_block->gcr, 128); | ||
632 | 639 | ||
633 | if (vcpu->sigset_active) | 640 | if (vcpu->sigset_active) |
634 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); | 641 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); |