From patchwork Wed Dec 21 05:03:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 635597 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp3320073pvb; Tue, 20 Dec 2022 21:07:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXu1wZTphfQqcQFLmIENQu1JXDfJaXrekXIKIdTl7O3etukt8BBnSsYUWrn7xBCtibJRuDkq X-Received: by 2002:a0c:eb0b:0:b0:4c6:ff4c:f05f with SMTP id j11-20020a0ceb0b000000b004c6ff4cf05fmr372873qvp.4.1671599254789; Tue, 20 Dec 2022 21:07:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671599254; cv=none; d=google.com; s=arc-20160816; b=DPGvRjhZr6nwReYRWPIdqD5AV+lr9/0LhQ+pl8/jT2lKDdkULRK3AaD+fx9HlkZmu+ vGqyFrvYNdik5XJxZ7Zhd0Rg2r5ckv4rvlL1efqOn/SHY1/fyPmeNbt/mX55g6JY9nKI PdDA6F7sM6lc6AjUDeuXlJ6qEMSwGLq/EUa1p0+2/D14vwPHxjCRabFjqO6RQpZufpcM 6868VXo9bLeaREyBLXQUDcC23rocoN6+MPcdAqHLbHsjv8OkAhdlO+CBpqj7ZTnSQTFM lOkvrFpF2T61esDbcjgggp0VehgJm7CPB1tiBtOCdVb0Yq0YSaACOfgCfrEi5wfT/Bhy Uj/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=cckxZafOwtkUwQnY45Ez0scvGBO1+RBqrS/Kwfy+GPI=; b=u183NOkRmrV1IF7wjxBJD1tw6K/2siQ3ZNZdmiPByJNR+IniprC20+fXcWD6F0GE3U OJ3pHJ6xc7ETsXVGvpHuX/2NSq/6O5NCSU5W/P052OrYOuZofu8+22eebsobg0BX0YH/ TfnH+M/YXlGmTzaig5I9Ft+C1DNwMq5W8s6AEQ01SciGGzoVyguxwAPu8bfvocpxKxPX Y8PdyFmxpBr3HK2x05q7EcOruaDolYlWH4HxqBVGSGBpTT0MWB1fphlTvxtIJZhjv+Kn wW54MKy2rRyYn3j3Bnbu0TRuuUfnTWO+Fx0hSDnPB5GJGSGSSvtjHFNrkDEJAvtkUCxl C4wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I9pc2pd1; 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 2-20020a05621420e200b004c79cdd6693si5691639qvk.293.2022.12.20.21.07.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Dec 2022 21:07:34 -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=I9pc2pd1; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7rGQ-0002KL-HT; Wed, 21 Dec 2022 00:03:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7rGO-0002JG-DW for qemu-devel@nongnu.org; Wed, 21 Dec 2022 00:03:32 -0500 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7rGM-0003Pe-P0 for qemu-devel@nongnu.org; Wed, 21 Dec 2022 00:03:32 -0500 Received: by mail-pj1-x1036.google.com with SMTP id u5so14575479pjy.5 for ; Tue, 20 Dec 2022 21:03:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cckxZafOwtkUwQnY45Ez0scvGBO1+RBqrS/Kwfy+GPI=; b=I9pc2pd1N5GMj61jiDYr4cOo0OCsiMxBntpUKyLfNeynUxUKHDCZCriQAU1/QigYfY k2UIyhg4/pE7tFwH+F+5nvzd7Dtl7KPF8oljZDK8Y9r8YAhBwJdCLiC+DOod19JsA2yh th0eKTFtnD82nn0WO31Z3as9W8pTeYP056iKF/OGNADjHueOqS4oHraxlnrls+Q9ZRsS WZ/vGRVdpSX7KCIJR44U+31csP7BilwgNehwQ3kQk4MX31KiCJ5Kbw0Fz74fb1GKARID fVg1lCFFCuMA5g0cIm38nhMXnC81aJUzxXs4ST5hEwa/eHDKj7R7Q1IJfutliKoj97/I JD8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cckxZafOwtkUwQnY45Ez0scvGBO1+RBqrS/Kwfy+GPI=; b=qSBwxXdTXq+IuxUrovdHMhs2toi4NvskOvzVTpbyd5ZMR9j8ELMdxqe43zVPvJZlQD ccJfpUWCxPFAtSN9qQP6D1pqGwBiZrCuf+9kG3JJM2D/wn4CNlDjCy9vvtxkgySBuzqm /498Bkz2tSNbMJSwGf+hTEn2IpZA/eHgo3FcxfXLoElm7yys9AZarTGSGkMJMYwnhNtm xilTDiGFlT77MOFTt72H89aVb8v8fNKdBaoDsZLD9YzbMa6TOivVKh0421Nyrp1lPKlp EvyP+khVGTlVCRxzyREIhcx39EFJLjMNVi7Hfee7GPGdGHtTZW97h1LSPe66A6XB28qF oK7w== X-Gm-Message-State: AFqh2kpvZnAVD24UELj/yXqDBWjQ7rdknATGmCrel5XFjnT+EVwIkUMe LOKyMtR/scDiDJFKHty5rMOuAbHR3gbSQC+B X-Received: by 2002:a17:90a:d911:b0:219:ffc6:4040 with SMTP id c17-20020a17090ad91100b00219ffc64040mr17248338pjv.38.1671599009248; Tue, 20 Dec 2022 21:03:29 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:3efa:624c:5fb:32c0]) by smtp.gmail.com with ESMTPSA id a8-20020a17090a688800b002135e8074b1sm390645pjd.55.2022.12.20.21.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 21:03:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex?= =?utf-8?q?_Benn=C3=A9e?= Subject: [PULL v2 13/14] accel/tcg: Factor tb_invalidate_phys_range_fast() out Date: Tue, 20 Dec 2022 21:03:12 -0800 Message-Id: <20221221050313.2950701-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221050313.2950701-1-richard.henderson@linaro.org> References: <20221221050313.2950701-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1036.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Message-Id: <20221209093649.43738-5-philmd@linaro.org> Signed-off-by: Richard Henderson --- accel/tcg/internal.h | 3 +++ accel/tcg/cputlb.c | 5 +---- accel/tcg/tb-maint.c | 21 +++++++++++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/accel/tcg/internal.h b/accel/tcg/internal.h index d10ab69ed0..8f8c44d06b 100644 --- a/accel/tcg/internal.h +++ b/accel/tcg/internal.h @@ -42,6 +42,9 @@ void tb_invalidate_phys_page_fast__locked(struct page_collection *pages, uintptr_t retaddr); struct page_collection *page_collection_lock(tb_page_addr_t start, tb_page_addr_t end); +void tb_invalidate_phys_range_fast(ram_addr_t ram_addr, + unsigned size, + uintptr_t retaddr); void page_collection_unlock(struct page_collection *set); G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); #endif /* CONFIG_SOFTMMU */ diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index f7963d3af8..03674d598f 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1508,10 +1508,7 @@ static void notdirty_write(CPUState *cpu, vaddr mem_vaddr, unsigned size, trace_memory_notdirty_write_access(mem_vaddr, ram_addr, size); if (!cpu_physical_memory_get_dirty_flag(ram_addr, DIRTY_MEMORY_CODE)) { - struct page_collection *pages - = page_collection_lock(ram_addr, ram_addr + size); - tb_invalidate_phys_page_fast__locked(pages, ram_addr, size, retaddr); - page_collection_unlock(pages); + tb_invalidate_phys_range_fast(ram_addr, size, retaddr); } /* diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 8edfd910c4..d557013f00 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -1184,10 +1184,6 @@ void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end) } /* - * len must be <= 8 and start must be a multiple of len. - * Called via softmmu_template.h when code areas are written to with - * iothread mutex not held. - * * Call with all @pages in the range [@start, @start + len[ locked. */ void tb_invalidate_phys_page_fast__locked(struct page_collection *pages, @@ -1205,4 +1201,21 @@ void tb_invalidate_phys_page_fast__locked(struct page_collection *pages, tb_invalidate_phys_page_range__locked(pages, p, start, start + len, retaddr); } + +/* + * len must be <= 8 and start must be a multiple of len. + * Called via softmmu_template.h when code areas are written to with + * iothread mutex not held. + */ +void tb_invalidate_phys_range_fast(ram_addr_t ram_addr, + unsigned size, + uintptr_t retaddr) +{ + struct page_collection *pages; + + pages = page_collection_lock(ram_addr, ram_addr + size); + tb_invalidate_phys_page_fast__locked(pages, ram_addr, size, retaddr); + page_collection_unlock(pages); +} + #endif /* CONFIG_USER_ONLY */