From patchwork Wed Aug 28 23:16:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 172509 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1419788ily; Wed, 28 Aug 2019 16:20:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxk4WYJym2JUQpAZYYCHK0XVerQ78v9ETvlTEVUk7HkK4v/ZIngNxcUIRRY06SgimL0X28f X-Received: by 2002:a50:f412:: with SMTP id r18mr6868877edm.47.1567034459143; Wed, 28 Aug 2019 16:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567034459; cv=none; d=google.com; s=arc-20160816; b=y9olJdN9Ri/pkNLmysODmOAX4KCsyUYSl8Mt/pw82++2FEF3JLbNB1JfG6m6Vejkdn VpvktM7TNKNI3tr1C7oTwUeiIiVXR4X9eAtYgxBl3ce8QMV0XXX5XlPYzn4q4YwF0tTL 5xZ47lVcCzdREDPin705Ls2XwJc2OMhz6Cz3ZFrFApkkqItRXJuIHyUWn/2MQsErDSV+ SacRMXzYWBSvOQnmyFS+jF1ZG/os05zseCWTmpWEdhaokNN0UtaXrDWS7ijxqWZKAoF9 KLa+C7toUBDhBGHlRBQobRtpUy4ZhPj6wmr+VncyATbeH7D1Bv1KzDkElnvDXOLyNOju LDEA== 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:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=g2Ys6FT3dAIWRm2+sxUDBYBh9aclrTTCcmC9pqtLRPs=; b=JA1ZQUccikbMq09HKDxxTjGBHIiiEsCMfv8tWr0T+HrVduBsckVk6xDOwiF5TQqPGW ErtJ/qOqoi6lZNb8x5H6bd9xweQTii9V8/FaRb7px3Up3Ad5//DdC8UCDYhi4yVbB/kf 1GSP0K+d51qKqD8XcfznWPl78+SiRYxcN7Cgp6Nt7SGDty8LjzWRRwHGKX0o/JnRTCWw M0NzdrIZcKjJdWOC+7rp0gfYvyRKsGzOzhRlz0vzdUGfqYl/bzeMMY8EXAMn2UM/iMYN VstNrTHLIzfZU2APJaeqlN2vCBff2NfavLR+Ggils6X+f698Jz9G4D+4TLDHPAmsn4Rk b2qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="STphK/P7"; 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 w2si251240ejo.94.2019.08.28.16.20.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Aug 2019 16:20:59 -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="STphK/P7"; 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]:43642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i37FJ-00082e-Em for patch@linaro.org; Wed, 28 Aug 2019 19:20:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52327) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i37BW-0004EM-6C for qemu-devel@nongnu.org; Wed, 28 Aug 2019 19:17:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i37BU-0008Ga-My for qemu-devel@nongnu.org; Wed, 28 Aug 2019 19:17:01 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:34188) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i37BU-0008GK-HL for qemu-devel@nongnu.org; Wed, 28 Aug 2019 19:17:00 -0400 Received: by mail-pg1-x542.google.com with SMTP id n9so527977pgc.1 for ; Wed, 28 Aug 2019 16:17:00 -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=g2Ys6FT3dAIWRm2+sxUDBYBh9aclrTTCcmC9pqtLRPs=; b=STphK/P731J0GmYktFaMQOTVo3Pflb9IUOw8II6nZn6jbPbD6UKAZ3OWJrb4oo3Ve+ y/bZALj+aPVbczYOkNHDntHtdUhLS6HHb9Pdblrtdzb4wXtffLaFW/E2moJ/fm99xIZ6 LeGeT1xZm31FxGtaWJNZ5yaVT5wuux56zhdBmAR4XuWUcj2j5imCTvmgX4hVWrhZ1RsE d9ekp8cvrKOMhnHR5L9kvtIogAeU3Fe2+NSNKbXjXPF1nv1SOmS0mo7psfCa5XVDEjZ9 fnB57d2H0nLUrfsGU6TR2wuQiX52JJxQNlK1PlWbTl1bs9wus/4tHfB0jO+ctPHY3Eud rZww== 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=g2Ys6FT3dAIWRm2+sxUDBYBh9aclrTTCcmC9pqtLRPs=; b=DXUjKYw+GskDLpbb4saDFCIwuEJ5xWezQSp06WHP2oCGIIu+sHMoCe3ac58ACnPTw3 efbh8sr+KPLjAHDkl1X4YTJS/SLS3fwwWBy/3L5fQQwE9otPTD7pSRmcKsCoLpUEMOCQ Lq7bZ9RWHbnn3xqHXxrC/XrogL7hEG8Pe6F8a4EROI6LZsfoEwjxEE7T6Q1OTJO0vZAO 5qkh41/16K48BT149FoN8WT/8bx6MBYWOeVdHqPhODhlZeVEZcO0Q44UgDJEUAYPI3QN efe/cIStMzGmjrlWsoEYxSkoou7M/0VVc38yYeJIJTrQP204K/ngbGCwMOh5Ie737YSc /99w== X-Gm-Message-State: APjAAAVdqwN27r4f+p1h9seTeLMOEGJIZy69RbGdLFwl3jRi7LHOC+sB aXTS7aLoZVnFMa29yvNHq+yB0IM0esY= X-Received: by 2002:a17:90a:f011:: with SMTP id bt17mr6700083pjb.21.1567034219275; Wed, 28 Aug 2019 16:16:59 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id s5sm485197pfm.97.2019.08.28.16.16.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2019 16:16:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 28 Aug 2019 16:16:48 -0700 Message-Id: <20190828231651.17176-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190828231651.17176-1-richard.henderson@linaro.org> References: <20190828231651.17176-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::542 Subject: [Qemu-devel] [PATCH v2 5/8] 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: david@redhat.com 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. Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.17.1 Reviewed-by: David Hildenbrand Reviewed-by: Philippe Mathieu-Daudé 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); }