From patchwork Sat Jan 23 18:50:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 369449 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2591202jam; Sat, 23 Jan 2021 10:52:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWkEnLwdlOEPBXqpd7a5s9fkW0/oTgBWorn6pghLNpx2t9LzladH/J/t6o+r83uybzLzMa X-Received: by 2002:a25:bfc4:: with SMTP id q4mr14906516ybm.248.1611427955831; Sat, 23 Jan 2021 10:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611427955; cv=none; d=google.com; s=arc-20160816; b=wuFM/afPXFpPFSFWwZpEw1VzR4ZIlc+wXcEBof/wleZAxmN8eAtthaNWPhdNoFH+qN zc7C1j0KLLB7qJLC7cO/kJgWe9dSQAYK66s+wTu+sNBTC1pPXOwWlm/dsKK6hVukkqmR xzQOCRS71m1/SpR93k/TkoBYohDKxgweagIKqHt9eC3+ErukBnSiXOm9byKHjMD+9O4P +jXM3dvFkobsUgy6rXS1BjiLsr94OXF6dfsvg02/yOAmQPA2WMgvqjSILIOfFgYt9hRV pAZDSD0r+FefpESU6pqOI2Ez+wjETzC6sHQlBkNcR+pvEF4B8ODg9QDlrSnr7I0F4PU/ YvEg== 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=UqHrCB4kNK0rhQOAfSyXF5GRntYhHhyAfqhZg0V8bdY=; b=twcTEHiuZzCShujdNmBdPN8TFnz2yUzmBie0xrr0eh+TPD2KI5FXqWZ+mSd8JWJSHf bK0i2b8e+sEh748TW0fhUnI9+pDhKVhlbZGWrhrAaHQF1+4ax9/XyXihZ7sKi8x762Mj LkRkAK0I1urN7ycYXslsedqd1TkYdyi0OQN1WigNdfCxfJaAsVHNDBOtJGJdPA9oOn+K k0sWTt5wg+C4iYq131XWmesu/L16GXIjq3KCSJUbNUQO8Nu/HfRBRY/GXzMRd7DkI34T H8O19PfdTmoUSuRY9SsO1Y7B//JEtkHpgeDBJRMA9pc/CkV1Cw25nQUJPstWNAZX4wH3 wPVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jMNXWj6T; 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=pass (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 i17si11573866ybk.188.2021.01.23.10.52.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 23 Jan 2021 10:52:35 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=jMNXWj6T; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3O1T-0007VD-BC for patch@linaro.org; Sat, 23 Jan 2021 13:52:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3Nze-0005Kq-B4 for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:42 -0500 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:35946) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3NzX-0008H1-LX for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:42 -0500 Received: by mail-pf1-x42a.google.com with SMTP id u67so5963317pfb.3 for ; Sat, 23 Jan 2021 10:50:34 -0800 (PST) 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=UqHrCB4kNK0rhQOAfSyXF5GRntYhHhyAfqhZg0V8bdY=; b=jMNXWj6T7cZseMzBnOPaEaltvnEvQwRlYI6uoqAqmjMEmJ7SLx4I+QiHcDB3fVO47N 8JioZzw/phU31w0owSLSPUtppOXLeiQ+qJ6yuMoKTsLoyTBPxzvyEtMFVVNuK8x0efTp S3tMyM9XWnjy3xrLjlnIB1QiiZn5D8sbDSM86RjCt2gHsxuoh4DjlcCu9o02AesnVmSe MQ+6KJztbBRJIFVk5KicYTLqcDV/yctx+yPwOHqkjzShVvJjkZOTvy1oX4fk4DvSZ+ip CUFTDt4fQjrvVVg65p6oKfHqIvaOFnD4Samr7pGOU1ys0BQuR3hf7oqamDRcDDfoQqaY pLjA== 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=UqHrCB4kNK0rhQOAfSyXF5GRntYhHhyAfqhZg0V8bdY=; b=sUvMe3Tx4WaUCQpoyeQBaaudOhT+zuadc1kuCE9LV0l2W2Pvcgyn3rM02WribuJFDL 4P5GRgDJ8i3W23L1tlqRROi+F6KewqOiybYKFztRJ42aq5CLf3o0phlYMBTgmHaNZegv yM4qxyGv41epk4N6ZzvOPf2KKJIZ3CQ53kE7EzjkvcODNsa61Ncy7CKPToKCenTsZjel N7XBF8kwq7e4ATC8kPjRGER31iYo4M9xrnVtdunUpODr/hchHwYI04Olo24j/r3foiRh DrK8D2U1RFWpuNV4sI5x6J6SFw3Ruyu3JmVMZh/k0YD+xZzOwaXxe9m7Szw2/w+5qZWF Z5iA== X-Gm-Message-State: AOAM531LItkzdP48jlAu7uxO3aFu6yoCKal44tHCruu4dv7o3V9P7Z2r uwV/gdIG5puvehXs68z3nSmsm+w27vR7zQ== X-Received: by 2002:a63:1602:: with SMTP id w2mr11035870pgl.128.1611427834009; Sat, 23 Jan 2021 10:50:34 -0800 (PST) Received: from localhost.localdomain (cpe-66-75-72-126.hawaii.res.rr.com. [66.75.72.126]) by smtp.gmail.com with ESMTPSA id j19sm5018614pfn.14.2021.01.23.10.50.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 10:50:33 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 06/10] accel/tcg: Move tb_flush_jmp_cache() to cputlb.c Date: Sat, 23 Jan 2021 08:50:16 -1000 Message-Id: <20210123185020.1766324-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123185020.1766324-1-richard.henderson@linaro.org> References: <20210123185020.1766324-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Move and make the function static, as the only users are here in cputlb.c. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 3 --- accel/tcg/cputlb.c | 18 ++++++++++++++++++ accel/tcg/translate-all.c | 17 ----------------- 3 files changed, 18 insertions(+), 20 deletions(-) -- 2.25.1 diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 516013e735..1e3e7cf8e7 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -663,9 +663,6 @@ tb_page_addr_t get_page_addr_code_hostp(CPUArchState *env, target_ulong addr, void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length); void tlb_set_dirty(CPUState *cpu, target_ulong vaddr); -/* exec.c */ -void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr); - MemoryRegionSection * address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr, hwaddr *xlat, hwaddr *plen, diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index ced3dc077e..0fa1643ed3 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -25,6 +25,7 @@ #include "exec/address-spaces.h" #include "exec/cpu_ldst.h" #include "exec/cputlb.h" +#include "exec/tb-hash.h" #include "exec/memory-internal.h" #include "exec/ram_addr.h" #include "tcg/tcg.h" @@ -97,6 +98,23 @@ static void tlb_window_reset(CPUTLBDesc *desc, int64_t ns, desc->window_max_entries = max_entries; } +static void tb_jmp_cache_clear_page(CPUState *cpu, target_ulong page_addr) +{ + unsigned int i, i0 = tb_jmp_cache_hash_page(page_addr); + + for (i = 0; i < TB_JMP_PAGE_SIZE; i++) { + qatomic_set(&cpu->tb_jmp_cache[i0 + i], NULL); + } +} + +static void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr) +{ + /* Discard jump cache entries for any tb which might potentially + overlap the flushed page. */ + tb_jmp_cache_clear_page(cpu, addr - TARGET_PAGE_SIZE); + tb_jmp_cache_clear_page(cpu, addr); +} + /** * tlb_mmu_resize_locked() - perform TLB resize bookkeeping; resize if necessary * @desc: The CPUTLBDesc portion of the TLB diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index ca7ef6aa17..5bd0e267c8 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2461,23 +2461,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) cpu_loop_exit_noexc(cpu); } -static void tb_jmp_cache_clear_page(CPUState *cpu, target_ulong page_addr) -{ - unsigned int i, i0 = tb_jmp_cache_hash_page(page_addr); - - for (i = 0; i < TB_JMP_PAGE_SIZE; i++) { - qatomic_set(&cpu->tb_jmp_cache[i0 + i], NULL); - } -} - -void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr) -{ - /* Discard jump cache entries for any tb which might potentially - overlap the flushed page. */ - tb_jmp_cache_clear_page(cpu, addr - TARGET_PAGE_SIZE); - tb_jmp_cache_clear_page(cpu, addr); -} - static void print_qht_statistics(struct qht_stats hst) { uint32_t hgram_opts;