From patchwork Sun Sep 22 03:54:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174209 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1314687ill; Sat, 21 Sep 2019 21:11:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzX5lWKXfB0hon31eERyG5oOAEolvZ2ZwnpcjILnLkf3G/0yhoIwLlFvNxCY2UI7QgdwPvl X-Received: by 2002:ac8:4593:: with SMTP id l19mr11411322qtn.271.1569125499764; Sat, 21 Sep 2019 21:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569125499; cv=none; d=google.com; s=arc-20160816; b=j5aQKyPL05VGwbcRrPO9z6fJQ3keboXpxfGe6EqLZMTZ+2FWZjGyaLUlzOGZ1nGlHT CP+or1zt9sQUhBwE7RqS0ozDZ81HT8NDO1alfrHXwtGZSYKR8ms9smy2DsMycVVt3wXw +CZG1ZSSj0bAYozC8gC4ltIzBEKcaNrryW2ci/p5y14Fg3aL+Kua/jBj9I6vmJJRPJCb Q9sgUD7+oWd65U+aveUk3YPDmxdiDrD/XwkC0k9s0KxkkzjTIJAWZTxK7hL38StgFTqw +8IuHhw7DC01+fqQqjyPLVZH7qY4zCDt0ZLb9wIaYhZZKPCN0KFnD8wHyvtLK0d91//N r0hA== 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:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=zEd6YE2E51WcAYpdL1J80c/c4YK3movqIfz5U+RR1Wo=; b=U2thpP2WMkUU38GFYcYOAAebPD20qdYhom6EEr1hErC/1jGy4iqqin112lTU2l46Ij noAPNo/eNVTGHr3J0BQ4xK+YsEQv1PRpcNKQbHdxddWNJRxfuSipP2iRyfTxQPIzAqwG U2ZYWixuB7yj95rUipQ3ni6gUM/l7CJfHxsgRxb3wh3xf9vDXEiK74RUW2Nsz9utdJIE uyhAxjM6PlFs+DI6NUph2yxhmA9r1VgtSotS0jPjz9ZgIdAcrS3NhxXohxPNiaiZTjgJ hhikW2f/vCctFRPyoL7lKFa2Kr+O9JoFRep7iRe6S2yhe6Sgx1WPAK1tDo17cAsRwRUL 3mpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ahPTAEdL; 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=fail (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 b17si5595816qkl.98.2019.09.21.21.11.39 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Sep 2019 21:11:39 -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=fail header.i=@linaro.org header.s=google header.b=ahPTAEdL; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45093 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBtDn-0000ty-7t for patch@linaro.org; Sun, 22 Sep 2019 00:11:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40956) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBsy3-0001qo-Vo for qemu-devel@nongnu.org; Sat, 21 Sep 2019 23:55:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBsy2-0008KB-Na for qemu-devel@nongnu.org; Sat, 21 Sep 2019 23:55:23 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:45440) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBsy2-0008JT-Gl for qemu-devel@nongnu.org; Sat, 21 Sep 2019 23:55:22 -0400 Received: by mail-pl1-x642.google.com with SMTP id u12so4953598pls.12 for ; Sat, 21 Sep 2019 20:55:22 -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; bh=zEd6YE2E51WcAYpdL1J80c/c4YK3movqIfz5U+RR1Wo=; b=ahPTAEdLS/CFjPoKB2eUVHeIexGBLL6i3O33ZfdtOPD7FfG303LYID/k7GkUc//OIz jBycjRCZ7WSPvxjAhPYiv6rtS/95UqurvzUQdZjDhEyHH/Y2HaJfvF/iPDGOPIHCvufA Wah6xUW4IEBvExcBWZzJNEVbG8B89A+XaNgT7UHb7apmJ44c8VxyjHGIYTIQt91ofm9x Fk+pwxp75JT1qOrCQ6MoXgW1Rmpiv3sPw0wTRaPgwUCGD9xGdGBORN1Yt1mb2nRHUldj Djy611wWfxKDD56x7hxKhz7GGzjM3IiCEgcusSgaNQ+60QI4STU+NY8yH7JPBI09nyNc /cxw== 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=zEd6YE2E51WcAYpdL1J80c/c4YK3movqIfz5U+RR1Wo=; b=dKimr+AN18NfmZZb3DBB9m+91lrluLX7dhTJUW8az0IFo07vVKr+HjcJqHGGUNGJWJ Uqa0e3ufRHUYGh3J+K936gR0jxdm31Q8CJVSArNVSi9h4/U2h/Lcjzq5byr7FAQU8lDU je8kUPGhV3p6BRJJCbS9xaKx/Ie8DrXRHDyiI5smI5c8y6ui6d2EkgO2pnC8LftsbaLz ZOxH2xTdkv9M2gaPzvqoLexS5MHQ+I+YgHOUX8p846tI6JiJXx9gGpuF+Xus1qAVa0ls X0EqQS7dTLS4j21G3F2Rvfje8M3Cz1yMtNjzPniUMcAGTaMvvH+duQRiwV4Vb/oks25f pT8w== X-Gm-Message-State: APjAAAVhfv09eEf9z5jHTzMFlZFjJXj7Y8xjFV3pe0fLDNV0wJiM+PSC CPsdyH5XJ3CgBWO83iswXyZ5IWcGJKk= X-Received: by 2002:a17:902:a717:: with SMTP id w23mr3321plq.17.1569124521049; Sat, 21 Sep 2019 20:55:21 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id z4sm6452921pjt.17.2019.09.21.20.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Sep 2019 20:55:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 16/20] cputlb: Handle TLB_NOTDIRTY in probe_access Date: Sat, 21 Sep 2019 20:54:54 -0700 Message-Id: <20190922035458.14879-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190922035458.14879-1-richard.henderson@linaro.org> References: <20190922035458.14879-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 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: pbonzini@redhat.com, alex.bennee@linaro.org, stefanha@redhat.com, david@redhat.com 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. 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 6f685cb93a..6f4096bd0d 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1167,16 +1167,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_ROM)) { - return NULL; + /* Reject I/O access, or other required slow-path. */ + if (tlb_addr & (TLB_MMIO | TLB_BSWAP | TLB_ROM)) { + 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);