From patchwork Sat Jun 23 00:33:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 166709 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 114B5B6F9F for ; Sat, 23 Jun 2012 11:22:37 +1000 (EST) Received: from localhost ([::1]:58170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiEJj-00086Y-2Z for incoming@patchwork.ozlabs.org; Fri, 22 Jun 2012 20:35:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiEId-0005hs-Ox for qemu-devel@nongnu.org; Fri, 22 Jun 2012 20:34:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SiEIb-0007tA-Ty for qemu-devel@nongnu.org; Fri, 22 Jun 2012 20:34:03 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:36193) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiEIb-0007st-LM for qemu-devel@nongnu.org; Fri, 22 Jun 2012 20:34:01 -0400 Received: by pbbro12 with SMTP id ro12so4321638pbb.4 for ; Fri, 22 Jun 2012 17:33:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=UUmbR+7SzCMX6sG3lxThl3TRMpLG2ZVm5BLyO8BVrDk=; b=pYXL64mZMxWjB+7HFrwqRYD6GXljxi8mNjIWkM8qYHj/3bo40M/RTyJWhdkaye8+eE 4ApkZP5GYuV4K+D/2Bt1/gCxFg8EteeyZwUGZ00A5bhrjJsYxpz9qPriblrJ5Ctk4BLV AAVRbcZ3c7M40ElWhd4x7EBdrBpso6Btk6PF8kP/q3Js67Px3iO/vWGIoGYLRno9+cYn pJl5K5gmwPfFIFnHOJGGQ/4XGHhmLiimZsnT06gJ3Yai6F/aRAGuObXcD2jUnPKzzSZh 04xE7cvK5Xi1dOP/cR7DeG0WHhXX1lX9SvFO3yyqkUfCi65godOW/T9hzsiRnRnxpLbJ Rp6A== Received: by 10.68.132.201 with SMTP id ow9mr14575387pbb.160.1340411639505; Fri, 22 Jun 2012 17:33:59 -0700 (PDT) Received: from localhost.localdomain ([32.97.110.59]) by mx.google.com with ESMTPS id os1sm630169pbb.49.2012.06.22.17.33.57 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Jun 2012 17:33:58 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Fri, 22 Jun 2012 19:33:08 -0500 Message-Id: <1340411610-22596-5-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1340411610-22596-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1340411610-22596-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH stable-1.1 04/26] target-xtensa: extract TLB entry setting method 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 From: Max Filippov Signed-off-by: Max Filippov Signed-off-by: Blue Swirl --- target-xtensa/cpu.h | 3 +++ target-xtensa/op_helper.c | 15 +++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h index 6d0ea7c..6c590fe 100644 --- a/target-xtensa/cpu.h +++ b/target-xtensa/cpu.h @@ -370,6 +370,9 @@ void split_tlb_entry_spec_way(const CPUXtensaState *env, uint32_t v, bool dtlb, uint32_t *vpn, uint32_t wi, uint32_t *ei); int xtensa_tlb_lookup(const CPUXtensaState *env, uint32_t addr, bool dtlb, uint32_t *pwi, uint32_t *pei, uint8_t *pring); +void xtensa_tlb_set_entry_mmu(const CPUXtensaState *env, + xtensa_tlb_entry *entry, bool dtlb, + unsigned wi, unsigned ei, uint32_t vpn, uint32_t pte); void xtensa_tlb_set_entry(CPUXtensaState *env, bool dtlb, unsigned wi, unsigned ei, uint32_t vpn, uint32_t pte); int xtensa_get_physical_addr(CPUXtensaState *env, diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c index ce61157..663bb6d 100644 --- a/target-xtensa/op_helper.c +++ b/target-xtensa/op_helper.c @@ -655,6 +655,16 @@ uint32_t HELPER(ptlb)(uint32_t v, uint32_t dtlb) } } +void xtensa_tlb_set_entry_mmu(const CPUXtensaState *env, + xtensa_tlb_entry *entry, bool dtlb, + unsigned wi, unsigned ei, uint32_t vpn, uint32_t pte) +{ + entry->vaddr = vpn; + entry->paddr = pte & xtensa_tlb_get_addr_mask(env, dtlb, wi); + entry->asid = (env->sregs[RASID] >> ((pte >> 1) & 0x18)) & 0xff; + entry->attr = pte & 0xf; +} + void xtensa_tlb_set_entry(CPUXtensaState *env, bool dtlb, unsigned wi, unsigned ei, uint32_t vpn, uint32_t pte) { @@ -665,10 +675,7 @@ void xtensa_tlb_set_entry(CPUXtensaState *env, bool dtlb, if (entry->asid) { tlb_flush_page(env, entry->vaddr); } - entry->vaddr = vpn; - entry->paddr = pte & xtensa_tlb_get_addr_mask(env, dtlb, wi); - entry->asid = (env->sregs[RASID] >> ((pte >> 1) & 0x18)) & 0xff; - entry->attr = pte & 0xf; + xtensa_tlb_set_entry_mmu(env, entry, dtlb, wi, ei, vpn, pte); tlb_flush_page(env, entry->vaddr); } else { qemu_log("%s %d, %d, %d trying to set immutable entry\n",