From patchwork Mon Mar 6 00:38:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 659153 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp1572697wrb; Sun, 5 Mar 2023 16:42:54 -0800 (PST) X-Google-Smtp-Source: AK7set9WuXo7mKqz2QGynUeukRUiHGFMuMZhOltC3iz9hX/zZ6wG6GNrqu2YlREaw9V+H72xCo8F X-Received: by 2002:a05:6214:29ea:b0:53b:38e:3782 with SMTP id jv10-20020a05621429ea00b0053b038e3782mr15902267qvb.18.1678063374497; Sun, 05 Mar 2023 16:42:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678063374; cv=none; d=google.com; s=arc-20160816; b=Pn7oRMOTx6K3Jme/fi6FY7IvvWltkJFTS/ze9cQCFOaFQ+JPS72OpXdflFNZNzkwiN PoGyRDtjdKbHrjhJ1gdm7ic09EeFNRwONVRPymm4LmhL6M2zJ1bE6kqBBmc9aXTn0x6H 8ZiJRyq0HOL17aEPbE4Rl8VxLUlz2lBlDkemo22jGJ6Nd2p7iSpm/C6Ri8Z38BieuzIr 7P8RW146IZuXXomYjokuHXJPnuo1fWozLPhNgxqE7YZ/5ppmN4vIMVY7KC0hNzXWUJ8D HL0jBWyyH/Hfv1KY1Tq9/PRfbBX1q59fya6UxcLw/CsK08yAxgen/PsnpmW8vlhQTe3s AmjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5TkEN34DJDutuRTHXFmA2vuNe5wTUw1X2Ctodk8NtTM=; b=kn32bI6lX+kyjwgZFjJj568ElYScj3DlZOZ8lOVriGp2FK5yJ5n4tB+F8YN/lrWigF GhT1t6WyoMp8ffbnQRUxgXoNgl0IvxMZiD7fZ+wZxH+lkgy0YiOMt9sVxrn35aqv0ghR HUg4AgXCQv8Ocjbfdve/Yx8OQom/1L0iuDA+A0uump99IHvfqecR9W4Drj0oFX+NMuMb 7/7Z5DH7rVbDDl9PeWLx7NEdxZ5JXPRSuBXPXk3XX6xrnxJidVtC5Kj/lJWhq7Hz5xym /WUUJ7lkASMADNx+21ZQkuFTqdeNT4934TUjUgzJrbdlBReqpFSlSDFR4shxkDkob6M4 DOyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B4wbkgOK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q12-20020a05620a024c00b00728811980bbsi6010076qkn.532.2023.03.05.16.42.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Mar 2023 16:42:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B4wbkgOK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYytj-0004Pj-LK; Sun, 05 Mar 2023 19:40:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYytZ-0004O4-7p for qemu-devel@nongnu.org; Sun, 05 Mar 2023 19:40:05 -0500 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYytX-0006NZ-Ca for qemu-devel@nongnu.org; Sun, 05 Mar 2023 19:40:04 -0500 Received: by mail-pj1-x1029.google.com with SMTP id kb15so8171671pjb.1 for ; Sun, 05 Mar 2023 16:40:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678063201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5TkEN34DJDutuRTHXFmA2vuNe5wTUw1X2Ctodk8NtTM=; b=B4wbkgOKSahL36KgDlRN/0oLtRidwfXDwrnWxk7HVsBxizMHmMDmIpv3aYEsy7gkOV AgLR0dQBTedDPuMPpHp5aN850ifWfsZnE0lHU56dIyyQ6vLYwcvoO5IU09zLC0GX+52Z BRvY5MeqL+sL7DLGLUjOvJJlgW4njePeBUrGInXw0zKzH7SzHr1Qfe5tRWDQh8Qr0eif vaTuB6gF8TPrWUco9rX/ujPo+AriQX4b4BToss4EE34QQ6TSuUpFrnuZJimUlrYtboy5 xqFUUdbEzP9pjEsq4g6HepavU8scRj1x8mf8qtCzevJCJsbm1Vn6YBSkYTLE65Gr/u3i GaOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678063201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5TkEN34DJDutuRTHXFmA2vuNe5wTUw1X2Ctodk8NtTM=; b=s1svpw7u+glV5TBjet38ORrM3BH7mzOGN2a6iPRIcyinR5tmPaNLDlJ+CFyLcIBzIo dxOuOXJxd024R13POkIHs7hAWKb01KclrdB2S7WDDGpVHkiLwLo/FugL2SuqZ82VOPDH wvK+8TXIznQN3WK56tl2IwdPYYxJQS+bPBdWEQtPKf/NzVRz+Ran6vvemvNteqedimnn JxLESR9yVEBXRaFNIJvdvCpUpsbOEFKQ8JIyOjPBkC5o9ao2y9sljSqUEsVDZqTfKR/I dfV+yc0X9retZJc9kJe64iLhyJAz/jVdmbhelMUtrMtoYSdzhblu7MnAygqppNKMQn8i VmFw== X-Gm-Message-State: AO0yUKWVCDe/sln4InWWpOqGnRqNqFG1l+ul0d2lOxHotKwjU+XKn/GC gKkz9K6r5W1lJ0XQU8tKFM1Po7e3IU+rVI6gAVomPw== X-Received: by 2002:a17:90b:1d0f:b0:234:2485:6743 with SMTP id on15-20020a17090b1d0f00b0023424856743mr9274162pjb.3.1678063201362; Sun, 05 Mar 2023 16:40:01 -0800 (PST) Received: from stoup.. ([2602:ae:154a:9f01:87cc:49bb:2900:c08b]) by smtp.gmail.com with ESMTPSA id r13-20020a17090b050d00b002372106a5c2sm6567901pjz.37.2023.03.05.16.40.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Mar 2023 16:40:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Subject: [PULL 06/84] accel/tcg: Honor TLB_DISCARD_WRITE in atomic_mmu_lookup Date: Sun, 5 Mar 2023 16:38:36 -0800 Message-Id: <20230306003954.1866998-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230306003954.1866998-1-richard.henderson@linaro.org> References: <20230306003954.1866998-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Using an atomic write or read-write insn on ROM is basically a happens-never case. Handle it via stop-the-world, which will generate non-atomic serial code, where we can correctly ignore the write while producing the correct read result. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index deafcc7f15..b49fb0d754 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1831,7 +1831,7 @@ static void *atomic_mmu_lookup(CPUArchState *env, target_ulong addr, } /* Notice an IO access or a needs-MMU-lookup access */ - if (unlikely(tlb_addr & TLB_MMIO)) { + if (unlikely(tlb_addr & (TLB_MMIO | TLB_DISCARD_WRITE))) { /* There's really nothing that can be done to support this apart from stop-the-world. */ goto stop_the_world;