From patchwork Mon Jun 19 18:18:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9797153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7A19B600C5 for ; Mon, 19 Jun 2017 18:26:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 505C328464 for ; Mon, 19 Jun 2017 18:26:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42A1C2846B; Mon, 19 Jun 2017 18:26:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C458228464 for ; Mon, 19 Jun 2017 18:26:58 +0000 (UTC) Received: from localhost ([::1]:43860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dN1O6-0006j4-79 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Jun 2017 14:26:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dN1GJ-0008Qd-N9 for qemu-devel@nongnu.org; Mon, 19 Jun 2017 14:18:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dN1GI-0002I0-Q0 for qemu-devel@nongnu.org; Mon, 19 Jun 2017 14:18:55 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:34194) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dN1GI-0002Hk-Jw for qemu-devel@nongnu.org; Mon, 19 Jun 2017 14:18:54 -0400 Received: by mail-pf0-x244.google.com with SMTP id d5so18589405pfe.1 for ; Mon, 19 Jun 2017 11:18:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Nz0fqoxFuPFq2C604KcmRzkOEdFCupRReGeqPoHI7hM=; b=RnBCPjGEjDFL3AbBMOMIcy+LnFN2Z71lQ6TtoAJOcmZUzMQtKtSMSN+et0MXUvUTV6 aS5HVrlmQqTBnXmSZvpfwLo9HYv69JJumDuQGO+XeUb7jNdoVVq3m4lbV18MQJd+Ffc3 8LavxJffwEyFPrHzYp31LwKuIWWD3JmzvVb5YpMPj6Ux8SvpRsPHrBykyi6zVi93xwpu IDBQw/UlgkS4eu6IToo6wBsYwJDG4Q4GLCZSrp77Vw1BUFRDf7baTRku7TxpTp1j/VUZ NhbnWEXKLL+Eq9n+keuDcUzLWx7lkLXKAo01vK97AapyjETnacud22Lmvm1WeHIbptsa P0iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Nz0fqoxFuPFq2C604KcmRzkOEdFCupRReGeqPoHI7hM=; b=OTl0F9Lki3YQPJneJy1MpyO4Fx9WoVKDhIwp4rhUTg/HoYNFWRwKyEcDp42ERm7H/n T1runZwBlCfaINdV3D32AUeNtUZsW2aGgeHFP+/Fll39WR6TK369/mMp6UWpIpTmyDu7 30sKmD69P5ZCl1dAbi9Dax79BgszfW1n0mI5HmkG3GwEbnnuS79Lm/wIwMl/5t9lk1OZ XfCmuXMeDZ/D7dJYwCihNiGcNGlfRCcRKuun3NSRxqnrJIlmF/cnwjMhg4kUgWSstvaS A36L/Q856kv8DDfU3DI0woB/8zpFCehv1KdYFIu4pPqeNuhXAInuxnwTjXGcUsGRInlZ wy+A== X-Gm-Message-State: AKS2vOwbsGGL74745L/DaZJ+V4DY7B9CevfZLug6TfD7bf263xh8F0pR y0GP48qngYsBU2VXiLQ= X-Received: by 10.84.217.7 with SMTP id o7mr24075392pli.156.1497896333571; Mon, 19 Jun 2017 11:18:53 -0700 (PDT) Received: from pike.twiddle.net (97-113-165-157.tukw.qwest.net. [97.113.165.157]) by smtp.gmail.com with ESMTPSA id e63sm22917171pfb.18.2017.06.19.11.18.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jun 2017 11:18:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 19 Jun 2017 11:18:37 -0700 Message-Id: <20170619181839.25249-11-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170619181839.25249-1-rth@twiddle.net> References: <20170619181839.25249-1-rth@twiddle.net> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::244 Subject: [Qemu-devel] [PULL 10/12] target/alpha: Use tcg_gen_lookup_and_goto_ptr 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 Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Tested-by: Emilio G. Cota Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- target/alpha/translate.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 7c45ae3..232af9e 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -84,6 +84,7 @@ typedef enum { the PC (for whatever reason), so there's no need to do it again on exiting the TB. */ EXIT_PC_UPDATED, + EXIT_PC_UPDATED_NOCHAIN, /* We are exiting the TB, but have neither emitted a goto_tb, nor updated the PC for the next instruction to be executed. */ @@ -458,11 +459,17 @@ static bool in_superpage(DisasContext *ctx, int64_t addr) #endif } +static bool use_exit_tb(DisasContext *ctx) +{ + return ((ctx->tb->cflags & CF_LAST_IO) + || ctx->singlestep_enabled + || singlestep); +} + static bool use_goto_tb(DisasContext *ctx, uint64_t dest) { /* Suppress goto_tb in the case of single-steping and IO. */ - if ((ctx->tb->cflags & CF_LAST_IO) - || ctx->singlestep_enabled || singlestep) { + if (unlikely(use_exit_tb(ctx))) { return false; } #ifndef CONFIG_USER_ONLY @@ -1198,7 +1205,10 @@ static ExitStatus gen_call_pal(DisasContext *ctx, int palcode) tcg_gen_andi_i64(tmp, ctx->ir[IR_A0], PS_INT_MASK); tcg_gen_st8_i64(tmp, cpu_env, offsetof(CPUAlphaState, ps)); tcg_temp_free(tmp); - break; + + /* Allow interrupts to be recognized right away. */ + tcg_gen_movi_i64(cpu_pc, ctx->pc); + return EXIT_PC_UPDATED_NOCHAIN; case 0x36: /* RDPS */ @@ -1266,7 +1276,7 @@ static ExitStatus gen_call_pal(DisasContext *ctx, int palcode) need the page permissions check. We'll see the existence of the page when we create the TB, and we'll flush all TBs if we change the PAL base register. */ - if (!ctx->singlestep_enabled && !(ctx->tb->cflags & CF_LAST_IO)) { + if (!use_exit_tb(ctx)) { tcg_gen_goto_tb(0); tcg_gen_movi_i64(cpu_pc, entry); tcg_gen_exit_tb((uintptr_t)ctx->tb); @@ -2686,7 +2696,8 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn) tcg_gen_andi_i64(tmp, vb, 1); tcg_gen_st8_i64(tmp, cpu_env, offsetof(CPUAlphaState, pal_mode)); tcg_gen_andi_i64(cpu_pc, vb, ~3); - ret = EXIT_PC_UPDATED; + /* Allow interrupts to be recognized right away. */ + ret = EXIT_PC_UPDATED_NOCHAIN; break; #else goto invalid_opc; @@ -3010,6 +3021,12 @@ void gen_intermediate_code(CPUAlphaState *env, struct TranslationBlock *tb) tcg_gen_movi_i64(cpu_pc, ctx.pc); /* FALLTHRU */ case EXIT_PC_UPDATED: + if (!use_exit_tb(&ctx)) { + tcg_gen_lookup_and_goto_ptr(cpu_pc); + break; + } + /* FALLTHRU */ + case EXIT_PC_UPDATED_NOCHAIN: if (ctx.singlestep_enabled) { gen_excp_1(EXCP_DEBUG, 0); } else {