From patchwork Thu Feb 16 14:30:09 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: 9577371 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 4FD4960244 for ; Thu, 16 Feb 2017 15:00:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DF9028609 for ; Thu, 16 Feb 2017 15:00:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32CC228619; Thu, 16 Feb 2017 15:00:15 +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 A51C228609 for ; Thu, 16 Feb 2017 15:00:14 +0000 (UTC) Received: from localhost ([::1]:47173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceNXZ-0007M5-Fz for patchwork-qemu-devel@patchwork.kernel.org; Thu, 16 Feb 2017 10:00:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51214) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceN4u-0002LF-6Y for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:30:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceN4q-0007R2-RX for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:30:36 -0500 Received: from greensocs.com ([193.104.36.180]:53249) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceN4q-0007Ov-It for qemu-devel@nongnu.org; Thu, 16 Feb 2017 09:30:32 -0500 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 46D8C40D416; Thu, 16 Feb 2017 15:30:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1487255429; bh=vFs4pz0qoNSPRirMExI/nfF83RiQEDUvvMEt6Nfjry4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vIONwvqVKPdWvE/w+GDaTtEAGhWhXC2Rjy9LXRKvU5VVzurR7gPAQuEd/yY69Gzk0 su5wNMhtogDMB2wFdZrHwLeOm+Qn+JByYUQEIBoh4IApvSD3tQAPbBQfiCh2ZjpiLz HvTeYz6T5j5UAfQFSH8yEtz6PAm/fc9zMxhxFV/s= 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 YHqyxVXCBd9y; Thu, 16 Feb 2017 15:30:28 +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 EB3BB40D40A; Thu, 16 Feb 2017 15:30:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1487255428; bh=vFs4pz0qoNSPRirMExI/nfF83RiQEDUvvMEt6Nfjry4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kCyo01Hwo/bDWKOmKpN1J1REGo31wi3TuUdGcgtMt5FnXo8Wz4p8HO/7SQqeCeWTe cHPv5WtyJIkzRdJlRIrkFi+0Wofukl3jVMlfaQ8knD2ybxnb21wL4gS8fA18XW3mau f3kYoczIiqdPLwiqnEYIjfj5VEQep9zyTCC2XQYc= From: fred.konrad@greensocs.com To: qemu-devel@nongnu.org Date: Thu, 16 Feb 2017 15:30:09 +0100 Message-Id: <1487255413-14196-4-git-send-email-fred.konrad@greensocs.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487255413-14196-1-git-send-email-fred.konrad@greensocs.com> References: <1487255413-14196-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 V1 3/7] cputlb: fix the way get_page_addr_code fills the tlb 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 get_page_addr_code(..) does a cpu_ldub_code to fill the tlb: This can lead to some side effects if a device is mapped at this address. So this patch replaces the cpu_memory_ld by a tlb_fill. Signed-off-by: KONRAD Frederic Reviewed-by: Richard Henderson --- cputlb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cputlb.c b/cputlb.c index b3a5f47..846341e 100644 --- a/cputlb.c +++ b/cputlb.c @@ -534,8 +534,10 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr) 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(env, addr); + (addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK)))) { + if (!VICTIM_TLB_HIT(addr_read, addr)) { + tlb_fill(ENV_GET_CPU(env), addr, MMU_INST_FETCH, mmu_idx, 0); + } } iotlbentry = &env->iotlb[mmu_idx][index]; pd = iotlbentry->addr & ~TARGET_PAGE_MASK;