From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Date: Thu, 11 Dec 2008 21:30:10 +0000 Subject: Re: [Qemu-devel] [PATCH 3/6] Enable KVM for ppcemb. Message-Id: <49418662.8000205@codemonkey.ws> List-Id: References: <1229028752-9480-1-git-send-email-hollisb@us.ibm.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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