From nobody Wed Nov 5 13:50:18 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.zoho.com; dkim=fail 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 1497469816088903.4663778087562; Wed, 14 Jun 2017 12:50:16 -0700 (PDT) Received: from localhost ([::1]:50609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLEIv-00028E-8B for importer@patchew.org; Wed, 14 Jun 2017 15:50:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLEHF-00012a-1V for qemu-devel@nongnu.org; Wed, 14 Jun 2017 15:48:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLEHC-0008SX-T4 for qemu-devel@nongnu.org; Wed, 14 Jun 2017 15:48:28 -0400 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:35998) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLEHC-0008Rp-Os for qemu-devel@nongnu.org; Wed, 14 Jun 2017 15:48:26 -0400 Received: by mail-qt0-x244.google.com with SMTP id s33so2212542qtg.3 for ; Wed, 14 Jun 2017 12:48:26 -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.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 12:48:25 -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=R0KUieLV3x77Hhe5cLKquBK1LeYuztL3IkrW5KKd/Ug=; b=l7g7cNoPHMO/uGG0JW+dVMRPoR9naHhXqtx8wdab7WEU6VANtv5bLMQnLyksylP6ze S5U0D7vLFBGhsv4HMqeX0Dp/eImKgILce0BR3UMR68/68c+TGdHhJxh2v7urg2MY7GZv YwyXoElyESJDhwONasqLq5BDiypfjznWuYSWdDHRkYFnm4lkZizoL8nRciW7s3fEzX45 h7UoQRdh8FUeokV6mnYSl1Lcx7VZGbNMD50memaRuqcEAk/wMDiNxaR1h704yf0viC5g OEBsmBFtYdN1WgUqYdZM6FQn5R55Bpqm68WcxkGddtXFJEJYnRSbC6aAndpRpVjS0tYY 4HhQ== 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=R0KUieLV3x77Hhe5cLKquBK1LeYuztL3IkrW5KKd/Ug=; b=OPLjI9qn+0jbm/1LeetqC0c+MpI7HNU6j5gPrD89SOhlJsVDVpMaJb6v/mlGQLImRE d2j9g1b26dI///0kfk5M/PURRy4x0Jdgyq6B1QScEE/LMxqPUwZkc8OfteKjFiX+Q4OC 2d/cOOhyuUb7tNnKY83buwbYJnQ7vQrw9Kp/OXL7qjHu36gDc74GT4wXTD+AuHVVxACn jpaE+Pqnk1va5XnnGE3aap8NeZ7HIeDFeCcz8OoiwtvBqcAsl//GTn+92NKLAYhTxFlX 9acD/50/ivBZe+4hLpBljyTSPi2EOwoGw2yKyFVtQuRSYDnNvbWdTIDvs05d8QxnxAzZ scaQ== X-Gm-Message-State: AKS2vOxsp6daQej0PmCueGbrsepBQtRams1/JHig3fJaPu4DBls7G2+U /dlgHgAPQJFo03EWPds= X-Received: by 10.200.51.244 with SMTP id d49mr2161027qtb.151.1497469705894; Wed, 14 Jun 2017 12:48:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 14 Jun 2017 12:48:17 -0700 Message-Id: <20170614194821.8754-2-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::244 Subject: [Qemu-devel] [PATCH v2 1/5] tcg: Refactor helper_lookup_tb_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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We can call tb_htable_lookup even when the tb_jmp_cache is completely empty. Therefore, un-nest most of the code dependent on tb !=3D NULL from the read from the cache. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- tcg-runtime.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/tcg-runtime.c b/tcg-runtime.c index 7fa90ce..a35c725 100644 --- a/tcg-runtime.c +++ b/tcg-runtime.c @@ -147,30 +147,32 @@ uint64_t HELPER(ctpop_i64)(uint64_t arg) void *HELPER(lookup_tb_ptr)(CPUArchState *env, target_ulong addr) { CPUState *cpu =3D ENV_GET_CPU(env); + void *ret =3D tcg_ctx.code_gen_epilogue; TranslationBlock *tb; target_ulong cs_base, pc; - uint32_t flags; - - tb =3D atomic_rcu_read(&cpu->tb_jmp_cache[tb_jmp_cache_hash_func(addr)= ]); - if (likely(tb)) { - cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); - if (likely(tb->pc =3D=3D addr && tb->cs_base =3D=3D cs_base && - tb->flags =3D=3D flags)) { - goto found; - } + uint32_t flags, addr_hash; + + addr_hash =3D tb_jmp_cache_hash_func(addr); + tb =3D atomic_rcu_read(&cpu->tb_jmp_cache[addr_hash]); + cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); + + if (unlikely(!(tb + && tb->pc =3D=3D addr + && tb->cs_base =3D=3D cs_base + && tb->flags =3D=3D flags))) { tb =3D tb_htable_lookup(cpu, addr, cs_base, flags); - if (likely(tb)) { - atomic_set(&cpu->tb_jmp_cache[tb_jmp_cache_hash_func(addr)], t= b); - goto found; + if (!tb) { + return ret; } + atomic_set(&cpu->tb_jmp_cache[addr_hash], tb); } - return tcg_ctx.code_gen_epilogue; - found: + + ret =3D tb->tc_ptr; qemu_log_mask_and_addr(CPU_LOG_EXEC, addr, "Chain %p [%d: " TARGET_FMT_lx "] %s\n", - tb->tc_ptr, cpu->cpu_index, addr, + ret, cpu->cpu_index, addr, lookup_symbol(addr)); - return tb->tc_ptr; + return ret; } =20 void HELPER(exit_atomic)(CPUArchState *env) --=20 2.9.4 From nobody Wed Nov 5 13:50:18 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.zoho.com; dkim=fail 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 1497469816048641.7884774030467; Wed, 14 Jun 2017 12:50:16 -0700 (PDT) Received: from localhost ([::1]:50611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLEIw-0002AB-PD for importer@patchew.org; Wed, 14 Jun 2017 15:50:14 -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) 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) 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) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Tested-by: Emilio G. Cota --- 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, =20 /* 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 a= ddr) #endif } =20 +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, in= t 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; =20 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, ui= nt32_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 =3D EXIT_PC_UPDATED; + /* Allow interrupts to be recognized right away. */ + ret =3D EXIT_PC_UPDATED_NOCHAIN; break; #else goto invalid_opc; @@ -3010,6 +3021,12 @@ void gen_intermediate_code(CPUAlphaState *env, struc= t 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 { --=20 2.9.4 From nobody Wed Nov 5 13:50:18 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.zoho.com; dkim=fail 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 149746992654457.74835020673004; Wed, 14 Jun 2017 12:52:06 -0700 (PDT) Received: from localhost ([::1]:50620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLEKh-0003Wb-60 for importer@patchew.org; Wed, 14 Jun 2017 15:52:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLEHG-00013a-OB 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 1dLEHF-0008UF-ND for qemu-devel@nongnu.org; Wed, 14 Jun 2017 15:48:30 -0400 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]:35153) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLEHF-0008U5-Iz for qemu-devel@nongnu.org; Wed, 14 Jun 2017 15:48:29 -0400 Received: by mail-qt0-x242.google.com with SMTP id x58so2210363qtc.2 for ; Wed, 14 Jun 2017 12:48:29 -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.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); 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=juTN3G7jcRs7VidChtiBlBH5P0f4srwHiaL79KaCS2g=; b=SN8hKny8yXZ8LE2NpWmvdYA1Y3J3NNWFMPQJM+VXJHO6bThCMRAEfB8w8F8NsShYxh iAqVdduzXhkQe/ilt8jHSAxpBm1LvIOEhkFh2hN+UD7Slk9pBCPYIM1a6HpzPYFgO/59 8lka+f1to3U1CTSwkMS21WCii8Mp3f6s+ILOd/YF/7BNM9UhVMXAvMIKdRMdjN4Lt7eS BwzRcth6D6kC/s0YaerA2of1rsmT/Dv7Xz7UrYwf66DHGgCuaAiub4rdcrdDK7ds7Pmq aw5RsE1btyZGON7do3vrqi0pQWFyeHaGlF0Y+/Bs6CmX+NirpQqkWG+t3q0l5ZQrLTzD ohoQ== 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=juTN3G7jcRs7VidChtiBlBH5P0f4srwHiaL79KaCS2g=; b=dOfv/s1ha6XH0YY6CFycvcXDtlQv6HYhShpKiBfw0wGKHq79vIddpH9d/yWLXtpGZu CqZ1ZHs7M9E0Uryhk2y1skdCVZgh3t/dKR9HbTiFd3ihsZAmHVGUGh57FUbAtj8BipBO wwfiJ6QeT4MwIDPMB5NkWZW+Z3lUZ+nl7J4Dp3jqfSY7pKxtf1bnX5Hhrr5+G0Q1n40z 7n+mPuTROqvgtIqGtW0SmQtqiI/5dlT7Vph/L920jJIdblIUllqEKudmWAzFgV3AT2TL sGdsmrM8fN+dD3APeYfr21DXYmLd/DdMCNIG7rHRCTfcwCpPc+IfA64doALTxxAazU3E WMCQ== X-Gm-Message-State: AKS2vOxo6MjuhBrU+Pby2kicypIM+uG6q+A1DIGxziYajsRAQ/wnR2Nv 6W8rdaIRXw3/B97ADXE= X-Received: by 10.55.20.156 with SMTP id 28mr1967162qku.191.1497469708844; Wed, 14 Jun 2017 12:48:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 14 Jun 2017 12:48:19 -0700 Message-Id: <20170614194821.8754-4-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 3/5] target/mips: Exit after enabling interrupts 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: Yongbok Kim , pbonzini@redhat.com, cota@braap.org, alex.bennee@linaro.org, Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini Exit to cpu loop so we reevaluate cpu_mips_hw_interrupts. Cc: Aurelien Jarno Cc: Yongbok Kim Signed-off-by: Richard Henderson --- target/mips/translate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/mips/translate.c b/target/mips/translate.c index 559f8fe..891f14b 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -13403,9 +13403,11 @@ static void gen_pool32axf (CPUMIPSState *env, Disa= sContext *ctx, int rt, int rs) save_cpu_state(ctx, 1); gen_helper_ei(t0, cpu_env); gen_store_gpr(t0, rs); - /* Stop translation as we may have switched the execution = mode */ - ctx->bstate =3D BS_STOP; tcg_temp_free(t0); + /* BS_STOP isn't good enough here; + reevaluate cpu_mips_hw_interrupts_enabled. */ + gen_save_pc(ctx->pc + 4); + ctx->bstate =3D BS_EXCP; } break; default: --=20 2.9.4 From nobody Wed Nov 5 13:50:18 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.zoho.com; dkim=fail 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 1497469923884278.3178817519157; Wed, 14 Jun 2017 12:52:03 -0700 (PDT) Received: from localhost ([::1]:50619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLEKg-0003W3-Ad for importer@patchew.org; Wed, 14 Jun 2017 15:52:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLEHH-00014g-Ut for qemu-devel@nongnu.org; Wed, 14 Jun 2017 15:48:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLEHH-0008VM-2c for qemu-devel@nongnu.org; Wed, 14 Jun 2017 15:48:32 -0400 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:33458) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLEHG-0008Ux-UD for qemu-devel@nongnu.org; Wed, 14 Jun 2017 15:48:30 -0400 Received: by mail-qt0-x243.google.com with SMTP id w1so2208233qtg.0 for ; Wed, 14 Jun 2017 12:48:30 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 12:48:29 -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=KSKO5x6kh4jGJtDIJQs0iUOuEMoeV515Kis+PmDJV1E=; b=ZFzRWx7IE+xgF+Q3IZSu/OnDoZczeZJRLLtl7H62Qhr5EH8s36YRzfj+d9ZP7oMOkn pfb5paABF9qlCFPOR1XMWAqSBNYO346OTeUAKcg8L9JdwqvViv+Qo+XunOIGXVq42w+O FqyShVnFW86B+DlNpsASzoVetPjKx4n0kDdPyrKvpSHYXTKYrmJqoxQm45Z+bu7NWNM6 IKZnt8DC6VfIifbq0lxU2XcccWxSwxO/whiHxGA6qQY/Xdyu67CD5GSWFMTD2mzWd3zb FfLkWi+Oqxj5CedblWGBhIR3Ll3KdCDUUkimnHrmMfO1WqRcNGYzNkk/O5Yv2IgFR9X+ Fvcw== 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=KSKO5x6kh4jGJtDIJQs0iUOuEMoeV515Kis+PmDJV1E=; b=tD2yWnhy7gmWTOMa2IGeNsst8m4cplZi3bgWYEG4t6t4ksN8Yc4BOoTEZBshHd/eu7 wp7ne+gsNPKgF2BTgCanVWWldO0lBpz/8TFWH/uPdSZgIZWeWgljcgoua17VPWFy5Z9B qzULSWhYnb8QvlE3QK6nhMf5bDMtPtsvQYZ2XrQGSQeSoI5ohVvjyJXC6FHPCS8RvJly h08v7pYt5UjuLQFgT91m0KFb06YOAJcWREcJ7I0QAnNwPx8Cwthqy8KiFjrXeOl0R1ua M8ozSrxHkXia/3sZCIcDpepKIV7qtZmoVrGcnm6ICE77MPuEokiY7V685lO0CLGzFI0E GHRw== X-Gm-Message-State: AKS2vOyac0cCWHKuhAWa1wotvVWAZXATQ5ejdXq/BDkAFotC8d3G+5N/ aHg477KXIqfzDzYsdhU= X-Received: by 10.55.217.6 with SMTP id u6mr2038406qki.151.1497469710088; Wed, 14 Jun 2017 12:48:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 14 Jun 2017 12:48:20 -0700 Message-Id: <20170614194821.8754-5-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::243 Subject: [Qemu-devel] [PATCH v2 4/5] target/s390x: Exit after changing PSW mask 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Exit to cpu loop so we reevaluate cpu_s390x_hw_interrupts. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- target/alpha/translate.c | 2 +- target/s390x/translate.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/target/alpha/translate.c b/target/alpha/translate.c index a48e451..232af9e 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -1207,7 +1207,7 @@ static ExitStatus gen_call_pal(DisasContext *ctx, int= palcode) tcg_temp_free(tmp); =20 /* Allow interrupts to be recognized right away. */ - tcg_gen_movi_i64(cpu_pc, ctx.pc); + tcg_gen_movi_i64(cpu_pc, ctx->pc); return EXIT_PC_UPDATED_NOCHAIN; =20 case 0x36: diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 95f91d4..c9e3b81 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -1174,6 +1174,8 @@ typedef enum { /* We are exiting the TB, but have neither emitted a goto_tb, nor updated the PC for the next instruction to be executed. */ EXIT_PC_STALE, + /* We are exiting the TB to the main loop. */ + EXIT_PC_STALE_NOCHAIN, /* We are ending the TB with a noreturn function call, e.g. longjmp. No following code will be executed. */ EXIT_NORETURN, @@ -3796,7 +3798,8 @@ static ExitStatus op_ssm(DisasContext *s, DisasOps *o) { check_privileged(s); tcg_gen_deposit_i64(psw_mask, psw_mask, o->in2, 56, 8); - return NO_EXIT; + /* Exit to main loop to reevaluate s390_cpu_exec_interrupt. */ + return EXIT_PC_STALE_NOCHAIN; } =20 static ExitStatus op_stap(DisasContext *s, DisasOps *o) @@ -4044,7 +4047,9 @@ static ExitStatus op_stnosm(DisasContext *s, DisasOps= *o) } else { tcg_gen_ori_i64(psw_mask, psw_mask, i2 << 56); } - return NO_EXIT; + + /* Exit to main loop to reevaluate s390_cpu_exec_interrupt. */ + return EXIT_PC_STALE_NOCHAIN; } =20 static ExitStatus op_stura(DisasContext *s, DisasOps *o) @@ -5794,6 +5799,7 @@ void gen_intermediate_code(CPUS390XState *env, struct= TranslationBlock *tb) case EXIT_NORETURN: break; case EXIT_PC_STALE: + case EXIT_PC_STALE_NOCHAIN: update_psw_addr(&dc); /* FALLTHRU */ case EXIT_PC_UPDATED: @@ -5805,14 +5811,14 @@ void gen_intermediate_code(CPUS390XState *env, stru= ct TranslationBlock *tb) /* Exit the TB, either by raising a debug exception or by return. = */ if (do_debug) { gen_exception(EXCP_DEBUG); - } else if (use_exit_tb(&dc)) { + } else if (use_exit_tb(&dc) || status =3D=3D EXIT_PC_STALE_NOCHAIN= ) { tcg_gen_exit_tb(0); } else { tcg_gen_lookup_and_goto_ptr(psw_addr); } break; default: - abort(); + g_assert_not_reached(); } =20 gen_tb_end(tb, num_insns); --=20 2.9.4 From nobody Wed Nov 5 13:50:18 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.zoho.com; dkim=fail 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 1497470001227537.7186239005734; Wed, 14 Jun 2017 12:53:21 -0700 (PDT) Received: from localhost ([::1]:50623 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLELw-0004nY-5R for importer@patchew.org; Wed, 14 Jun 2017 15:53:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54047) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLEHJ-00016i-GL for qemu-devel@nongnu.org; Wed, 14 Jun 2017 15:48:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLEHI-0008WD-Da for qemu-devel@nongnu.org; Wed, 14 Jun 2017 15:48:33 -0400 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:35162) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLEHI-0008W0-93; Wed, 14 Jun 2017 15:48:32 -0400 Received: by mail-qt0-x243.google.com with SMTP id x58so2210560qtc.2; Wed, 14 Jun 2017 12:48:32 -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.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 12:48:30 -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=EHln7mvAkRHwv9Qze1WRY4taLrjRwniYNbupA8mu76U=; b=uodO6Ntm1J/5gxoF4u2gZZWDAlZY1jRoojuS0gSeZMyfK50PPQVK8/RPxrC837fUkb RBreFOWrDRCdL2q1PoBJ2YwCT054NO+ltA6Au488rk39AtQkgJxsHkJ/dS7n4u8vW11m UXRKt0XLMQg5+u+iJ4XI2fe3Tu5YAwlGnttX3RVvzzeDUoJa1xgIcW7v1qQrG9Xee0Mj pepdil6ExuG6pb14h1sgkc12h0p61nxDvJfFXjYd/Zw7CGqCC3+xvA6KW/1lDErukclB V7nt87kPnX9PjgmhMi3Zz+6gWW7lPwEsfF2aiMGKFS3ZPZd8Yl1v/1urUnMNOaMWxYS/ Mmsw== 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=EHln7mvAkRHwv9Qze1WRY4taLrjRwniYNbupA8mu76U=; b=ZpdJ1fd7vCNiE3QBHB2nJzvheQgGyaoFIEKcgcyqOu26R7E3ThOd61frWxB7HQ6pm4 tWcSiEJJj9+ZPBd40nJgAznzan16g2tCBEnUEivboczon3gpryAg5OAqM2Ttmx73gVNB GGWg5qFiziwEpuj0td4sSEFouhphLzAIBnG9lmulCwSEwy0QtUuGoeSmjiUP9x7pQHxk aUBdMxjfJL4krs0QdB4bHrmpa+vSKDfFl/Uc08Vhydckix3E11oMQiDYTrmwH+ALzrbz rqht63rHeMC0qH33YFUBGD0izDLkfW4HxhN0pszZ4eH8WeGVZ7Tprh6wRbml2FAGHTPf CDHQ== X-Gm-Message-State: AKS2vOyfnwqMzjJWMBn/iTvj/5nKfVJ3mX3SuP5AYyqGR6gbc5eQrVuO AF9rdw+GeKQPDZpdf1s= X-Received: by 10.237.54.71 with SMTP id e65mr2312788qtb.146.1497469711524; Wed, 14 Jun 2017 12:48:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 14 Jun 2017 12:48:21 -0700 Message-Id: <20170614194821.8754-6-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::243 Subject: [Qemu-devel] [PATCH v2 5/5] target/arm: Exit after clearing interrupt mask 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, qemu-arm@nongnu.org, Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Exit to cpu loop so we reevaluate cpu_arm_hw_interrupts. Cc: qemu-arm@nongnu.org Cc: Peter Maydell Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e --- target/arm/translate-a64.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 860e279..e55547d 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1422,7 +1422,9 @@ static void handle_msr_i(DisasContext *s, uint32_t in= sn, gen_helper_msr_i_pstate(cpu_env, tcg_op, tcg_imm); tcg_temp_free_i32(tcg_imm); tcg_temp_free_i32(tcg_op); - s->is_jmp =3D DISAS_UPDATE; + /* For DAIFClear, exit the cpu loop to re-evaluate pending IRQs. = */ + gen_a64_set_pc_im(s->pc); + s->is_jmp =3D (op =3D=3D 0x1f ? DISAS_EXIT : DISAS_JUMP); break; } default: @@ -11369,6 +11371,9 @@ void gen_intermediate_code_a64(ARMCPU *cpu, Transla= tionBlock *tb) case DISAS_JUMP: tcg_gen_lookup_and_goto_ptr(cpu_pc); break; + case DISAS_EXIT: + tcg_gen_exit_tb(0); + break; case DISAS_TB_JUMP: case DISAS_EXC: case DISAS_SWI: --=20 2.9.4