From patchwork Wed Oct 31 12:21:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 149787 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6723643ljp; Wed, 31 Oct 2018 05:24:58 -0700 (PDT) X-Google-Smtp-Source: AJdET5f5shYuNM5jerRMo0+I1Qj+ok/7I+x7YPBk2hECfL7umGGp4Lwcdr/IlODIXxPmQqmUqlfs X-Received: by 2002:a37:848:: with SMTP id 69mr2261110qki.351.1540988698871; Wed, 31 Oct 2018 05:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540988698; cv=none; d=google.com; s=arc-20160816; b=Lj8gbcPgAylOYjkOLWp3fzwWwiKXdKCQep8oTSdKoS5x+MHtY/Et6U3wpNky8QGRHx rcg5UQ59FuJrkswZHPJ/cm9F4nQfgGOjqJPS8KxhlbnCpjh/nKKqLyTCB9quuP6b3Bek 9dXk6AHbenGSW9oubX+Vg8rQC0ZnwuGEdZrZxYpkEYn4ZAawIU+YZmsh44CrcGFt8tR9 h0kZZ7Mc5IGXIJofhTLQnxZSrmbCpNG7vtD9wcp0xMOK19GFSGpufwwlsVyThkV7wT34 HVDoX6KsqiP75f1h4fOXpFnTe6yWvU5JaVbYKsp6utNgDHKA6+F2VP+6Py0Owci0DPDV uaaA== 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=iiRxAviPMuTcYzXAmFgo793fKjEXoYsNIFm3NNqKe4Q=; b=SWqMN/AUHj5RCdhUcG/gme6jH6J4eU1WinCaBxgy99WXdA5oidmnYj/awXq3TvW2Lx 9rscIytRhev0C+2bzvXOmLajXhKzJwaPmfQl3Knwi/Py7CXamwXiLHeZ0+PYK6DVegQ+ eg4ROuL0XpEH4PbqModJQJzofc1RYTVGA+xLX+nxB27dbQ2Jc0KF6PKQZuuHcl8vcEM0 q+ATEyCzsMI9IEXZrMbq74YAnYpnpQ4jLAyOo40xY6d87iz3p9GDbrvxEJiPaa4LUUJL ERXbbQzOx0nsdmw0UhErUAmgQCyfy4UnvrS8T5c2OKjvXUU3mjZdav7XSd8f3QEw8GxU ofrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JLbIIsh0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v12si713106qve.43.2018.10.31.05.24.58 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 31 Oct 2018 05:24:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JLbIIsh0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:59150 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHpYQ-000386-AT for patch@linaro.org; Wed, 31 Oct 2018 08:24:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHpVe-0000nx-C9 for qemu-devel@nongnu.org; Wed, 31 Oct 2018 08:22:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHpVY-0001mb-HS for qemu-devel@nongnu.org; Wed, 31 Oct 2018 08:22:04 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:37339) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHpVY-0001DF-98 for qemu-devel@nongnu.org; Wed, 31 Oct 2018 08:22:00 -0400 Received: by mail-wr1-x433.google.com with SMTP id g9-v6so16240633wrq.4 for ; Wed, 31 Oct 2018 05:21:28 -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=iiRxAviPMuTcYzXAmFgo793fKjEXoYsNIFm3NNqKe4Q=; b=JLbIIsh0VTYqWjaN8IfUQwdBnvmmtfknDb0tEk+uArY5l1dGXO4a85VR7dEXDkXcEQ RtSVI5Qz3BMXt1vuO2aF5dHWgbLAv6/eLquH9sSeCApuNtK+Vavi4+w4a2Cy/MlW+6LO L/49cz07+BDIdci+7nJzuZjijhLcH82m9z/5w= 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=iiRxAviPMuTcYzXAmFgo793fKjEXoYsNIFm3NNqKe4Q=; b=FciHHJu4Q0rwPgXkmlzmsHIwkiH/V7gOPT9+5FrSJMPucqbA1TVOYrKRqwKOwmz5cL RJoWT9vkT3KVl5VMs0lloUcl/MsAB7bHV2skZ7LOoaysr/552HBKWBBAxKqYWkkVwHYp TlwBBnR41fg6HXLMb5Oeaaps24bbgYGXliMqQyn5fBu0yUJRj87kzJ2HkIxt+++ExoB3 6X354bG+m6SBwaeyyq7TcV07FpS8xf2tI4Fkg4Yzv9JPupUB/Gvy30YbEEhwRMYPd6uI VJ3/V6sDg/bMXglxVeUbVm23WxCyTG9ZBFZtTBBnPOnWWaUTBzjhyTfK5n5033ktE+CR FUdQ== X-Gm-Message-State: AGRZ1gLcWB+gDcOpwAUkGI0XCkE2psnvDp3W0Q263dpLtftrSr38huBE 0XJkKCajmN9O9gOYfyb6T4o5UwOlFwY= X-Received: by 2002:a5d:558b:: with SMTP id i11-v6mr2496764wrv.38.1540988486859; Wed, 31 Oct 2018 05:21:26 -0700 (PDT) Received: from cloudburst.twiddle.net.lan (79-69-241-110.dynamic.dsl.as9105.com. [79.69.241.110]) by smtp.gmail.com with ESMTPSA id v2-v6sm13450362wru.17.2018.10.31.05.21.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Oct 2018 05:21:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 31 Oct 2018 12:21:16 +0000 Message-Id: <20181031122119.1669-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181031122119.1669-1-richard.henderson@linaro.org> References: <20181031122119.1669-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 Subject: [Qemu-devel] [PULL 07/10] cputlb: Merge tlb_flush_page into tlb_flush_page_by_mmuidx X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" The difference between the two sets of APIs is now miniscule. Tested-by: Emilio G. Cota Reviewed-by: Emilio G. Cota Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 58 ++++++++++------------------------------------ 1 file changed, 12 insertions(+), 46 deletions(-) -- 2.17.2 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index a3a417e81a..1f7764de94 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -255,38 +255,6 @@ static void tlb_flush_page_locked(CPUArchState *env, int midx, } } -static void tlb_flush_page_async_work(CPUState *cpu, run_on_cpu_data data) -{ - CPUArchState *env = cpu->env_ptr; - target_ulong addr = (target_ulong) data.target_ptr; - int mmu_idx; - - assert_cpu_is_self(cpu); - - tlb_debug("page addr:" TARGET_FMT_lx "\n", addr); - - addr &= TARGET_PAGE_MASK; - qemu_spin_lock(&env->tlb_c.lock); - for (mmu_idx = 0; mmu_idx < NB_MMU_MODES; mmu_idx++) { - tlb_flush_page_locked(env, mmu_idx, addr); - } - qemu_spin_unlock(&env->tlb_c.lock); - - tb_flush_jmp_cache(cpu, addr); -} - -void tlb_flush_page(CPUState *cpu, target_ulong addr) -{ - tlb_debug("page :" TARGET_FMT_lx "\n", addr); - - if (!qemu_cpu_is_self(cpu)) { - async_run_on_cpu(cpu, tlb_flush_page_async_work, - RUN_ON_CPU_TARGET_PTR(addr)); - } else { - tlb_flush_page_async_work(cpu, RUN_ON_CPU_TARGET_PTR(addr)); - } -} - /* As we are going to hijack the bottom bits of the page address for a * mmuidx bit mask we need to fail to build if we can't do that */ @@ -336,6 +304,11 @@ void tlb_flush_page_by_mmuidx(CPUState *cpu, target_ulong addr, uint16_t idxmap) } } +void tlb_flush_page(CPUState *cpu, target_ulong addr) +{ + tlb_flush_page_by_mmuidx(cpu, addr, ALL_MMUIDX_BITS); +} + void tlb_flush_page_by_mmuidx_all_cpus(CPUState *src_cpu, target_ulong addr, uint16_t idxmap) { @@ -352,6 +325,11 @@ void tlb_flush_page_by_mmuidx_all_cpus(CPUState *src_cpu, target_ulong addr, fn(src_cpu, RUN_ON_CPU_TARGET_PTR(addr_and_mmu_idx)); } +void tlb_flush_page_all_cpus(CPUState *src, target_ulong addr) +{ + tlb_flush_page_by_mmuidx_all_cpus(src, addr, ALL_MMUIDX_BITS); +} + void tlb_flush_page_by_mmuidx_all_cpus_synced(CPUState *src_cpu, target_ulong addr, uint16_t idxmap) @@ -369,21 +347,9 @@ void tlb_flush_page_by_mmuidx_all_cpus_synced(CPUState *src_cpu, async_safe_run_on_cpu(src_cpu, fn, RUN_ON_CPU_TARGET_PTR(addr_and_mmu_idx)); } -void tlb_flush_page_all_cpus(CPUState *src, target_ulong addr) +void tlb_flush_page_all_cpus_synced(CPUState *src, target_ulong addr) { - const run_on_cpu_func fn = tlb_flush_page_async_work; - - flush_all_helper(src, fn, RUN_ON_CPU_TARGET_PTR(addr)); - fn(src, RUN_ON_CPU_TARGET_PTR(addr)); -} - -void tlb_flush_page_all_cpus_synced(CPUState *src, - target_ulong addr) -{ - const run_on_cpu_func fn = tlb_flush_page_async_work; - - flush_all_helper(src, fn, RUN_ON_CPU_TARGET_PTR(addr)); - async_safe_run_on_cpu(src, fn, RUN_ON_CPU_TARGET_PTR(addr)); + tlb_flush_page_by_mmuidx_all_cpus_synced(src, addr, ALL_MMUIDX_BITS); } /* update the TLBs so that writes to code in the virtual page 'addr'