From patchwork Sat Mar 3 16:39:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Whitehorn X-Patchwork-Id: 144450 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 45A1F1007D6 for ; Sun, 4 Mar 2012 04:39:50 +1100 (EST) Received: from localhost ([::1]:46973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3svq-0000Im-PC for incoming@patchwork.ozlabs.org; Sat, 03 Mar 2012 12:39:46 -0500 Received: from eggs.gnu.org ([208.118.235.92]:51620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3svk-0000IY-8M for qemu-devel@nongnu.org; Sat, 03 Mar 2012 12:39:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S3svi-0001Fg-Fm for qemu-devel@nongnu.org; Sat, 03 Mar 2012 12:39:39 -0500 Received: from agogare.doit.wisc.edu ([144.92.197.211]:43179) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3svi-0001FH-Ao for qemu-devel@nongnu.org; Sat, 03 Mar 2012 12:39:38 -0500 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth2.wiscmail.wisc.edu by smtpauth2.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0M0B00K00I9ZNN00@smtpauth2.wiscmail.wisc.edu> for qemu-devel@nongnu.org; Sat, 03 Mar 2012 10:39:35 -0600 (CST) Received: from comporellon.tachypleus.net ([unknown] [76.210.72.39]) by smtpauth2.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0M0B0090JI9YW820@smtpauth2.wiscmail.wisc.edu> for qemu-devel@nongnu.org; Sat, 03 Mar 2012 10:39:34 -0600 (CST) Date: Sat, 03 Mar 2012 10:39:34 -0600 From: Nathan Whitehorn To: QEMU Developers Message-id: <4F524946.1050001@freebsd.org> User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0) Gecko/20120212 Thunderbird/10.0 X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 144.92.197.211 Subject: [Qemu-devel] [PATCH] PPC: Fix large page support in TCG X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Acked-by: David Gibson --- target-ppc/helper.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) 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; } -- 1.7.9 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);