From nobody Fri Oct 24 20:22:34 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519710114623750.5373266917185; Mon, 26 Feb 2018 21:41:54 -0800 (PST) Received: from localhost ([::1]:34929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqY1L-0005yt-VZ for importer@patchew.org; Tue, 27 Feb 2018 00:41:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqXzG-0004ad-B6 for qemu-devel@nongnu.org; Tue, 27 Feb 2018 00:39:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqXzC-0000QO-PO for qemu-devel@nongnu.org; Tue, 27 Feb 2018 00:39:38 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:40511) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eqXzC-0000Pq-L3 for qemu-devel@nongnu.org; Tue, 27 Feb 2018 00:39:34 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 2FB2B20BC2; Tue, 27 Feb 2018 00:39:34 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Tue, 27 Feb 2018 00:39:34 -0500 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id DB3FA7E26F; Tue, 27 Feb 2018 00:39:33 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=/tR3Kv0FmM5pp7 5f7W70PYaqPY4dfL54yo2M6Rb2Slo=; b=sDYkiaxzwGAhnBlFWByWjV+sJr/ksR pZNOIJmPbauW07XafaF6cDE/vTZf3u1ACjt8OYTbxryBDkOA+dPrvDIm0AKWZZ6B tmp17xSSul/RkzsQojZxMVjU9H5h1JP+HqNg+fDPzW8T5nf7bN8UutCtTXCHMhK8 n3q+3GGkY6kS0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=/tR3Kv0FmM5pp75f7W70PYaqPY4dfL54yo2M6Rb2Slo=; b=ZZbeKY/W InQW9/XyFpRwUebKrtzEyHmoMIkvFHNkUKxfk4FTr9714xqw1t4BdjqsEY6IcMwa Y52TWy6MBb025d3d9bTxYLJJ0UkFqIjg/NyptyQQLagpjN5qrog6i6KzZaKFvpyz S3O1VgpvEwIZuXPxAz/zlOnTwrsQNoy0QFltcaFkXI+ZVJTB+enApi8gQctNgOv6 VAA6S6gE0IHuKy/aMwhoydE7JGabO5KRLpauaXRT9xnV5HHkZO0ISoNqtqt6T6lc inkWlT91B6PAHGRNFwrzlJE6Hnm/WMxof8Ia5ZZxIHv2ewNgdDjh4V6qMwbwFHk0 4Bq06p7/oit/ew== X-ME-Sender: From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 27 Feb 2018 00:39:18 -0500 Message-Id: <1519709965-29833-10-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519709965-29833-1-git-send-email-cota@braap.org> References: <1519709965-29833-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.26 Subject: [Qemu-devel] [PATCH 09/16] translate-all: move tb_invalidate_phys_page_range up in the file 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: Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This greatly simplifies next commit's diff. Signed-off-by: Emilio G. Cota Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- accel/tcg/translate-all.c | 77 ++++++++++++++++++++++++-------------------= ---- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index a98e182..4cb03f1 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1371,44 +1371,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, =20 /* * Invalidate all TBs which intersect with the target physical address ran= ge - * [start;end[. NOTE: start and end may refer to *different* physical page= s. - * 'is_cpu_write_access' should be true if called from a real cpu write - * access: the virtual CPU will exit the current TB if code is modified in= side - * this TB. - * - * Called with mmap_lock held for user-mode emulation, grabs tb_lock - * Called with tb_lock held for system-mode emulation - */ -static void tb_invalidate_phys_range_1(tb_page_addr_t start, tb_page_addr_= t end) -{ - tb_page_addr_t next; - - for (next =3D (start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; - start < end; - start =3D next, next +=3D TARGET_PAGE_SIZE) { - tb_page_addr_t bound =3D MIN(next, end); - - tb_invalidate_phys_page_range(start, bound, 0); - } -} - -#ifdef CONFIG_SOFTMMU -void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end) -{ - assert_tb_locked(); - tb_invalidate_phys_range_1(start, end); -} -#else -void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end) -{ - assert_memory_lock(); - tb_lock(); - tb_invalidate_phys_range_1(start, end); - tb_unlock(); -} -#endif -/* - * Invalidate all TBs which intersect with the target physical address ran= ge * [start;end[. NOTE: start and end must refer to the *same* physical page. * 'is_cpu_write_access' should be true if called from a real cpu write * access: the virtual CPU will exit the current TB if code is modified in= side @@ -1505,6 +1467,45 @@ void tb_invalidate_phys_page_range(tb_page_addr_t st= art, tb_page_addr_t end, #endif } =20 +/* + * Invalidate all TBs which intersect with the target physical address ran= ge + * [start;end[. NOTE: start and end may refer to *different* physical page= s. + * 'is_cpu_write_access' should be true if called from a real cpu write + * access: the virtual CPU will exit the current TB if code is modified in= side + * this TB. + * + * Called with mmap_lock held for user-mode emulation, grabs tb_lock + * Called with tb_lock held for system-mode emulation + */ +static void tb_invalidate_phys_range_1(tb_page_addr_t start, tb_page_addr_= t end) +{ + tb_page_addr_t next; + + for (next =3D (start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; + start < end; + start =3D next, next +=3D TARGET_PAGE_SIZE) { + tb_page_addr_t bound =3D MIN(next, end); + + tb_invalidate_phys_page_range(start, bound, 0); + } +} + +#ifdef CONFIG_SOFTMMU +void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end) +{ + assert_tb_locked(); + tb_invalidate_phys_range_1(start, end); +} +#else +void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end) +{ + assert_memory_lock(); + tb_lock(); + tb_invalidate_phys_range_1(start, end); + tb_unlock(); +} +#endif + #ifdef CONFIG_SOFTMMU /* len must be <=3D 8 and start must be a multiple of len. * Called via softmmu_template.h when code areas are written to with --=20 2.7.4