From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5S9v-0002Nl-9P for qemu-devel@nongnu.org; Wed, 07 Mar 2012 20:28:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5S9q-0001ID-Pq for qemu-devel@nongnu.org; Wed, 07 Mar 2012 20:28:46 -0500 Received: from ozlabs.org ([203.10.76.45]:39251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5S9q-0001I8-DE for qemu-devel@nongnu.org; Wed, 07 Mar 2012 20:28:42 -0500 Date: Thu, 8 Mar 2012 12:25:43 +1100 From: David Gibson Message-ID: <20120308012543.GB10735@truffala.fritz.box> References: <4F524946.1050001@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F524946.1050001@freebsd.org> Subject: Re: [Qemu-devel] [PATCH] PPC: Fix large page support in TCG List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nathan Whitehorn Cc: QEMU Developers On Sat, Mar 03, 2012 at 10:39:34AM -0600, Nathan Whitehorn wrote: > Fix large page support in TCG. The old code would overwrite the > large page table entry with the fake 4 KB > one generated here whenever the ref/change bits were updated, > causing it to point to the wrong area of memory. Instead of creating > a fake PTE, just update the real address at the end. > > Signed-off-by: Nathan Whitehorn Hrm. This looks like a cleaner way of handling things, but I don't really follow what exactly was going wrong in the old way. Can you spell out in more detail where the modified pte1 value caused problems? > --- > target-ppc/helper.c | 11 +++++------ > 1 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/target-ppc/helper.c b/target-ppc/helper.c > index 928fbcf..0f5ad2e 100644 > --- a/target-ppc/helper.c > +++ b/target-ppc/helper.c > @@ -597,12 +597,6 @@ static inline int _find_pte(CPUState *env, > mmu_ctx_t *ctx, > int is_64b, int h, > pte1 = ldq_phys(env->htab_base + pteg_off + (i * 16) + 8); > } > > - /* We have a TLB that saves 4K pages, so let's > - * split a huge page to 4k chunks */ > - if (target_page_bits != TARGET_PAGE_BITS) > - pte1 |= (ctx->eaddr & (( 1 << target_page_bits ) - 1)) > - & TARGET_PAGE_MASK; > - > r = pte64_check(ctx, pte0, pte1, h, rw, type); > LOG_MMU("Load pte from " TARGET_FMT_lx " => " > TARGET_FMT_lx " " > TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n", > @@ -678,6 +672,11 @@ static inline int _find_pte(CPUState *env, > mmu_ctx_t *ctx, > int is_64b, int h, > } > } > > + /* We have a TLB that saves 4K pages, so let's > + * split a huge page to 4k chunks */ > + if (target_page_bits != TARGET_PAGE_BITS) > + ctx->raddr |= (ctx->eaddr & (( 1 << target_page_bits ) - 1)) > + & TARGET_PAGE_MASK; > return ret; > } > -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson