From patchwork Mon Jan 22 03:42:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125330 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp953300ljf; Sun, 21 Jan 2018 20:18:20 -0800 (PST) X-Google-Smtp-Source: AH8x226n8NAMIPMBgngNy5n0JqnkspygDjkvtoQ32dn/Uhr2I8lFq5izozsWELBRawcIdTw8VG7k X-Received: by 10.37.187.72 with SMTP id b8mr6170338ybk.89.1516594700545; Sun, 21 Jan 2018 20:18:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516594700; cv=none; d=google.com; s=arc-20160816; b=L7cwGNjthPvvGMIFIrDEOoV4OzGzFkd0yOfuR8SrpGp5d/cnmYX+0akgi9N15L4Ejq iG64Z/+UZw7pDOVY6ToAO0ctu10nZcYGWdfkO4js0+Y/tirbSuew1rY+0y6FyxVBRQcK bO2Xj4yjiK9yvQ4e+I/Z9PKyy+Nxm2+kSCYNkKH5a6VUt5VVCWYpyNoyZs2xBufvQvmA 5r1ycR2pAw1Sp5kBVrtP7tJweE/3sVJQaNx460gfd7ArMmKyqqljrAkUmnqWMDAuycVS Yw/UIinTXlm6d4VFy02ZoWeVbc1pFzFBNBKUS/OJYnmIMTyFZaUlYHC3mPBhKaaIf7pR nZiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=NFK44SG8TiV+12Xa+isXZfQRMWHIoxl2sIziVt78rTA=; b=k04T7trF6UMgNrJjQcuWj5SbT9fs+bXG/uK0EQEp9pb/dR0nZnFQtCDrgwSD6GY4Yr Jhc6fjuad0Bw8zQO5FXwEwA3RnuY2xrFQI3XXGL55wtmhAgfnhx5RtOyupY/8A56gFM+ TSCASZgb1darnhu4CuwNnVpLS9nZ7FWV+nrwFGuwG4sJ+Y6WvFJzdIYlDwy9ZVaptbu7 u2+Cl9/7U49kXHzD6t9yHoyfZ00oKh6Np102gMyOcgUUidr9UuQzcVrbj52LO9iIIgq7 kozub8/Z9S/1+ktJRvqrILvLrf+dZmXyZtX8IK0/q8ltyryTm/3kPEJUT5nPGA5gRWyT /Xdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ncl9C9+W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k10si1796578ybc.63.2018.01.21.20.18.20 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 21 Jan 2018 20:18:20 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Ncl9C9+W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edTYp-0007IU-Tq for patch@linaro.org; Sun, 21 Jan 2018 23:18:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edT10-00064s-6A for qemu-devel@nongnu.org; Sun, 21 Jan 2018 22:43:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edT0v-0006rN-6r for qemu-devel@nongnu.org; Sun, 21 Jan 2018 22:43:22 -0500 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:42504) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1edT0v-0006qu-0T for qemu-devel@nongnu.org; Sun, 21 Jan 2018 22:43:17 -0500 Received: by mail-pf0-x243.google.com with SMTP id b25so6074221pfd.9 for ; Sun, 21 Jan 2018 19:43:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NFK44SG8TiV+12Xa+isXZfQRMWHIoxl2sIziVt78rTA=; b=Ncl9C9+WmBdftbjBbizHAf5bBntswXSR3i/Vkfvht6vgret9XaFsd5Trem5wlHBkE9 8DaYMcR+3yRALOy+CZvgO1RQUA57P7grBXJp5ItTTxG14+ZGe6zCjAl4rDh3a8oPFQzA eAJv1SDGqEXyqKYsEqMn19PUwHvQQPADyLjS4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NFK44SG8TiV+12Xa+isXZfQRMWHIoxl2sIziVt78rTA=; b=CBNItWdH2AiXKBUR5vfFyuHl5B4Wc5IFs0y1GUJ9lKmbRrXLjmaLRMwkBsnLKocw6G 7auuQruHSy8YEKIYGcqzRnxSWop3HRmlC+53VMGkLYhlyIuFJVJH90c03NfzMjVXqhiZ kQXFb6XmLlIVXftfvVN6owML9rw+106tPZSedcwmS6zMcs2l6njwoWByrsGJYnDmJttK Swl0AjZPPvQ+TRXueN51aKPiQmoGy/JRxyVVSVX1R7Tbf0uGc2QMqstfkEcJwlwpBgSh 4a9gbiZ0J4ZK7CdiptVh0qomtikq1M/51ZRxG+zAcZh6kyFXBdxbsd98RIqVBSq7rcVq 55fw== X-Gm-Message-State: AKwxytfGVSQ/g95wadBqvsrP7iZ8RrDq72VzhcHX3JA1OGlJKixA1cga lb8vJ5j/RYeDALctE1m1Bc3YoD61fes= X-Received: by 2002:a17:902:b181:: with SMTP id s1-v6mr2724777plr.93.1516592595663; Sun, 21 Jan 2018 19:43:15 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-6-47.tukw.qwest.net. [174.21.6.47]) by smtp.gmail.com with ESMTPSA id z125sm182023pfz.27.2018.01.21.19.43.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Jan 2018 19:43:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 21 Jan 2018 19:42:12 -0800 Message-Id: <20180122034217.19593-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180122034217.19593-1-richard.henderson@linaro.org> References: <20180122034217.19593-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PULL 38/43] target/hppa: Implement a pause instruction 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is an extension to the base ISA, but we can use this in the kernel idle loop to reduce the host cpu time consumed. Signed-off-by: Richard Henderson --- target/hppa/translate.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) -- 2.14.3 diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 76ed7e1ad4..8884754f05 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2815,9 +2815,45 @@ static DisasJumpType trans_ds(DisasContext *ctx, uint32_t insn, return nullify_end(ctx, DISAS_NEXT); } +#ifndef CONFIG_USER_ONLY +/* These are QEMU extensions and are nops in the real architecture: + * + * or %r10,%r10,%r10 -- idle loop; wait for interrupt + * or %r31,%r31,%r31 -- death loop; offline cpu + * currently implemented as idle. + */ +static DisasJumpType trans_pause(DisasContext *ctx, uint32_t insn, + const DisasInsn *di) +{ + TCGv_i32 tmp; + + /* No need to check for supervisor, as userland can only pause + until the next timer interrupt. */ + nullify_over(ctx); + + /* Advance the instruction queue. */ + copy_iaoq_entry(cpu_iaoq_f, ctx->iaoq_b, cpu_iaoq_b); + copy_iaoq_entry(cpu_iaoq_b, ctx->iaoq_n, ctx->iaoq_n_var); + nullify_set(ctx, 0); + + /* Tell the qemu main loop to halt until this cpu has work. */ + tmp = tcg_const_i32(1); + tcg_gen_st_i32(tmp, cpu_env, -offsetof(HPPACPU, env) + + offsetof(CPUState, halted)); + tcg_temp_free_i32(tmp); + gen_excp_1(EXCP_HALTED); + + return nullify_end(ctx, DISAS_NORETURN); +} +#endif + static const DisasInsn table_arith_log[] = { { 0x08000240u, 0xfc00ffffu, trans_nop }, /* or x,y,0 */ { 0x08000240u, 0xffe0ffe0u, trans_copy }, /* or x,0,t */ +#ifndef CONFIG_USER_ONLY + { 0x094a024au, 0xffffffffu, trans_pause }, /* or r10,r10,r10 */ + { 0x0bff025fu, 0xffffffffu, trans_pause }, /* or r31,r31,r31 */ +#endif { 0x08000000u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_andc_reg }, { 0x08000200u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_and_reg }, { 0x08000240u, 0xfc000fe0u, trans_log, .f.ttt = tcg_gen_or_reg },