From patchwork Sun May 9 15:16:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 432869 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp2108142jao; Sun, 9 May 2021 08:19:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYE73V4BIX7DBnMxt2nxKWoCI4j7eVQ8zQJ9iIHArm9mXrbaYWVHoXk/Pr4ZkyZMEZ4sp9 X-Received: by 2002:ab0:2792:: with SMTP id t18mr17010860uap.1.1620573569305; Sun, 09 May 2021 08:19:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620573569; cv=none; d=google.com; s=arc-20160816; b=rumiJevdgLvDT6ut8bihjN7KPgI7zjPZdfs3S0Pwv5cVL1+G+GXkmtyd3TxxqydA8M 9t405g43hb+ySMnFB8xpLHTudQ2dDFq9KDmr0EiO/6mCUQ+06dcgfxwYv8sERMn0GuN/ 2Xm2X3rrfCmsaDVd5LV8gFk9aR/+SX4Fd9kAznnXRu0uF84VTqBpJ5dec9WFp7xK3r2i iQwUuP6gOM5hxFAg6LmR+fQiDlmixZRyMTSUFiLVd/UIM/Vt9NCXGO3tCXTwCSWpvmAB jrAh4WYSYAWriM8t/iiVZL+aX2QOg3cNFQidqbchVQotUCO8f280h3uewZyQ30Rj+hSS n6JA== 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=3bnpttYgG4ezXee8lT9HJOsRveBPtRPILa4oFFuqprE=; b=Ca+js8+XOHRKkWpJdxZc4t11njYnqyVIDYkU6Vr7nm/HRwI1uOkKigRnInAhuy3kqv 2w1YYT6EzswF9MqUSWA6ppyNXC/Z7dtzA6TYvval/caDFPXxdxuBSyta+591inB2lzIC amRZz3BiaMRkUkk5kC0UVDnq0WY/KdueZXk46E7m2PMOr/nJxqmabP7m5PVf1QxPjoE3 3dS+8HlDGTZBPPi9HkdtXzs8uG0frZ4Jl0FCToxP65bWLGVx27qkjwV5wi80ySLtqEBv u7f3E574+fSuY8oKq0UUeQjykFhplTQkpg8/Z8/k5y9irzpnCmxN/az3+ReDbGmgtala Yv1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=osc5IKhW; 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=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c9si5996851uak.127.2021.05.09.08.19.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 May 2021 08:19:29 -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=@gmail.com header.s=20161025 header.b=osc5IKhW; 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=amsat.org Received: from localhost ([::1]:56590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lflDM-0001Ac-Ld for patch@linaro.org; Sun, 09 May 2021 11:19:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lflAq-0005Wf-B3 for qemu-devel@nongnu.org; Sun, 09 May 2021 11:16:52 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:34460) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lflAo-0005V9-A6 for qemu-devel@nongnu.org; Sun, 09 May 2021 11:16:51 -0400 Received: by mail-wm1-x332.google.com with SMTP id u5-20020a7bc0450000b02901480e40338bso8518150wmc.1 for ; Sun, 09 May 2021 08:16:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3bnpttYgG4ezXee8lT9HJOsRveBPtRPILa4oFFuqprE=; b=osc5IKhWZlmxnjUqS3ynEKiJ9ZLjdsnW1rXo0iuLcadDx16EkixhiG0SoJprl+cfr7 1YU3nGqcj2KXRTSW4SVXlsYSLi7UCoT0OimNnrubfEhJyBNS9uK/f5wH2kHATKbFykVu vTqTV5LP6TOPfI4uVJ4XNwdVFE+esK1Z/Kc6k1AQoG+ddZnk72LDrU5ljwuybbeP6M6t JhkyvqyhWwyXz5Odl6Wuqx4XvpiDpMAMsC+ZQBV5Q1J5A4foPMKNoNzel/85TfjrdY0+ LUCJ3xRS6BOODV3QyLL8XDtVk+jXug+jvZsYEuD2oANhDDU9YykduwtNO5UbDdmlgRez 1l5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=3bnpttYgG4ezXee8lT9HJOsRveBPtRPILa4oFFuqprE=; b=ZZklmtYsoRyMOWP10PZ5qWs30FRbgU+NfyG8fA7KYyjpgODC2fUFJL6Bo6FFZxTn9f oVpQFbNDKuuYs+84YlEKKPapsviVXzSBEEgzzoHjhVCv69TQCBGVHRNt1AgWzK/kJGLz o+V9N6sS7bCvSud/Cq58HvSrMcoNH5+XyEMHIgaw6+XjzQJJ7b8eAgcS0ELDmlJl81ye fM2U8bjBTMbMx5aH2YddMprwOioGVpsEUk+QBx01BJKI4Pev2PlhYzu8GPoFXK+mXyxA Qh360VWb216dsqVTuX0Opm0YJJ+oGBvTccIGqF4OWQSBpQDDDtMWgibg5JImkdGmJU8O rw1Q== X-Gm-Message-State: AOAM532awvyZ8agQiz7wKcwQ69/a1rZ5gW9UMZGXrn+MQA9GjGSiQS35 nXtUaVz6TUi7EWQ1PToAjhE6BPtSWO+KM9XE X-Received: by 2002:a1c:ba86:: with SMTP id k128mr33043298wmf.65.1620573408866; Sun, 09 May 2021 08:16:48 -0700 (PDT) Received: from localhost.localdomain (39.red-81-40-121.staticip.rima-tde.net. [81.40.121.39]) by smtp.gmail.com with ESMTPSA id 3sm15610156wms.30.2021.05.09.08.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 May 2021 08:16:48 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 6/9] accel/tlb: Add tlb_flush_range_by_mmuidx_all_cpus_synced() Date: Sun, 9 May 2021 17:16:15 +0200 Message-Id: <20210509151618.2331764-7-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210509151618.2331764-1-f4bug@amsat.org> References: <20210509151618.2331764-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x332.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: Paolo Bonzini , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Message-Id: <20210508201640.1045808-1-richard.henderson@linaro.org> [PMD: Split from bigger patch] Signed-off-by: Philippe Mathieu-Daudé --- include/exec/exec-all.h | 12 ++++++++++++ accel/tcg/cputlb.c | 27 ++++++++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) -- 2.26.3 diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 9a3dbb7ec08..8021adf38f4 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -281,6 +281,11 @@ void tlb_flush_range_by_mmuidx(CPUState *cpu, target_ulong addr, void tlb_flush_range_by_mmuidx_all_cpus(CPUState *cpu, target_ulong addr, target_ulong len, uint16_t idxmap, unsigned bits); +void tlb_flush_range_by_mmuidx_all_cpus_synced(CPUState *cpu, + target_ulong addr, + target_ulong len, + uint16_t idxmap, + unsigned bits); /** * tlb_set_page_with_attrs: @@ -397,6 +402,13 @@ static inline void tlb_flush_range_by_mmuidx_all_cpus(CPUState *cpu, unsigned bits) { } +static inline void tlb_flush_range_by_mmuidx_all_cpus_synced(CPUState *cpu, + target_ulong addr, + target_long len, + uint16_t idxmap, + unsigned bits) +{ +} #endif /** * probe_access: diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 5314349ef9d..bc4370f4e21 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -924,16 +924,20 @@ void tlb_flush_page_bits_by_mmuidx_all_cpus(CPUState *src_cpu, idxmap, bits); } -void tlb_flush_page_bits_by_mmuidx_all_cpus_synced(CPUState *src_cpu, - target_ulong addr, - uint16_t idxmap, - unsigned bits) +void tlb_flush_range_by_mmuidx_all_cpus_synced(CPUState *src_cpu, + target_ulong addr, + target_ulong len, + uint16_t idxmap, + unsigned bits) { TLBFlushRangeData d; run_on_cpu_data runon; - /* If all bits are significant, this devolves to tlb_flush_page. */ - if (bits >= TARGET_LONG_BITS) { + /* + * If all bits are significant, and len is small, + * this devolves to tlb_flush_page. + */ + if (bits >= TARGET_LONG_BITS && len <= TARGET_PAGE_SIZE) { tlb_flush_page_by_mmuidx_all_cpus_synced(src_cpu, addr, idxmap); return; } @@ -945,7 +949,7 @@ void tlb_flush_page_bits_by_mmuidx_all_cpus_synced(CPUState *src_cpu, /* This should already be page aligned */ d.addr = addr & TARGET_PAGE_MASK; - d.len = TARGET_PAGE_SIZE; + d.len = len; d.idxmap = idxmap; d.bits = bits; @@ -972,6 +976,15 @@ void tlb_flush_page_bits_by_mmuidx_all_cpus_synced(CPUState *src_cpu, } } +void tlb_flush_page_bits_by_mmuidx_all_cpus_synced(CPUState *src_cpu, + target_ulong addr, + uint16_t idxmap, + unsigned bits) +{ + tlb_flush_range_by_mmuidx_all_cpus_synced(src_cpu, addr, TARGET_PAGE_SIZE, + idxmap, bits); +} + /* update the TLBs so that writes to code in the virtual page 'addr' can be detected */ void tlb_protect_code(ram_addr_t ram_addr)