From patchwork Wed Jun 14 17:45:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 9787187 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 93767602C9 for ; Wed, 14 Jun 2017 17:49:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F35B27F10 for ; Wed, 14 Jun 2017 17:49:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7424427F9F; Wed, 14 Jun 2017 17:49:06 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 518CA27F10 for ; Wed, 14 Jun 2017 17:49:05 +0000 (UTC) Received: from localhost ([::1]:50267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLCPg-00084b-G4 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 14 Jun 2017 13:49:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLCMl-0005kF-S4 for qemu-devel@nongnu.org; Wed, 14 Jun 2017 13:46:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLCMj-00013U-4Q for qemu-devel@nongnu.org; Wed, 14 Jun 2017 13:46:03 -0400 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]:34593) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLCMi-00013E-Sz for qemu-devel@nongnu.org; Wed, 14 Jun 2017 13:46:01 -0400 Received: by mail-lf0-x243.google.com with SMTP id o28so970535lfk.1 for ; Wed, 14 Jun 2017 10:46:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IzCY5Sxqi+KPQVSPDYIAouq5pMrhJ1bchyWSIyFYzy0=; b=aNU/nE0IqGr7p/ZvLjN4Ij631H7BQdmUkNOb4ZjbxNEBawuQjmN2/c9nvH8x+vU/FF P4P7WZrE5ekPqfUkSUudTrNRfxcmK/cGARKybw4QG7HMW6kNTrPx7VKjlsWoWC+qIpbI oJkas/J32KvKv8ZQ9i0ZPFHOVTy+X3yk7cNisw0PS9Q2HN0xlapD++a4KDba7Cs3t74t 1gPGsRBrFoLEmYLklMFNFwj++LN2YNQCzqJCfZi9iM4vL2bVxVVw+J2oDfQGCa3OA7hA wFkQRvlhyFSILcv54VENc98o6EPt2prnqyPf3YaCPYt6D2bTZ4Z8yhSpelAAUpu53sHi MVPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IzCY5Sxqi+KPQVSPDYIAouq5pMrhJ1bchyWSIyFYzy0=; b=VAp9PCbqF882qX9vxY7l2GuGFYL3V1rr6s3Hjh7f32tLSApCzz9XIU5M5z5GwXPyHy gxzmI/KbiKzfNv41M3HKzSSCe1AJVFhQ3DCRze6pFd/yIEFUvCICfScB+JxlEn/Oy6Ml yRObeE1XPtdvatPjTD9frWjvI8pUB26pZzMlcNCiLxJCDGHwkxDjx8mlsVzvLlzo8DJz 5JdRPKs338LyKlqfYcIiJuD80KZ7McO+tAaEKex6L3bnho2ka9tqZGPq9l6HAyQ2gywM RGUbP9P4jXYcUpafIPnRn0L+UtMmf6l/Te1sa47gpSeWQEMGVunOzpSW3UZdJSyMOCow IVQA== X-Gm-Message-State: AKS2vOwVf9J4fvDSkH2S8h20ePy8h5YxOlSjdl8sFvV5Btd/T+4FkdDv WMUm5aA7IZ46bs0B X-Received: by 10.25.152.208 with SMTP id a199mr369756lfe.165.1497462359412; Wed, 14 Jun 2017 10:45:59 -0700 (PDT) Received: from localhost (81-231-233-234-no56.tbcn.telia.com. [81.231.233.234]) by smtp.gmail.com with ESMTPSA id w4sm157240lff.45.2017.06.14.10.45.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 10:45:58 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Wed, 14 Jun 2017 19:45:49 +0200 Message-Id: <1497462353-3432-4-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497462353-3432-1-git-send-email-edgar.iglesias@gmail.com> References: <1497462353-3432-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::243 Subject: [Qemu-devel] [PULL 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, pbonzini@redhat.com, rth@twiddle.net, 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. Reviewed-by: Richard Henderson Reviewed-by: Edgar E. Iglesias Signed-off-by: KONRAD Frederic --- cputlb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cputlb.c b/cputlb.c index 5d6c755..95265a0 100644 --- a/cputlb.c +++ b/cputlb.c @@ -849,8 +849,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;