From patchwork Thu Jun 14 19:31:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138624 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2533168lji; Thu, 14 Jun 2018 12:45:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI/azd6RCIbFOVFMXkHLFYzDrNMnruGWcj+H5lHQJ3vcEOhk3qDqO9rHS6PdKFwaEev/PAE X-Received: by 2002:ac8:5053:: with SMTP id h19-v6mr3778279qtm.71.1529005546266; Thu, 14 Jun 2018 12:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529005546; cv=none; d=google.com; s=arc-20160816; b=t7LC2ljke0D1FRkRocnjjyiDoeF3LZLrO4nSfjiRB4h651tnioU5OeOSKUcMTbMUSz rzJ/V+tnL4RbXnujArrTqagyIoyRhE0msKP26q0uvTgmXi5a2ZPu4P8UKxLsYxtsD8ON pc5YTBFN+E848JLgbRR41LyrSEMzRp4z0Ztaw1Gcc9KKnFf2LyIPnlcbUFz171bV1UaF Dr9nJjBO+LmziEcani+QeO40n+xYBtECM0QFHCBeDKRehumyf6aGPnfLjOyf6s90SCjL WdZDxRAmmHtrcQ0mEtzlTDRMPmY6fXzDqIf0AKVjjq3a6ng7a0djK7ljmRaYd1cw7q+/ /ixg== 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 :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=ShUlIMM0KTqpBxnqZKpmUtzBtiivBcjvXZG919nAn2g=; b=QI89SuPHH21pQcrGH+AfHlhpj7DoGFtMPQ2gFexiXuTIApBC4Z/MAYUeS3K+E73yvs UcF2h8mf58vqGzfRAO//VYPGzF+WFpxXnvBsoOdN8tO8BeYYlb1STL49+Hz4YwrXO4P1 XTDdXSNPotFE5ynXMa4BQCWqMVpqG+405QavETVKE84o/eT09HmDVFX7pU+PkdhP/a/4 kmK6QFEjKd95IhmcazKW4QSrY5NPmbHECnkXddBtuEbOV6Tw/LecJDaQwE0bKB1Pt41Y iU2ETHzZQfkRFQqOdqcISw49Fb8lRAX22yz7kLAuoMcj4q1phVonVAd/Xxb85WT3R7Ri z87A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Vmm1aTns; 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 w10-v6si5934075qtk.365.2018.06.14.12.45.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 14 Jun 2018 12:45:46 -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=Vmm1aTns; 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]:42427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTYBl-0001F9-Ic for patch@linaro.org; Thu, 14 Jun 2018 15:45:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTXye-00073a-S0 for qemu-devel@nongnu.org; Thu, 14 Jun 2018 15:32:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fTXyd-0005r6-MF for qemu-devel@nongnu.org; Thu, 14 Jun 2018 15:32:12 -0400 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:41585) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fTXyd-0005qH-GC for qemu-devel@nongnu.org; Thu, 14 Jun 2018 15:32:11 -0400 Received: by mail-pg0-x242.google.com with SMTP id l65-v6so3358462pgl.8 for ; Thu, 14 Jun 2018 12:32:11 -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 :mime-version:content-transfer-encoding; bh=ShUlIMM0KTqpBxnqZKpmUtzBtiivBcjvXZG919nAn2g=; b=Vmm1aTnset9s3Wl/YXS4ex7cbli8V/lh+RHlFnRoMl2QE0mejugK2HndAnwNZaxghb E1L4Ooo49+0uZ4eg70TaChkOsA15HiCTP3khzbdtDgekYfm1HVOKR4UCauCAxZIGXERj II3vXSYJuVqEUrA/bE0Oetk/6P/SJTv/1yDgI= 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=ShUlIMM0KTqpBxnqZKpmUtzBtiivBcjvXZG919nAn2g=; b=hsaPG0lzsmKv4NoV/PUA+u3dUJ2eSWU87HzcVJFTZwBMbYXYVWvHlvUQDRTq3Lebcl BtvyfPmjcSynNTkWcWofc2LMz5fsPfNbIBfc931igAkccN5jaXtqprqLl76uDbUW1VwE nqBDWIZqAPbXeNlSc1sg4D8bqTSl+E5r+xzrKR4L+mHvZqGFGBbjY6k3F5pP/h3D82EL IUKDABAINLxsiavLgw+wBGoMswqV7RlRAz9wP3lT/4WDzloWcvNlcc6x7LJ+yT0dNMeD zXtDPrFGmqWUnKqII6lZQUONYtZtGsv+IP0sdAgyfI51ICR6VqJZgydr84alrMDaiHvB O74g== X-Gm-Message-State: APt69E1y7ZBQgQIwhJ96fs/Peov5CnqNHSNXfw6RXARDknhvoLBUG9Hv HE+gO0sRPhwCa/DiWdd6KEbn9TwM6fM= X-Received: by 2002:a62:2044:: with SMTP id g65-v6mr10832022pfg.40.1529004730256; Thu, 14 Jun 2018 12:32:10 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id x24-v6sm11532184pfj.104.2018.06.14.12.32.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Jun 2018 12:32:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 14 Jun 2018 09:31:39 -1000 Message-Id: <20180614193147.29680-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180614193147.29680-1-richard.henderson@linaro.org> References: <20180614193147.29680-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::242 Subject: [Qemu-devel] [PULL 10/18] 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: peter.maydell@linaro.org, "Emilio G. Cota" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" This greatly simplifies next commit's diff. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Richard Henderson --- accel/tcg/translate-all.c | 77 ++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 38 deletions(-) -- 2.17.1 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index f32904d4a3..83bb40fb20 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1363,44 +1363,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, return tb; } -/* - * Invalidate all TBs which intersect with the target physical address range - * [start;end[. NOTE: start and end may refer to *different* physical pages. - * '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 inside - * 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 = (start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; - start < end; - start = next, next += TARGET_PAGE_SIZE) { - tb_page_addr_t bound = 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 range * [start;end[. NOTE: start and end must refer to the *same* physical page. @@ -1500,6 +1462,45 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end, #endif } +/* + * Invalidate all TBs which intersect with the target physical address range + * [start;end[. NOTE: start and end may refer to *different* physical pages. + * '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 inside + * 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 = (start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; + start < end; + start = next, next += TARGET_PAGE_SIZE) { + tb_page_addr_t bound = 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 <= 8 and start must be a multiple of len. * Called via softmmu_template.h when code areas are written to with