From patchwork Fri Apr 28 14:59:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?S09OUkFEIEZyw6lkw6lyaWM=?= X-Patchwork-Id: 9704953 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A6C4E602B7 for ; Fri, 28 Apr 2017 15:03:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 984BD2865E for ; Fri, 28 Apr 2017 15:03:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D54528667; Fri, 28 Apr 2017 15:03:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8CBB628662 for ; Fri, 28 Apr 2017 15:03:04 +0000 (UTC) Received: from localhost ([::1]:37468 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d47QF-0003lz-Qa for patchwork-qemu-devel@patchwork.kernel.org; Fri, 28 Apr 2017 11:03:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d47N9-00029U-Gy for qemu-devel@nongnu.org; Fri, 28 Apr 2017 10:59:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d47N5-0006xH-1N for qemu-devel@nongnu.org; Fri, 28 Apr 2017 10:59:51 -0400 Received: from greensocs.com ([193.104.36.180]:60015) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d47N4-0006wh-Nc for qemu-devel@nongnu.org; Fri, 28 Apr 2017 10:59:46 -0400 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 5C4C340C5B4; Fri, 28 Apr 2017 16:59:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1493391585; bh=Fv9stcH1ZVQXvBN+Qp5+ZEL3unKycsgXZRXQzxGUkV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KsnfB2GeKqj55MxQBY7svT5OaUoP/+yyKhhctqe907Oo+cjwGoH08o1dQCiw9NUBS W9/bYb5LlM9BAhO65x0tR52MI+PvFWlIdct/yk2r1MZn/BKuRP+pkOMeE9TpUZWuX9 qTAhcw01Vot5oKGW2P4bDU7sBvN3DovnxYPakjT0= X-Virus-Scanned: amavisd-new at greensocs.com Authentication-Results: gs-01.greensocs.com (amavisd-new); dkim=pass (1024-bit key) header.d=greensocs.com Received: from greensocs.com ([127.0.0.1]) by localhost (gs-01.greensocs.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eDL-uPv9s6Iu; Fri, 28 Apr 2017 16:59:44 +0200 (CEST) Received: from corsair.home (bd231-7-88-127-3-24.fbx.proxad.net [88.127.3.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: fred.konrad@greensocs.com) by greensocs.com (Postfix) with ESMTPSA id C268240C5A8; Fri, 28 Apr 2017 16:59:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1493391584; bh=Fv9stcH1ZVQXvBN+Qp5+ZEL3unKycsgXZRXQzxGUkV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=K6wE4RHP3D0/00XLJuSwPeeMqK5349+C3wrjzLf9Avf2V8fe1W3z5XmOU+41sj8uI AUSw28Nztz1YBqvMzhToLhaljb7bHuzskFsfrCb2+HQX2rkM86fiLDbdyJHf4bP/GI +JWVkDIE0gkmXvfNXDvZVr29V1CZA9xD1a/4n6Ik= From: fred.konrad@greensocs.com To: qemu-devel@nongnu.org Date: Fri, 28 Apr 2017 16:59:30 +0200 Message-Id: <1493391576-29401-2-git-send-email-fred.konrad@greensocs.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1493391576-29401-1-git-send-email-fred.konrad@greensocs.com> References: <1493391576-29401-1-git-send-email-fred.konrad@greensocs.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 193.104.36.180 Subject: [Qemu-devel] [PATCH V3 1/7] cputlb: cleanup get_page_addr_code to use VICTIM_TLB_HIT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, mark.burton@greensocs.com, alistair.francis@xilinx.com, clg@kaod.org, pbonzini@redhat.com, fred.konrad@greensocs.com, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: KONRAD Frederic This replaces env1 and page_index variables by env and index so we can use VICTIM_TLB_HIT macro later. Reviewed-by: Richard Henderson Reviewed-by: Edgar E. Iglesias Signed-off-by: KONRAD Frederic --- cputlb.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cputlb.c b/cputlb.c index f5d056c..dcf28f7 100644 --- a/cputlb.c +++ b/cputlb.c @@ -751,21 +751,21 @@ static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr) * is actually a ram_addr_t (in system mode; the user mode emulation * version of this function returns a guest virtual address). */ -tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr) +tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr) { - int mmu_idx, page_index, pd; + int mmu_idx, index, pd; void *p; MemoryRegion *mr; - CPUState *cpu = ENV_GET_CPU(env1); + CPUState *cpu = ENV_GET_CPU(env); CPUIOTLBEntry *iotlbentry; - page_index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); - mmu_idx = cpu_mmu_index(env1, true); - if (unlikely(env1->tlb_table[mmu_idx][page_index].addr_code != + index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); + mmu_idx = cpu_mmu_index(env, true); + if (unlikely(env->tlb_table[mmu_idx][index].addr_code != (addr & TARGET_PAGE_MASK))) { - cpu_ldub_code(env1, addr); + cpu_ldub_code(env, addr); } - iotlbentry = &env1->iotlb[mmu_idx][page_index]; + iotlbentry = &env->iotlb[mmu_idx][index]; pd = iotlbentry->addr & ~TARGET_PAGE_MASK; mr = iotlb_to_region(cpu, pd, iotlbentry->attrs); if (memory_region_is_unassigned(mr)) { @@ -777,7 +777,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr) report_bad_exec(cpu, addr); exit(1); } - p = (void *)((uintptr_t)addr + env1->tlb_table[mmu_idx][page_index].addend); + p = (void *)((uintptr_t)addr + env->tlb_table[mmu_idx][index].addend); return qemu_ram_addr_from_host_nofail(p); }