From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Subject: [patch 2/3] kvm-s390: provide the prefix register via kvm_run Date: Thu, 22 Dec 2011 12:56:48 +0100 Message-ID: <20111222120054.256261796@de.ibm.com> References: <20111222115646.248800653@de.ibm.com> Cc: Carsten Otte , Alexander Graf , Jens Freimann , Cornelia Huck , Heiko Carstens , Martin Schwidefsky , KVM , Christian Borntraeger To: Avi Kivity , Marcelo Tossati Return-path: Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:36515 "EHLO e06smtp16.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752322Ab1LVMBV (ORCPT ); Thu, 22 Dec 2011 07:01:21 -0500 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 22 Dec 2011 12:01:17 -0000 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pBMC0tTN2281722 for ; Thu, 22 Dec 2011 12:00:55 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pBMC0s3D020289 for ; Thu, 22 Dec 2011 05:00:55 -0700 Content-Disposition: inline; filename=kvm_run_prefix.patch Sender: kvm-owner@vger.kernel.org List-ID: From: Christian Borntraeger The prefix register is a read-mostly value that is necessary to emulate memory accesses 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 --- arch/s390/include/asm/kvm.h | 1 + arch/s390/kvm/kvm-s390.c | 2 ++ 2 files changed, 3 insertions(+) Index: b/arch/s390/include/asm/kvm.h =================================================================== --- a/arch/s390/include/asm/kvm.h +++ b/arch/s390/include/asm/kvm.h @@ -43,6 +43,7 @@ struct kvm_guest_debug_arch { /* definition of registers in kvm_run */ struct sync_ro_regs { + __u32 prefix; /* prefix register */ }; struct sync_rw_regs { Index: b/arch/s390/kvm/kvm-s390.c =================================================================== --- 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 e case KVM_CAP_S390_PSW: case KVM_CAP_S390_GMAP: case KVM_CAP_SYNC_MMU: + case KVM_CAP_SYNC_REGS: r = 1; break; default: @@ -556,6 +557,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_regs.prefix = vcpu->arch.sie_block->prefix; if (vcpu->sigset_active) sigprocmask(SIG_SETMASK, &sigsaved, NULL);