From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIs7j-0003b0-40 for qemu-devel@nongnu.org; Fri, 01 Jul 2016 02:40:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIs7g-0003Gh-IE for qemu-devel@nongnu.org; Fri, 01 Jul 2016 02:40:22 -0400 From: David Gibson Date: Fri, 1 Jul 2016 16:41:54 +1000 Message-Id: <1467355319-28406-19-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1467355319-28406-1-git-send-email-david@gibson.dropbear.id.au> References: <1467355319-28406-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PULL 18/23] target-ppc: gen_pause for instructions: yield, mdoio, mdoom, miso List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: agraf@suse.de, benh@kernel.crashing.org, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Aaron Larson , David Gibson From: Aaron Larson Call gen_pause for all "or rx,rx,rx" encodings other nop. This provides a reasonable implementation for yield, and a better approximation for mdoio, mdoom, and miso. The choice to pause for all encodings !=0 leverages the PowerISA admonition that the reserved encodings might change program priority, providing a slight "future proofing". Signed-off-by: Aaron Larson Acked-by: Benjamin Herrenschmidt Signed-off-by: David Gibson --- target-ppc/translate.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 49fe761..92030b6 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -1471,7 +1471,7 @@ static void gen_or(DisasContext *ctx) } else if (unlikely(Rc(ctx->opcode) != 0)) { gen_set_Rc0(ctx, cpu_gpr[rs]); #if defined(TARGET_PPC64) - } else { + } else if (rs != 0) { /* 0 is nop */ int prio = 0; switch (rs) { @@ -1514,7 +1514,6 @@ static void gen_or(DisasContext *ctx) break; #endif default: - /* nop */ break; } if (prio) { @@ -1524,13 +1523,15 @@ static void gen_or(DisasContext *ctx) tcg_gen_ori_tl(t0, t0, ((uint64_t)prio) << 50); gen_store_spr(SPR_PPR, t0); tcg_temp_free(t0); - /* Pause us out of TCG otherwise spin loops with smt_low - * eat too much CPU and the kernel hangs - */ + } #if !defined(CONFIG_USER_ONLY) - gen_pause(ctx); + /* Pause out of TCG otherwise spin loops with smt_low eat too much + * CPU and the kernel hangs. This applies to all encodings other + * than no-op, e.g., miso(rs=26), yield(27), mdoio(29), mdoom(30), + * and all currently undefined. + */ + gen_pause(ctx); #endif - } #endif } } -- 2.7.4