From patchwork Fri Jun 24 20:18:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alarson@ddci.com X-Patchwork-Id: 9198117 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 77A7D60871 for ; Fri, 24 Jun 2016 20:18:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 681D1284D0 for ; Fri, 24 Jun 2016 20:18:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A845284D5; Fri, 24 Jun 2016 20:18:56 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 BEDD1284D0 for ; Fri, 24 Jun 2016 20:18:55 +0000 (UTC) Received: from localhost ([::1]:47170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGXZ0-0003qk-EN for patchwork-qemu-devel@patchwork.kernel.org; Fri, 24 Jun 2016 16:18:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGXYm-0003qe-3x for qemu-devel@nongnu.org; Fri, 24 Jun 2016 16:18:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGXYg-0006yV-3M for qemu-devel@nongnu.org; Fri, 24 Jun 2016 16:18:39 -0400 Received: from linux03.ddci.com ([184.183.10.182]:27895 helo=linux03a.ddci.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGXYf-0006yL-RE; Fri, 24 Jun 2016 16:18:34 -0400 Received: from linux03a.ddci.com (localhost.localdomain [127.0.0.1]) by linux03a.ddci.com (8.13.8/8.13.8) with ESMTP id u5OKITGv007161; Fri, 24 Jun 2016 13:18:29 -0700 Received: (from alarson@localhost) by linux03a.ddci.com (8.13.8/8.13.8/Submit) id u5OKISiY007160; Fri, 24 Jun 2016 13:18:28 -0700 Date: Fri, 24 Jun 2016 13:18:28 -0700 From: Aaron Larson Message-Id: <201606242018.u5OKISiY007160@linux03a.ddci.com> To: agraf@suse.de, alarson@ddci.com, david@gibson.dropbear.id.au, qemu-devel@nongnu.org, qemu-ppc@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 184.183.10.182 Subject: [Qemu-devel] [PATCH] 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 2f1c591..c4559b6 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 } }