From patchwork Mon Sep 23 23:00:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174232 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3405294ill; Mon, 23 Sep 2019 16:09:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwM995Tq5BI6tN0r8F/QS6ecm25uJZGA0zyW8Fjee5QuMjJj9jtHVkyjvdE7wNnH14lMTEP X-Received: by 2002:a50:b6c8:: with SMTP id f8mr2688016ede.33.1569280157311; Mon, 23 Sep 2019 16:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569280157; cv=none; d=google.com; s=arc-20160816; b=083zzn357zYFzWdaAgRw5IQ1JauAnD0PJpwKeVhHw8h87+JlWr+qQzPQxg2atocFZk o8OjlsfM21+mGCFxwg5fLL/tKJ5ecw7Unc8irtEX9IZ7phVINZxovgc3RdHVJpNE0PjQ fT3lZCT/px8R564s7HPXU9k4Z1SbExwi1y93Icb9RzawjKBI7XkddUt5GrFd0L3F3RWO VamHNZn8ceNuRM5BUZbzPr9nv69poUT+NGnyDwVk5aFRO2qTSrJwvHz4veUWjLjwJU+u ca3rgNJIbl4P2MVgI+T9NJulKUwByBW9uC1Oox6gFco7+ZwDxGtkgxNGfdPA/ZCNH1Lf ee9w== 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=C7NIKJXdUrtrKzRhohggBciUBf2QS9tq3iex/j818EA=; b=qL1xcYpkPIZFXYJzhNcVs2pdaT0A00ti4ngLa9vU8tNNdcnX/BfNMtCchEeyWQ2W5X /186QT7itBsKVELKM1o7/l6x441ETIWHJ5EDsgS+n/MMZA3DjpuVwMO4o5tehbPNt4dG 8p8DMf7tdB23txrqipWO4mMFU5fUndyOlf/5b+w4jE38Z0N+i9xOop8/Pnq7GBrtId+L GRlrnN8Rx9BxRZsd9VhrcJt83ORTyixJPNpVkR/0gzjsQqftNIGqtXOE5sd0Rd0V4ALY YZ8Cn3RdPqdwLI/iHfU0sIBc+GgSWLTZG+eOtzkthFTEhj9ybVSke/Rj6NPClbB2DPOy B3AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=oNk8NQ93; 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 m10si5652898ejx.96.2019.09.23.16.09.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Sep 2019 16:09:17 -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=oNk8NQ93; 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]:37130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCXSF-0003iz-Q8 for patch@linaro.org; Mon, 23 Sep 2019 19:09:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35883) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCXJl-0005hS-Eq for qemu-devel@nongnu.org; Mon, 23 Sep 2019 19:00:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iCXJj-00088E-Gt for qemu-devel@nongnu.org; Mon, 23 Sep 2019 19:00:29 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:43647) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iCXJi-00087E-Ue for qemu-devel@nongnu.org; Mon, 23 Sep 2019 19:00:27 -0400 Received: by mail-pg1-x544.google.com with SMTP id v27so2796262pgk.10 for ; Mon, 23 Sep 2019 16:00:26 -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=C7NIKJXdUrtrKzRhohggBciUBf2QS9tq3iex/j818EA=; b=oNk8NQ93dRplDNU8a9jkYUOIIxsXsPUMhFGjWWuc407ONzGPNoNTodmO2DzLhQicbN v5CJHj5fPDGfvkmJz9U4UfjQfJ32OfJQwTZ8IKErbXE2ktI6xAKdy+eEvEk86jOfUFBH pDTPqHiCdErH2f3cJc7GtLZCYtpB4VzzTHgMXK4xpJeluNOOR7Av14DgS/WsSQKHa66/ rESxYrhs+T9dFoz29/0buSMwgVM5MlZbv8HWCj62/xMx392zlD7y9P/mr7iyeCYqeaqz yGjvWAnsF36htFkXov4pujX78aU650ps4l1I30zylj9rUxGinRs2qf+0dq5Lxi3Hqb5D Nr1Q== 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=C7NIKJXdUrtrKzRhohggBciUBf2QS9tq3iex/j818EA=; b=YfQugzycTsdkc9TrNC1xIjZKAzV/GtfPhWFNuyMrR3z3xkIxn/DRljo5eP/sfu531Q mkg1ZiXKcl2aQzdc+hnJgdODbGBUhqBPWIL/qrmtTRKkf2F5NCx6dIOke/K1oTjwkCJE HuQXcAzM/M2AKtbUlMNOIKxCanfFw6gyoqgS9dNKp/iQzxgrjydByX4I+gwIjYvJXkN9 ueyktJ1kqrQ3fLybgoLmco/Qc58U1gEHwVTWEnnqyYyY21A/jcg/NgwmDXAeQhMPhTTP DCGmytyYcn7acim5hwRULgdFtYF7F/P30a512yaygmVzLad5Zlhp1ZQJlPtTZbaYqrl5 w25Q== X-Gm-Message-State: APjAAAXsqtFvJfACtmzVZuZBl94MpxeHPSLJeQkpKI8FbTXBi6nzgZEw Lirg93KoLOe1MS4mU6/25Em1kqZQowc= X-Received: by 2002:a62:3147:: with SMTP id x68mr2125356pfx.129.1569279625122; Mon, 23 Sep 2019 16:00:25 -0700 (PDT) Received: from localhost.localdomain ([12.206.46.59]) by smtp.gmail.com with ESMTPSA id 74sm11674810pfy.78.2019.09.23.16.00.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 16:00:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 12/16] cputlb: Handle TLB_NOTDIRTY in probe_access Date: Mon, 23 Sep 2019 16:00:00 -0700 Message-Id: <20190923230004.9231-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190923230004.9231-1-richard.henderson@linaro.org> References: <20190923230004.9231-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::544 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 Reviewed-by: David Hildenbrand Reviewed-by: Alex Bennée diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 09b0df87c6..d0bdef1eb3 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);