From patchwork Fri Jul 1 06:41:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 642850 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 3rgnMt34FNz9sDG for ; Fri, 1 Jul 2016 16:59:38 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b=VQ6y7VjW; dkim-atps=neutral Received: from localhost ([::1]:54037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIsQK-0001ZK-4X for incoming@patchwork.ozlabs.org; Fri, 01 Jul 2016 02:59:36 -0400 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 Received: from ozlabs.org ([2401:3900:2:1::2]:53502) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIs7g-0003FT-5a; Fri, 01 Jul 2016 02:40:20 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3rgmxS6WS4z9t1P; Fri, 1 Jul 2016 16:40:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1467355212; bh=dsgnm4+x23n6unid6Y1eYHOnBiQRnf3vVgVH6Ooaqeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VQ6y7VjW7dX2CtLaK/r8qcYWG55S2wLY1lfNdasgcpJrBzahkrQ/qYozZm+aacJHI s6xsVfWAVB7XHNDT5E7xrooxTs3Y6p39ExY7Wrvm5nbqQZ+p5b3jDPVLm+HFD0BVdm 2UZA0++Q+JsaINZy/Ajr21R7/QpmznZyRC1GsXO0= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 1 Jul 2016 16:41:54 +1000 Message-Id: <1467355319-28406-19-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.7.4 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> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 18/23] target-ppc: gen_pause for instructions: yield, mdoio, mdoom, miso 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: agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Aaron Larson , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 } }