From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mdu0P-0002nD-OB for qemu-devel@nongnu.org; Wed, 19 Aug 2009 18:51:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mdu0L-0002lL-EF for qemu-devel@nongnu.org; Wed, 19 Aug 2009 18:51:45 -0400 Received: from [199.232.76.173] (port=60641 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mdu0L-0002lA-5S for qemu-devel@nongnu.org; Wed, 19 Aug 2009 18:51:41 -0400 Received: from e37.co.us.ibm.com ([32.97.110.158]:40895) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mdu0I-0002m4-Vl for qemu-devel@nongnu.org; Wed, 19 Aug 2009 18:51:39 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e37.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id n7JMobTX011419 for ; Wed, 19 Aug 2009 16:50:37 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n7JMpT1I186142 for ; Wed, 19 Aug 2009 16:51:29 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n7JMpSoa008583 for ; Wed, 19 Aug 2009 16:51:28 -0600 From: Hollis Blanchard In-Reply-To: <1249378568-18008-5-git-send-email-yu.liu@freescale.com> References: <1249378568-18008-1-git-send-email-yu.liu@freescale.com> <1249378568-18008-2-git-send-email-yu.liu@freescale.com> <1249378568-18008-3-git-send-email-yu.liu@freescale.com> <1249378568-18008-4-git-send-email-yu.liu@freescale.com> <1249378568-18008-5-git-send-email-yu.liu@freescale.com> Content-Type: text/plain Date: Wed, 19 Aug 2009 15:51:24 -0700 Message-Id: <1250722284.4237.53.camel@slab.beaverton.ibm.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 4/5] kvmppc: Translate eaddr for fsl_booke mmu List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Yu Cc: jan.kiszka@siemens.com, froydnj@codesourcery.com, qemu-devel@nongnu.org, kvm-ppc@vger.kernel.org, Alexander Graf On Tue, 2009-08-04 at 17:36 +0800, Liu Yu wrote: > Signed-off-by: Liu Yu > --- > target-ppc/helper.c | 17 +++++++++++++++-- > 1 files changed, 15 insertions(+), 2 deletions(-) > > diff --git a/target-ppc/helper.c b/target-ppc/helper.c > index 6eca2e5..07e56a4 100644 > --- a/target-ppc/helper.c > +++ b/target-ppc/helper.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > > #include "cpu.h" > #include "exec-all.h" > @@ -1325,8 +1326,20 @@ static always_inline int check_physical (CPUState *env, mmu_ctx_t *ctx, > cpu_abort(env, "MPC8xx MMU model is not implemented\n"); > break; > case POWERPC_MMU_BOOKE_FSL: > - /* XXX: TODO */ > - cpu_abort(env, "BookE FSL MMU model not implemented\n"); > + if (kvm_enabled()) { > + struct kvm_translation tr; > + > + /* For now we only debug guest kernel */ > + tr.linear_address = eaddr; > + ret = kvm_vcpu_ioctl(env, KVM_TRANSLATE, &tr); > + if (ret < 0) > + return ret; > + > + ctx->raddr = tr.physical_address; > + } else { > + /* XXX: TODO */ > + cpu_abort(env, "BookE FSL MMU model not implemented\n"); > + } > break; > default: > cpu_abort(env, "Unknown or invalid MMU model\n"); One objection: the comment is a little obscure. I think what you're really saying is "in Linux guests, kernel addresses should always be covered by TLB1, which means for those addresses we can expect this ioctl to succeed." However, since you need to handle failures anyways, I think you should remove the comment entirely. Second, (and this isn't an objection but rather a question) do you have any better ideas for struct kvm_translation? It only really makes sense for x86. We don't need to stick with it. -- Hollis Blanchard IBM Linux Technology Center