From patchwork Fri Feb 3 17:06:35 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: 9554709 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 0204D60424 for ; Fri, 3 Feb 2017 17:08:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08C4C28178 for ; Fri, 3 Feb 2017 17:08:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F193628427; Fri, 3 Feb 2017 17:08:02 +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 A553E28178 for ; Fri, 3 Feb 2017 17:08:02 +0000 (UTC) Received: from localhost ([::1]:35943 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZhL7-0004du-I9 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 03 Feb 2017 12:08:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZhKV-0004cP-1F for qemu-devel@nongnu.org; Fri, 03 Feb 2017 12:07:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZhKU-0002fr-6s for qemu-devel@nongnu.org; Fri, 03 Feb 2017 12:07:23 -0500 Received: from greensocs.com ([193.104.36.180]:39070) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZhKT-0002fR-Qr for qemu-devel@nongnu.org; Fri, 03 Feb 2017 12:07:22 -0500 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id 2E5AD24CEC6; Fri, 3 Feb 2017 18:07:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1486141641; bh=vFs4pz0qoNSPRirMExI/nfF83RiQEDUvvMEt6Nfjry4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ZHV2bMtcuG1+W/ttZPJYNkDvGXSLtI+0snIGXvlTmAnRBYI9/HevkDl/0DNVBcP/r jOlWQjY1JKwO+6wp4kcRJcQSfm42exaQVZrPyVyrA7mw0bj0Qcq08goP/W0liJDFwo 6Y945nQjSibDRSTzceNyXP1vRfi6EFVhPbEuMF30= 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 header.b=G2lm0ozC; dkim=pass (1024-bit key) header.d=greensocs.com header.b=O9DT8Pmv 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 lApdEQbajje8; Fri, 3 Feb 2017 18:07:20 +0100 (CET) Received: by greensocs.com (Postfix, from userid 998) id 48DCA2E8DC5; Fri, 3 Feb 2017 18:07:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1486141640; bh=vFs4pz0qoNSPRirMExI/nfF83RiQEDUvvMEt6Nfjry4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=G2lm0ozC/OLf7nHpkcgrlkf3vS6oGfmmzcWb87o63ekvxWpCSTQGhkLhEfBxYDIZa ZzF440l7TCLRFe4bnPwx1YqqbTEyDnAB23l34TRgzqJ0fJZXPbyhNCQL/HFh77n7oU On/FutyqFAdFhkxKNDOGqggUeen3SEK/sssM29cQ= 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 7AE2124CEC6; Fri, 3 Feb 2017 18:07:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1486141639; bh=vFs4pz0qoNSPRirMExI/nfF83RiQEDUvvMEt6Nfjry4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=O9DT8PmvMmkDfMvarBxZpurUehmfFI/LppDlJVlAAOlk1PT4nNpCrvuGvTPCHoJys aSPLTc4vwMtSAw7Yvnl4j/GbMEPOllNRz6SSm1R5MKbSj0G4dBL5z/CNnkb944w2LS pDILugcLDiQ7QiwHLtw++aXVppRSVJ3IJM5GtQsk= From: fred.konrad@greensocs.com To: qemu-devel@nongnu.org Date: Fri, 3 Feb 2017 18:06:35 +0100 Message-Id: <1486141597-13941-4-git-send-email-fred.konrad@greensocs.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1486141597-13941-1-git-send-email-fred.konrad@greensocs.com> References: <1486141597-13941-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] [RFC 3/5] 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;