The prefix register is a read-mostly value that is necessary to emulate memory accesses on behalf of the guest cpu in an architecture compliant way. Avoid an additional ioctl by providing the prefix content in the r/o section of kvm_run. Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx> --- arch/s390/include/asm/kvm.h | 2 ++ arch/s390/kvm/kvm-s390.c | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/arch/s390/include/asm/kvm.h b/arch/s390/include/asm/kvm.h index dda27a0..b48edc3 100644 --- a/arch/s390/include/asm/kvm.h +++ b/arch/s390/include/asm/kvm.h @@ -41,8 +41,10 @@ struct kvm_debug_exit_arch { struct kvm_guest_debug_arch { }; +#define KVM_SYNC_RO_PREFIX (1UL << 0) /* definition of registers in kvm_run */ struct kvm_sync_ro_regs { + __u32 prefix; /* prefix register */ }; struct kvm_sync_rw_regs { diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index d1c44573..1b48a73 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -129,6 +129,7 @@ int kvm_dev_ioctl_check_extension(long ext) case KVM_CAP_S390_PSW: case KVM_CAP_S390_GMAP: case KVM_CAP_SYNC_MMU: + case KVM_CAP_SYNC_REGS: r = 1; break; default: @@ -256,6 +257,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm) int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) { vcpu->arch.gmap = vcpu->kvm->arch.gmap; + vcpu->run->kvm_valid_sync_ro_regs = KVM_SYNC_RO_PREFIX; return 0; } @@ -556,6 +558,7 @@ rerun_vcpu: kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask; kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr; + kvm_run->sync_ro.prefix = vcpu->arch.sie_block->prefix; if (vcpu->sigset_active) sigprocmask(SIG_SETMASK, &sigsaved, NULL); -- 1.7.8.2 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html