From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [patch 2/4] QEMU/KVM: get/set mpstate libkvm interface Date: Fri, 11 Apr 2008 03:21:27 +0300 Message-ID: <47FEAF07.10404@qumranet.com> References: <20080407203045.583930505@localhost.localdomain> <20080407203324.095878017@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel@lists.sourceforge.net To: Marcelo Tosatti Return-path: In-Reply-To: <20080407203324.095878017@localhost.localdomain> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org Marcelo Tosatti wrote: > Add libkvm interface to get/set the mpstate. > > Signed-off-by: Marcelo Tosatti > > Index: marcelo/git/kvm-userspace.io/libkvm/libkvm.c > =================================================================== > --- marcelo.orig/git/kvm-userspace.io/libkvm/libkvm.c > +++ marcelo/git/kvm-userspace.io/libkvm/libkvm.c > @@ -776,6 +776,32 @@ int kvm_set_sregs(kvm_context_t kvm, int > return ioctl(kvm->vcpu_fd[vcpu], KVM_SET_SREGS, sregs); > } > > +int kvm_get_mpstate(kvm_context_t kvm, int vcpu, int *mpstate) > +{ > + int r; > + > +#ifdef KVM_CAP_MP_STATE > + r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_MP_STATE); > + if (r > 0) > + return ioctl(kvm->vcpu_fd[vcpu], KVM_GET_MP_STATE, mpstate); > +#endif > + return -1; > +} > We usually follow the convention of returning -errno in case of error instead of -1 in libkvm. -- Any sufficiently difficult bug is indistinguishable from a feature. ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone