From patchwork Fri Feb 17 20:17: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: 9580697 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 966676042F for ; Fri, 17 Feb 2017 20:22:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86B6428718 for ; Fri, 17 Feb 2017 20:22:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B7872875C; Fri, 17 Feb 2017 20:22:44 +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 0398728718 for ; Fri, 17 Feb 2017 20:22:44 +0000 (UTC) Received: from localhost ([::1]:55690 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cep3D-00053h-18 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 17 Feb 2017 15:22:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceoyC-0000qm-Hi for qemu-devel@nongnu.org; Fri, 17 Feb 2017 15:17:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ceoy8-0001lc-UX for qemu-devel@nongnu.org; Fri, 17 Feb 2017 15:17:32 -0500 Received: from greensocs.com ([193.104.36.180]:53783) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ceoy8-0001lD-NT 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 2288E3FE89C; Fri, 17 Feb 2017 21:17:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1487362648; bh=vFs4pz0qoNSPRirMExI/nfF83RiQEDUvvMEt6Nfjry4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=B6h18a15Q+FahX90M+zqXVbQgrfknLDX9S9Mn61iPbxl2R+biwBcxxoOHDISPXZkA WWx6VGbp4qDRkQ0SLkJxJIU2/rsTLJRDno3FpCryU5vgVxXaGo4K6Snovby1GdNn6U I+N5Y5+nW3H1m/Uv/3Ej+V1aPt56cQMSz5qygf/Y= 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 LomGsz7c5j_J; Fri, 17 Feb 2017 21:17:27 +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 ABFE03FE87A; 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=1487362647; bh=vFs4pz0qoNSPRirMExI/nfF83RiQEDUvvMEt6Nfjry4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=4FnnGuCuVVcZJmE8yPCq+U+ktslK8ePA7HTIr8p+rcc2rji/jFyuWpfmharzoJ3q+ IIv8O6ACdToFZiDJEYlbK+ib2zShZl7vjxO4sQ8aaWKHD4c51BDGiUKJic/SXpDKnN FrAfW+M1LP8f5J+jPl8230SB87I6h4O2fW34i6fQ= From: fred.konrad@greensocs.com To: qemu-devel@nongnu.org Date: Fri, 17 Feb 2017 21:17:09 +0100 Message-Id: <1487362633-25018-4-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 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 --- 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;