mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 15:42:46 +00:00
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>
This commit is contained in:
parent
b9e5dc8d45
commit
60b413c924
2 changed files with 9 additions and 0 deletions
|
@ -41,7 +41,9 @@ struct kvm_debug_exit_arch {
|
||||||
struct kvm_guest_debug_arch {
|
struct kvm_guest_debug_arch {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define KVM_SYNC_PREFIX (1UL << 0)
|
||||||
/* definition of registers in kvm_run */
|
/* definition of registers in kvm_run */
|
||||||
struct kvm_sync_regs {
|
struct kvm_sync_regs {
|
||||||
|
__u64 prefix; /* prefix register */
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -132,6 +132,7 @@ int kvm_dev_ioctl_check_extension(long ext)
|
||||||
#ifdef CONFIG_KVM_S390_UCONTROL
|
#ifdef CONFIG_KVM_S390_UCONTROL
|
||||||
case KVM_CAP_S390_UCONTROL:
|
case KVM_CAP_S390_UCONTROL:
|
||||||
#endif
|
#endif
|
||||||
|
case KVM_CAP_SYNC_REGS:
|
||||||
r = 1;
|
r = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -288,6 +289,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
|
||||||
}
|
}
|
||||||
|
|
||||||
vcpu->arch.gmap = vcpu->kvm->arch.gmap;
|
vcpu->arch.gmap = vcpu->kvm->arch.gmap;
|
||||||
|
vcpu->run->kvm_valid_regs = KVM_SYNC_PREFIX;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,6 +574,10 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
|
||||||
|
|
||||||
vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask;
|
vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask;
|
||||||
vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr;
|
vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr;
|
||||||
|
if (kvm_run->kvm_dirty_regs & KVM_SYNC_PREFIX) {
|
||||||
|
kvm_run->kvm_dirty_regs &= ~KVM_SYNC_PREFIX;
|
||||||
|
kvm_s390_set_prefix(vcpu, kvm_run->s.regs.prefix);
|
||||||
|
}
|
||||||
|
|
||||||
might_fault();
|
might_fault();
|
||||||
|
|
||||||
|
@ -620,6 +626,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
|
||||||
|
|
||||||
kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask;
|
kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask;
|
||||||
kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr;
|
kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr;
|
||||||
|
kvm_run->s.regs.prefix = vcpu->arch.sie_block->prefix;
|
||||||
|
|
||||||
if (vcpu->sigset_active)
|
if (vcpu->sigset_active)
|
||||||
sigprocmask(SIG_SETMASK, &sigsaved, NULL);
|
sigprocmask(SIG_SETMASK, &sigsaved, NULL);
|
||||||
|
|
Loading…
Reference in a new issue