From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LAt6z-0005da-Mv for qemu-devel@nongnu.org; Thu, 11 Dec 2008 16:30:21 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LAt6v-0005aN-Gr for qemu-devel@nongnu.org; Thu, 11 Dec 2008 16:30:20 -0500 Received: from [199.232.76.173] (port=36596 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LAt6v-0005aH-9C for qemu-devel@nongnu.org; Thu, 11 Dec 2008 16:30:17 -0500 Received: from an-out-0708.google.com ([209.85.132.242]:21755) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LAt6u-0002cE-B7 for qemu-devel@nongnu.org; Thu, 11 Dec 2008 16:30:16 -0500 Received: by an-out-0708.google.com with SMTP id c38so534301ana.37 for ; Thu, 11 Dec 2008 13:30:14 -0800 (PST) Message-ID: <49418662.8000205@codemonkey.ws> Date: Thu, 11 Dec 2008 15:30:10 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 3/6] Enable KVM for ppcemb. References: <1229028752-9480-1-git-send-email-hollisb@us.ibm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kvm-ppc@vger.kernel.org Hollis Blanchard wrote: > Implement hooks called by generic KVM code. > > Also add code that will copy the host's CPU and timebase frequencies to the > guest, which is necessary on KVM because the guest can directly access the > timebase. > > Signed-off-by: Hollis Blanchard > --- > Makefile.target | 3 + > configure | 6 ++ > target-ppc/helper.c | 5 + > target-ppc/kvm.c | 212 ++++++++++++++++++++++++++++++++++++++++++++++++++ > target-ppc/kvm_ppc.c | 105 +++++++++++++++++++++++++ > target-ppc/kvm_ppc.h | 15 ++++ > 6 files changed, 346 insertions(+), 0 deletions(-) > create mode 100644 target-ppc/kvm.c > create mode 100644 target-ppc/kvm_ppc.c > create mode 100644 target-ppc/kvm_ppc.h > > diff --git a/Makefile.target b/Makefile.target > index 7152dff..d01231d 100644 > --- a/Makefile.target > +++ b/Makefile.target > @@ -652,6 +652,9 @@ OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o > OBJS+= unin_pci.o ppc_chrp.o > # PowerPC 4xx boards > OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o > +ifdef CONFIG_KVM > +OBJS+= kvm_ppc.o > +endif > Shouldn't you be kvm.o? If your file lives in target-ppc/kvm.c, it'll just work. > diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c > new file mode 100644 > index 0000000..90b943b > --- /dev/null > +++ b/target-ppc/kvm.c > @@ -0,0 +1,212 @@ > +int kvm_arch_put_registers(CPUState *env) > +{ > + struct kvm_regs regs; > + int ret; > + int i; > Your indent is off. > +int kvm_arch_get_registers(CPUState *env) > +{ > + struct kvm_regs regs; > + uint32_t i, ret; > + > + ret = kvm_vcpu_ioctl(env, KVM_GET_REGS, ®s); > + if (ret < 0) > + return ret; > + > + env->ctr = regs.ctr; > + env->lr = regs.lr; > + env->xer = regs.xer; > + env->msr = regs.msr; > + /* calculate hflags based on the current msr using the ppc qemu helper */ > + hreg_compute_hflags(env); > Do you need this? Practically speaking, I don't even think we need to maintain them on x86 anymore. > diff --git a/target-ppc/kvm_ppc.c b/target-ppc/kvm_ppc.c > new file mode 100644 > index 0000000..b2b56df > --- /dev/null > +++ b/target-ppc/kvm_ppc.c > Hence my confusion. These are just kvm related helper? I don't know that kvm_ppc.c is a very information name for this sort of stuff. Since this is really host specific, not target specific, why not move it out of target-ppc. Regards, Anthony Liguori