From patchwork Fri Feb 17 20:17:07 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: 9580727 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 027436043A for ; Fri, 17 Feb 2017 20:37:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6D9C28411 for ; Fri, 17 Feb 2017 20:37:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB8D528776; Fri, 17 Feb 2017 20:37:30 +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 4AF7428411 for ; Fri, 17 Feb 2017 20:37:30 +0000 (UTC) Received: from localhost ([::1]:55769 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cepHV-0000f1-9j for patchwork-qemu-devel@patchwork.kernel.org; Fri, 17 Feb 2017 15:37:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceoyC-0000qp-I6 for qemu-devel@nongnu.org; Fri, 17 Feb 2017 15:17:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceoy8-0001l9-F4 for qemu-devel@nongnu.org; Fri, 17 Feb 2017 15:17:32 -0500 Received: from greensocs.com ([193.104.36.180]:53744) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceoy8-0001jK-3g for qemu-devel@nongnu.org; Fri, 17 Feb 2017 15:17:28 -0500 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 8C9302E8DD1; Fri, 17 Feb 2017 21:17:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1487362646; bh=18PF8c3PyUfq+tNct/HXy+bj21rBg/co+AD+/XEM+rQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xBR1LaOVZ69hAoDPjqdq3NsC8+C1j0MujWPxieNuw/Vzmxda1IxJdUGsPjnYsxC/k I5NAfuf3Unyn84BglTs94BcxGgLvnLA47ILOWKLaRGb+tS55UfNGm2uciEpFFzDHAm RB5C6rcapqaZcmmjh23nwcbOwbBQY0po8ReSabDc= 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 SUrlxjcSgK6m; Fri, 17 Feb 2017 21:17:25 +0100 (CET) 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 5D0D83FE876; Fri, 17 Feb 2017 21:17:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1487362645; bh=18PF8c3PyUfq+tNct/HXy+bj21rBg/co+AD+/XEM+rQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KcB7cWgEA5nBEg4ufYEiZkdwnKxuXb4sI8NIGuNM37RnyRMMbWzYz1zr2HZ+SowmT MsP9QA5OeLBpYGg/MmAGTIf62mMhgZ5nrmUSHxTLJcFtefQYtHHwMkdLjtn3HzKoDd O0rI5d2IyKTACQfRQPfr7CrnKzhSKt3KG1o25u54= From: fred.konrad@greensocs.com To: qemu-devel@nongnu.org Date: Fri, 17 Feb 2017 21:17:07 +0100 Message-Id: <1487362633-25018-2-git-send-email-fred.konrad@greensocs.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487362633-25018-1-git-send-email-fred.konrad@greensocs.com> References: <1487362633-25018-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 V2 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 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. Signed-off-by: KONRAD Frederic --- cputlb.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cputlb.c b/cputlb.c index 6c39927..665caea 100644 --- a/cputlb.c +++ b/cputlb.c @@ -457,21 +457,21 @@ static void report_bad_exec(CPUState *cpu, target_ulong addr) * 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)) { @@ -484,7 +484,7 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong 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); }