aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2012-01-11 05:20:31 -0500
committerAvi Kivity <avi@redhat.com>2012-03-05 07:52:22 -0500
commit60b413c9248495ea400e80e08e4d1e28ed7ee05e (patch)
tree37881e9b94d7d736caf04c577f47b555fd34d7ff /arch
parentb9e5dc8d4511e6a00862a795319569e7fe7f60f4 (diff)
KVM: s390: provide the prefix register via kvm_run
Add the prefix register to the synced register field in kvm_run. While we need the prefix register most of the time read-only, this patch also adds handling for guest dirtying of the prefix register. 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>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/include/asm/kvm.h2
-rw-r--r--arch/s390/kvm/kvm-s390.c7
2 files changed, 9 insertions, 0 deletions
diff --git a/arch/s390/include/asm/kvm.h b/arch/s390/include/asm/kvm.h
index 325560afb77..9fc328c2615 100644
--- a/arch/s390/include/asm/kvm.h
+++ b/arch/s390/include/asm/kvm.h
@@ -41,7 +41,9 @@ struct kvm_debug_exit_arch {
41struct kvm_guest_debug_arch { 41struct kvm_guest_debug_arch {
42}; 42};
43 43
44#define KVM_SYNC_PREFIX (1UL << 0)
44/* definition of registers in kvm_run */ 45/* definition of registers in kvm_run */
45struct kvm_sync_regs { 46struct kvm_sync_regs {
47 __u64 prefix; /* prefix register */
46}; 48};
47#endif 49#endif
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 1868b89a840..6962c1b9eec 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -132,6 +132,7 @@ int kvm_dev_ioctl_check_extension(long ext)
132#ifdef CONFIG_KVM_S390_UCONTROL 132#ifdef CONFIG_KVM_S390_UCONTROL
133 case KVM_CAP_S390_UCONTROL: 133 case KVM_CAP_S390_UCONTROL:
134#endif 134#endif
135 case KVM_CAP_SYNC_REGS:
135 r = 1; 136 r = 1;
136 break; 137 break;
137 default: 138 default:
@@ -288,6 +289,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
288 } 289 }
289 290
290 vcpu->arch.gmap = vcpu->kvm->arch.gmap; 291 vcpu->arch.gmap = vcpu->kvm->arch.gmap;
292 vcpu->run->kvm_valid_regs = KVM_SYNC_PREFIX;
291 return 0; 293 return 0;
292} 294}
293 295
@@ -572,6 +574,10 @@ rerun_vcpu:
572 574
573 vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask; 575 vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask;
574 vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr; 576 vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr;
577 if (kvm_run->kvm_dirty_regs & KVM_SYNC_PREFIX) {
578 kvm_run->kvm_dirty_regs &= ~KVM_SYNC_PREFIX;
579 kvm_s390_set_prefix(vcpu, kvm_run->s.regs.prefix);
580 }
575 581
576 might_fault(); 582 might_fault();
577 583
@@ -620,6 +626,7 @@ rerun_vcpu:
620 626
621 kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask; 627 kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask;
622 kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr; 628 kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr;
629 kvm_run->s.regs.prefix = vcpu->arch.sie_block->prefix;
623 630
624 if (vcpu->sigset_active) 631 if (vcpu->sigset_active)
625 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 632 sigprocmask(SIG_SETMASK, &sigsaved, NULL);