From patchwork Wed Sep 25 18:45:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174416 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1031820ill; Wed, 25 Sep 2019 12:02:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxcyGloCqDBrIT2hvzL+lJGSvyaG4IX5xweF0FzMWlcRpZay7NxRlapmkpWZEefHTzSlZX+ X-Received: by 2002:a5d:52c8:: with SMTP id r8mr11294422wrv.256.1569438132473; Wed, 25 Sep 2019 12:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569438132; cv=none; d=google.com; s=arc-20160816; b=yQ3yOR9uoUcJZ3XGNuH+6194DDNGHRRMK4euFz8xW5MRBzZbIMW7Zc6nY6I1ffxB0t rEEH0jlDpVASiaPCmDk3SUTA9Hm92QbsN8eAgDlxkpXDNDYr66ddZ0Q7Yg0mEtycXZvC xinjVpnr89UbC6KkYloSC8j+5oy8trvVt4IvcHDMhP1oRrir15TUFImqpfDhgy0ZD9M8 7jD+UGRJv99Nrr9wMqWclr8/ZM9VYgtViQJOxnIi/PCSwSdUH8ecOTLDY6r860UR9yhN AMBZ3gSuDyhp6J5q94mfq2WfvzaN2n8osZFg/t66A4WBNwWr5g7MNZf+PuhovAlpYgav dRYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=yAC6RG3wvhI3H3mXOjF1M8pzwn6maoZxTmCA0mspbiE=; b=TztQ/QnGh7V8TI1qhjQFGddYMSQRoJjYbd9IY9v69vPxdo0NdEhvuShKMcCNOHFI6f GHQJUr0W0GWppd/OY34BCCAUs4csEE5EjqhPiKQi19tnbOE2Wg/IGkc3iq61pcfZN6fJ LhJ9rxa+BJgU7cp1VtRIXPqB/bDuS/QsrnYwzqAQZ9ZHuzWz8Jo+4x6FuyRHUplAI98I JcwNBPv8UOOMtrVv39wn+biiBnU5wInNEWVb7zMXoc+Fo8bVqlKYJIYEiTcvfto4MGhN ng2ovBfuxQ1wSytRIDH1YW5njiLV3liqp35WR9C0c7BRZmYoaaAWyqJg9lTx8l6n8ncc FAYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="j8sr21E/"; 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 g15si3747849edm.349.2019.09.25.12.02.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Sep 2019 12:02:12 -0700 (PDT) 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="j8sr21E/"; 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]:56248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDCYE-0000zD-F9 for patch@linaro.org; Wed, 25 Sep 2019 15:02:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47196) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDCIk-0001u2-LN for qemu-devel@nongnu.org; Wed, 25 Sep 2019 14:46:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDCIj-0004OP-F0 for qemu-devel@nongnu.org; Wed, 25 Sep 2019 14:46:10 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:44244) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDCIj-0004NZ-5J for qemu-devel@nongnu.org; Wed, 25 Sep 2019 14:46:09 -0400 Received: by mail-pg1-x542.google.com with SMTP id i14so142992pgt.11 for ; Wed, 25 Sep 2019 11:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yAC6RG3wvhI3H3mXOjF1M8pzwn6maoZxTmCA0mspbiE=; b=j8sr21E/7b0HcIha4bK+txI5RcHSDB5hgO/mBCmw9C01jPpwe0EJhDMezWYD1nSHxN 45k4cZSLyb5qnB2D2+F4z/1u3LSe5S7AndiUdnxMEKrjyTdlG5tCp/Yrdhf77uk5jpxH brqBILK9azxYj9SPKlfbAuFlWRre3WYTw6usQ1/x8Wf2js9amISDTvgZUxXJznwq85mx 3/3X1VHHAKMoG0PQJ1WNotV2+YxUYqoxFGSbDBISLaqn9fWWb/QiWkJIiKIKQNwIZetf Gsv8xruh1O/yvbYo+zpLlG3FpD42CZsSVvHOasjKL7uNWe/T3G8G3yAmYgwG/zgaGhqG 4KXQ== 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:mime-version:content-transfer-encoding; bh=yAC6RG3wvhI3H3mXOjF1M8pzwn6maoZxTmCA0mspbiE=; b=FPKYXiX8jjAWTEfVgpx86SA2s7obenYhsCuhV3YO6bhyKgT/sk8WDD1f5cVTLD8uzu PkXt+LKaStqKSre88DAq6ANoUbZexrEoJOmVGpeAG2ymIsYtf0CcJx4sz0OAjb9X994j btewq79a/N7DRooTw1yO7EJTy8KeLLdNeWmP2ZbWL+7qF9DRNpBJFXU+0mBCGsW9ZR/0 50VSHvJy6FXcFzidxX/29yx3Qa2lf67WuoNexnub5rCulGJl8nH+Y/tNgnnAKOaEYxWg YnGat2oVLBgKKXaEnKKH6cuYc4eHkgjPgl2nNw0Tx881+uf4C2VFhseSJVXqe54KeSbO TDow== X-Gm-Message-State: APjAAAXAo/iKgaBfRYYKx51koWpaq4EBD7YrMZkAPIRy4gSkv2oOFCpe NwMvkB578fQJo53dmPhEGqq5JUbUcII= X-Received: by 2002:a17:90a:b385:: with SMTP id e5mr8169741pjr.91.1569437167666; Wed, 25 Sep 2019 11:46:07 -0700 (PDT) Received: from localhost.localdomain ([12.206.46.61]) by smtp.gmail.com with ESMTPSA id l24sm6133229pff.151.2019.09.25.11.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2019 11:46:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 12/16] cputlb: Handle TLB_NOTDIRTY in probe_access Date: Wed, 25 Sep 2019 11:45:44 -0700 Message-Id: <20190925184548.30673-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190925184548.30673-1-richard.henderson@linaro.org> References: <20190925184548.30673-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We can use notdirty_write for the write and return a valid host pointer for this case. Reviewed-by: David Hildenbrand Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 3e91838519..b56e9ddf8c 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1168,16 +1168,24 @@ void *probe_access(CPUArchState *env, target_ulong addr, int size, return NULL; } - /* Handle watchpoints. */ - if (tlb_addr & TLB_WATCHPOINT) { - cpu_check_watchpoint(env_cpu(env), addr, size, - env_tlb(env)->d[mmu_idx].iotlb[index].attrs, - wp_access, retaddr); - } + if (unlikely(tlb_addr & TLB_FLAGS_MASK)) { + CPUIOTLBEntry *iotlbentry = &env_tlb(env)->d[mmu_idx].iotlb[index]; - /* Reject I/O access, or other required slow-path. */ - if (tlb_addr & (TLB_NOTDIRTY | TLB_MMIO | TLB_BSWAP | TLB_DISCARD_WRITE)) { - return NULL; + /* Reject I/O access, or other required slow-path. */ + if (tlb_addr & (TLB_MMIO | TLB_BSWAP | TLB_DISCARD_WRITE)) { + return NULL; + } + + /* Handle watchpoints. */ + if (tlb_addr & TLB_WATCHPOINT) { + cpu_check_watchpoint(env_cpu(env), addr, size, + iotlbentry->attrs, wp_access, retaddr); + } + + /* Handle clean RAM pages. */ + if (tlb_addr & TLB_NOTDIRTY) { + notdirty_write(env_cpu(env), addr, size, iotlbentry, retaddr); + } } return (void *)((uintptr_t)addr + entry->addend);