From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH]: kvm-s390: add KVM_S390_GET/SET_SREGS2 call for additional hw regs Date: Tue, 20 Dec 2011 11:52:16 +0200 Message-ID: <4EF05AD0.8050808@redhat.com> References: <4EF0577D.6010902@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , KVM list , Alexander Graf , Cornelia Huck , Jens Freimann , Martin Schwidefsky , Heiko Carstens , Carsten Otte To: Christian Borntraeger Return-path: Received: from mx1.redhat.com ([209.132.183.28]:40676 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752070Ab1LTJw1 (ORCPT ); Tue, 20 Dec 2011 04:52:27 -0500 In-Reply-To: <4EF0577D.6010902@de.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 12/20/2011 11:38 AM, Christian Borntraeger wrote: > Avi, Marcelo, > > let me know if you would prefer to reuse another register load/save ioctls > that is still unused for s390 (e.g. XCRS). No, the proposed names are fine. > > From: Christian Borntraeger > > For guest relocation and virsh dump qemu needs an interface to > get/set additional registers from kvm. We also need the prefix > register for all guest memory accesses to the prefix pages. > > The prefix register could also be set via the KVM_S390_SIGP_SET_PREFIX > interrupt ioctl, but I also added the synchronous operation to have > > o symmetry: we want to have the same struct for get/set routine > o the interrupt is only delivered before entering the SIE, we also > want to cover the sequence set prefix/store status at prefix > > Signed-off-by: Christian Borntraeger > --- > arch/s390/include/asm/kvm.h | 9 +++++++++ > arch/s390/kvm/kvm-s390.c | 24 ++++++++++++++++++++++++ > include/linux/kvm.h | 4 ++++ > 3 files changed, 37 insertions(+) The lack of documentation is not. > @@ -673,6 +674,29 @@ long kvm_arch_vcpu_ioctl(struct file *fi > case KVM_S390_INITIAL_RESET: > r = kvm_arch_vcpu_ioctl_initial_reset(vcpu); > break; > + case KVM_S390_GET_SREGS2: { > + struct kvm_s390_sregs2 sregs2; > + > + sregs2.prefix = vcpu->arch.sie_block->prefix; > + sregs2.gbea = vcpu->arch.sie_block->gbea; > + sregs2.cputm = vcpu->arch.sie_block->cputm; > + sregs2.ckc = vcpu->arch.sie_block->ckc; > + sregs2.todpr = vcpu->arch.sie_block->todpr; > + r = copy_to_user(argp, &sregs2, sizeof(sregs2)); Need to return -EFAULT, not the number of remaining bytes to copy. > + break; > + } > + case KVM_S390_SET_SREGS2: { > + struct kvm_s390_sregs2 sregs2; > + > + vcpu->arch.sie_block->prefix = sregs2.prefix; > + vcpu->arch.sie_block->gbea = sregs2.gbea; > + vcpu->arch.sie_block->cputm = sregs2.cputm; > + vcpu->arch.sie_block->ckc = sregs2.ckc; > + vcpu->arch.sie_block->todpr = sregs2.todpr; Copying uninitialized data. > + r = copy_from_user(&sregs2, argp, sizeof(sregs2)); Then initializing it. > + vcpu->arch.sie_block->ihcpu = 0xffff; What's this? -- error compiling committee.c: too many arguments to function