From patchwork Wed Jun 14 19:48:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 775953 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wnxzL4vfFz9s8V for ; Thu, 15 Jun 2017 05:49:18 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mourlVcl"; dkim-atps=neutral Received: from localhost ([::1]:50606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLEHz-000150-RH for incoming@patchwork.ozlabs.org; Wed, 14 Jun 2017 15:49:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLEHF-00012n-Fy for qemu-devel@nongnu.org; Wed, 14 Jun 2017 15:48:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLEHE-0008TP-BN for qemu-devel@nongnu.org; Wed, 14 Jun 2017 15:48:29 -0400 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]:33450) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLEHE-0008TH-6r for qemu-devel@nongnu.org; Wed, 14 Jun 2017 15:48:28 -0400 Received: by mail-qt0-x242.google.com with SMTP id w1so2208001qtg.0 for ; Wed, 14 Jun 2017 12:48:28 -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; bh=TAYZLYeMK/A/YUGsgmdMJldBVffyFJKVBeL/TYDchs0=; b=mourlVclCZZLCHGwFKy788TjdPu4ri7um3dRjm99hk1esrZrUTsm69bunbUDGfNfoE /RUDygCyRGU2po6aOgHy2pOvDLJRQs9ZeP+VnVIgEy2022Hy3nVShUrNu6rU1ezpbOHn 9vS//DHaI47USL1Kh6+xkvXV3oFD5/RDEYn0eJcC9DRY7mg2Tkz3bOQY8jFip44WeOGD z0RZOZfX8jqj20So9sFYvVmTjrvL0WZg1BLG82Lca2nkpACbohm77FnZSwDv8kUg/Lqy gHh5Y5ucgJ6QidUr/7e0Tf7sOzVGpSXtCCCtUDRXry9zm8zRGDqAcJ7g9H/5y096tIcF qwBw== 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; bh=TAYZLYeMK/A/YUGsgmdMJldBVffyFJKVBeL/TYDchs0=; b=W/1Grn3ak6L2naGPOXnKc1NfKgF0cEYl1QcxUeSGXzYXKP69Zw4NQzzvlFI3iKWgS/ pnfyeY1Ypb+pRH5ReEkXZKhTEIPb/yJ8Jia+2/4Q1O54EeJ/BAksIBxvSHHuvzcy84H+ jmLPu0XRu/Bf6dmNVljxQqjn4bXYFYKqV5/XiYIpw/ma6j6oTH7gcODgMthueWc9vi9M 1JUvz03fBGG4xXLJYcN78cPne1v+XVpfX78gD7qnD0z77ljmOhUCgvDOsjv0ny6s0duA KLgeozAL/GwWv1LsvQvvDnHsh8wTPtHHmw8iHmFHBYxABgOX1gLmEjrod97g1m5iFZWX QwAw== X-Gm-Message-State: AKS2vOxxxFxJoCXqLKwVWUluzr8DhlupQ6W1X+oEs14vcNrIjB6ObwO0 swEM+6pHv3Vwft7gdcc= X-Received: by 10.200.39.18 with SMTP id g18mr2028158qtg.163.1497469707271; Wed, 14 Jun 2017 12:48:27 -0700 (PDT) Received: from bigtime.twiddle.net.com (97-113-165-157.tukw.qwest.net. [97.113.165.157]) by smtp.gmail.com with ESMTPSA id o93sm628571qte.41.2017.06.14.12.48.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 12:48:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 14 Jun 2017 12:48:18 -0700 Message-Id: <20170614194821.8754-3-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170614194821.8754-1-rth@twiddle.net> References: <20170614194821.8754-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::242 Subject: [Qemu-devel] [PATCH v2 2/5] 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: pbonzini@redhat.com, cota@braap.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson Tested-by: Emilio G. Cota Reviewed-by: Alex Bennée --- 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..a48e451 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 {