From patchwork Thu Jul 1 15:25:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469099 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp497404jao; Thu, 1 Jul 2021 08:28:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRa4GFI5/pl+tUTyZ0d78a+ToH35m243Xxv32jagOgf2TbCg6lH/P0Da5B8dMlVZ3PqIhB X-Received: by 2002:aa7:cd85:: with SMTP id x5mr501366edv.115.1625153307955; Thu, 01 Jul 2021 08:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153307; cv=none; d=google.com; s=arc-20160816; b=Fmkj2CQ0SI/jEwQJGIB8Ft7Z0CvMVJKObH1P5SXpE2L1MvfxjfEopytejKiPaKz21I T4F3i8FL6dlc76g1Yd/NGCFD9UbhTpAzGS5qAIFErBFCLWWbXSL6zwd0wZvdB0twLF49 BeTBruXsS4h2i8vHJPo71U+7Uuah8wLXza+WPlLsqYbbBAvV7671h4MAv9roJIFL2gBe oHuNCc05522DSQHCLUN2om24zI6ORuxduF7KiZmaXbr18gGXEqTwMU3OpwBVrMObQbEQ n5yBj1eExkHjtlOsOrRfK6eqVjHN9axc4CGTJRVSOWygW5dUVZObbsuKekZX9uUmVk+q fRdw== 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=XZ18+TbN3l0IvM4lcz8To1nUnlGMGwhY3IWR1y85/oQ=; b=E2TCl62gRoi6AoHRxpXZYKAyEPIiCe217j23Bo8woFBHMHEj4cb578JneAvfg9mfxB LtQyr2BoKb81eCccuVwExAm+m/xDgLPkMhhIc8syeq33z9r77Zs2TcCIeY93CTeY4SHn T32Ho1j4g+lALrA7nIpNAiCwxaxLt1Z2tGJD/XZ3avbZlTf29mTY5xhAokGmMesn00hl N9Qw/4mKco0hd9rQAJoiMcplaMxmEwIolHti6iay8kiehUE2fFQNxaw629k1LHuDvPRP vL9xj6fm5ilOkR8GYBwA+l9+a8KxgpcsBquyp2GmIcKxxKjWmYlF8LSRNBHpDsrTeZxT qP8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rm1rgNTj; 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=fail (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 t19si87214edd.255.2021.07.01.08.28.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:28:27 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b=rm1rgNTj; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyc7-0001vW-1L for patch@linaro.org; Thu, 01 Jul 2021 11:28:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZk-0004fC-JS for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:00 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:36720) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZX-0008GB-Oi for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:00 -0400 Received: by mail-pg1-x52b.google.com with SMTP id e33so6434632pgm.3 for ; Thu, 01 Jul 2021 08:25:47 -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=XZ18+TbN3l0IvM4lcz8To1nUnlGMGwhY3IWR1y85/oQ=; b=rm1rgNTjRpqMa7rc2vr+W+erhXheLaeVTlGq/9dc2gvf8wTjBi39J2gS119tSgkCTs 2vPHtTSJvs3MWW97rmMDlGgcnioRYhqqf9qhlxSmaJJS0wrUf3zBI3jH4G+6+H7mxvU6 65Usd1I4j2U9RYnMZbv0pGPcfZzzH6zi7KlRx9OwgqDqvmr92kERKyfhdI+sIPW0w8nM Labo90gEiFR9ViGzZanCqPbbHaDw6cSz5qFYwSxPghCkQQmy4xQ3FZW+n36ReeiYLIen 7W/Xq65jCL2stXaPM8jXdCV9xsqvPqFTFIgLrSHNxFSzI0XYWq0+x3qb/q7s+tANVQXi GN2Q== 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=XZ18+TbN3l0IvM4lcz8To1nUnlGMGwhY3IWR1y85/oQ=; b=T3h/agTyTKtWn6ZpQ0rE4DQ5S6phm/Qor0trSAR5/1s8WJelRRae3axmZmexFeVFrI j7n2qB6frjNsnZ2HjAnA6P5az+i5LqZypi17G8HhaQRo22nOCqNMqISTx6KljbVhCmf9 FUfVMFTpY+tYHREBQvAiJqVS0yGQd/XUwLQFW1ZDuwfch1so0bR2umAxf9WDbAv6Mskp BCJOS9Y6xTLVAut/Lvv81heunPmHQ2tYO0Sw1JZ8kCWVDSmz4Yjuv7BZfzQ0qOlnEVnL qveYaSS2OBQwVCRUJ6xAfw8RGsezSNhVAW7d6f++O9rumrz7eVVLebofE53oa1DybMgy 08Mw== X-Gm-Message-State: AOAM533Nisl+ri98SqOyloAYZO9z0vhyBU2Iz3VHgvZam/s9EzLkQ6zQ mmjBFN3Mri5s0vtiQnLF6JG1ywZoc8S+sw== X-Received: by 2002:a62:87ca:0:b029:303:1dd3:572 with SMTP id i193-20020a6287ca0000b02903031dd30572mr509872pfe.33.1625153146373; Thu, 01 Jul 2021 08:25:46 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 13/17] accel/tcg: Move cflags lookup into tb_find Date: Thu, 1 Jul 2021 08:25:33 -0700 Message-Id: <20210701152537.3330420-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We will shortly require the guest pc for computing cflags, so move the choice just after cpu_get_tb_cpu_state. Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) -- 2.25.1 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 5bb099174f..4d043a11aa 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -502,15 +502,29 @@ static inline void tb_add_jump(TranslationBlock *tb, int n, static inline TranslationBlock *tb_find(CPUState *cpu, TranslationBlock *last_tb, - int tb_exit, uint32_t cflags) + int tb_exit) { CPUArchState *env = (CPUArchState *)cpu->env_ptr; TranslationBlock *tb; target_ulong cs_base, pc; - uint32_t flags; + uint32_t flags, cflags; cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); + /* + * When requested, use an exact setting for cflags for the next + * execution. This is used for icount, precise smc, and stop- + * after-access watchpoints. Since this request should never + * have CF_INVALID set, -1 is a convenient invalid value that + * does not require tcg headers for cpu_common_reset. + */ + cflags = cpu->cflags_next_tb; + if (cflags == -1) { + cflags = curr_cflags(cpu); + } else { + cpu->cflags_next_tb = -1; + } + tb = tb_lookup(cpu, pc, cs_base, flags, cflags); if (tb == NULL) { mmap_lock(); @@ -868,21 +882,7 @@ int cpu_exec(CPUState *cpu) int tb_exit = 0; while (!cpu_handle_interrupt(cpu, &last_tb)) { - uint32_t cflags = cpu->cflags_next_tb; - TranslationBlock *tb; - - /* When requested, use an exact setting for cflags for the next - execution. This is used for icount, precise smc, and stop- - after-access watchpoints. Since this request should never - have CF_INVALID set, -1 is a convenient invalid value that - does not require tcg headers for cpu_common_reset. */ - if (cflags == -1) { - cflags = curr_cflags(cpu); - } else { - cpu->cflags_next_tb = -1; - } - - tb = tb_find(cpu, last_tb, tb_exit, cflags); + TranslationBlock *tb = tb_find(cpu, last_tb, tb_exit); cpu_loop_exec_tb(cpu, tb, &last_tb, &tb_exit); /* Try to align the host and virtual clocks if the guest is in advance */