From patchwork Tue Sep 3 16:08:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 172838 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp71263ily; Tue, 3 Sep 2019 09:21:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxaqhK2Dm4U9cD9NJfHQT81vrcCYPNrvFTUvU/c3kJr84QGiPFOCmkFscn7Af5acJQz991x X-Received: by 2002:a17:906:4d4b:: with SMTP id b11mr10449199ejv.0.1567527714554; Tue, 03 Sep 2019 09:21:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567527714; cv=none; d=google.com; s=arc-20160816; b=yQMJAGoFjA2Wzv0GgIx07PrMrgxD+oKKKm/h292zJxTqhxN12dILaK9BAGsK/xG5Wx GMan37PYbJyaa7IkyClfPjfHenXn/vIIB/0qqKl7xFpyoK25fBfie/g0mQrh4ZMmTkrO UzsHDaWD+3DvksRoqFwVZ/bHQpNkYijlaNNnj0RESbBcsKv7U/cxFiCNtP26oEvYqGaz G9/2q0YXjgcrw3LeKihUtlFSpoCZbEh5IddUZfUo9FZf/wsKS3oXhiwCgFH2bjAsLr0p OU2hm/pD8JyVmKKgVwB1LV4kidVx4vr1vjdroFTXSheh6Glkh5dBn2nxR2TF2e/vVqte yRmw== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=bqopH4IHC6JwFjvyUE21txeIhpfHSXwxJEKmWcLZGEA=; b=TuYQ2qMudCSXbajAzlvLWcf9sNUcLQ4JT8rOiVoVTnQgL9GmUsPe0Z3JyIpKbnluY7 ywlzmJsH4QWkwyDZhnsCpwX19xhca1ObNLjCz84LOB8uwaRn3EiEZ01qTS4j9lG9tTO+ Y2sycarkl6EGVJfkZtPA9vPtwMXpY6dArmlxHHMqn+bnTRmJp0zHySZQuiSHbAgQrgfP i8UJSdlp6zh5CCjd5l5pLSue0v7OjOqqdQgLt0vY4//iN7lf4FKZEJF1aN8Q3ZFZfDra xAjVu/H5l6z4QmnrmPy6aZClQzMKXXwzxwakDXqwpjsl2LLK7GNu4wydWA36HfHpj2v+ Pvpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="hCG4En9/"; 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 h6si6534363edh.114.2019.09.03.09.21.54 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Sep 2019 09:21:54 -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="hCG4En9/"; 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]:48738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5BZ3-00049r-1G for patch@linaro.org; Tue, 03 Sep 2019 12:21:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37374) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i5BN6-0001TV-Tz for qemu-devel@nongnu.org; Tue, 03 Sep 2019 12:09:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i5BN5-0003vT-Mk for qemu-devel@nongnu.org; Tue, 03 Sep 2019 12:09:32 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:44929) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i5BN5-0003us-Gb for qemu-devel@nongnu.org; Tue, 03 Sep 2019 12:09:31 -0400 Received: by mail-pg1-x543.google.com with SMTP id i18so9387529pgl.11 for ; Tue, 03 Sep 2019 09:09:31 -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=bqopH4IHC6JwFjvyUE21txeIhpfHSXwxJEKmWcLZGEA=; b=hCG4En9/lls3POlFLDUIBv+WFRva2oYKDZUEkbP38DxL3jMVR270pJ8bERazBDsF8o ylzOvrw2Ixl3Pv3ZpZ1oURxynJR6Cu6Ge7d2tzTWeSoPYyDwbPurXWySG1G4y6AeoXbO hL6PpiWLpbyCPDpIhxfIIjIbDo7ljv6hS2GgkQ8s30VKC/Ww3ZYmANjKhhu4HLxAtUvX NBtjmpID1wTFA4E9SKQjWcBvKBLe8kgHW/V9gebkcff82wVX6wDw3hKJOLz2oH2TUTh6 hsQLKYvEJJxpurZQIhltFh7Zcn/1ODYLfHJCwmltvixGXwOh/ZZ0TujqM8nC6fXtDP2f MnTw== 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=bqopH4IHC6JwFjvyUE21txeIhpfHSXwxJEKmWcLZGEA=; b=P3ulD6FhDkdCBKvrdqI1XyJF9+V3bAn3Pm49TExChpOAaFQXj4sm8IPIAgR1IrIZUb 0Y9OwKMr03nHOP2lKamYP188CARIKH5x+Pmc1WUhx6IIZOyTuhsszYVQshZq60aLH9QP YAn/aJ0+E5tN4u5ebmuEE6+arIAcK+YNxu+WydxjgwY/CX7oI5WPjy6awhs3klZQWOzQ tHKIWkW8zNRdgagXh3Tq4L/waEjjZDsO4KG5FqBWIh2V7teBOPcyRWqpmRqTRerwaK3p BgTTMaL2vsmiaYJ1eEqSpeETHPtaPGlsYXrQOxnvJxWTmjw/Gfqy0p2yLZo3fUTJD4qI XdBg== X-Gm-Message-State: APjAAAUMS3idBYIQ+XDpN+vtOwPNpGWO8wfZk9Syof+iyipI9JxF+xeg efB1lS0UQC52i+n+gvL18B193piLe0E= X-Received: by 2002:a63:e20a:: with SMTP id q10mr30395763pgh.24.1567526970256; Tue, 03 Sep 2019 09:09:30 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id 127sm28089711pfy.56.2019.09.03.09.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 09:09:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 3 Sep 2019 09:08:46 -0700 Message-Id: <20190903160858.5296-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190903160858.5296-1-richard.henderson@linaro.org> References: <20190903160858.5296-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::543 Subject: [Qemu-devel] [PATCH 24/36] cputlb: Fix size operand for tlb_fill on unaligned store 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 are currently passing the size of the full write to the tlb_fill for the second page. Instead pass the real size of the write to that page. This argument is unused within all tlb_fill, except to be logged via tracing, so in practice this makes no difference. But in a moment we'll need the value of size2 for watchpoints, and if we've computed the value we might as well use it. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: David Hildenbrand Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index c9576bebcf..7fb67d2f05 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1504,6 +1504,8 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val, uintptr_t index2; CPUTLBEntry *entry2; target_ulong page2, tlb_addr2; + size_t size2; + do_unaligned_access: /* * Ensure the second page is in the TLB. Note that the first page @@ -1511,13 +1513,14 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val, * cannot evict the first. */ page2 = (addr + size) & TARGET_PAGE_MASK; + size2 = (addr + size) & ~TARGET_PAGE_MASK; index2 = tlb_index(env, mmu_idx, page2); entry2 = tlb_entry(env, mmu_idx, page2); tlb_addr2 = tlb_addr_write(entry2); if (!tlb_hit_page(tlb_addr2, page2) && !victim_tlb_hit(env, mmu_idx, index2, tlb_off, page2 & TARGET_PAGE_MASK)) { - tlb_fill(env_cpu(env), page2, size, MMU_DATA_STORE, + tlb_fill(env_cpu(env), page2, size2, MMU_DATA_STORE, mmu_idx, retaddr); }