From patchwork Sun May 28 06:52:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noam Camus X-Patchwork-Id: 767831 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wb9YD6810z9ryr for ; Sun, 28 May 2017 16:52:48 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mjBk5TvD"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=co4cl3M/jQv8LV5pmUEKL6odmLHRUbjfobpujLpwj5I=; b=mjBk5TvDLZSrq+dhPg8eBHoAq0 6G+KOZzylg0zWByT+bJ+kgRgsmhI1Ty2Jml+GuEYrnGMxuEHSZ8LC8+Brj0FBPdofvxT/okHEW1+0 y0vZsywtO0qm+hOU/+4Hjmeju1VNreYqtpXRzf6wSkUkJUc0TgAR5h5fURoulGnVkCDkvTVX2eYJV tu1nf/Qvzi3t9OknKYoTUR/xDGO4BL9ete4iTHCT832J2CRd9NDcpJDTKI7ckTMEGBf3KL4OYMgeC FzSsI0/EE3BSsJmd3DtDVB+7PT751EWN12TJ2p2KtM5qt3qMqhNgEER/5du0z7kgxYMjpvQeJ6vqa iv6BIHBQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dEs4F-0005mE-1B; Sun, 28 May 2017 06:52:47 +0000 Received: from mail-il-dmz.mellanox.com ([193.47.165.129] helo=mellanox.co.il) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dEs46-0005cw-1e for linux-snps-arc@lists.infradead.org; Sun, 28 May 2017 06:52:43 +0000 Received: from Internal Mail-Server by MTLPINE1 (envelope-from noamca@mellanox.com) with ESMTPS (AES256-SHA encrypted); 28 May 2017 09:52:10 +0300 Received: from nps20.mtl.labs.mlnx. (l-nps20.mtl.labs.mlnx [10.7.191.20]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v4S6qAdo014805; Sun, 28 May 2017 09:52:10 +0300 From: Noam Camus To: linux-snps-arc@lists.infradead.org Subject: [PATCH v2 09/11] ARC: [plat-eznps] use schd.wft instruction instead of sleep at idle task Date: Sun, 28 May 2017 09:52:06 +0300 Message-Id: <1495954328-28736-10-git-send-email-noamca@mellanox.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1495954328-28736-1-git-send-email-noamca@mellanox.com> References: <1495954328-28736-1-git-send-email-noamca@mellanox.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170527_235238_519666_1B5ED38D X-CRM114-Status: UNSURE ( 7.87 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Noam Camus , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Noam Camus When HW threads are active we want CPU to enter idle state only for the calling HW thread and not to put on sleep all HW threads sharing this core. For this need the NPS400 got dedicated instruction so only calling thread is entring sleep and all other are still awake and can execute instructions. Signed-off-by: Noam Camus --- arch/arc/kernel/process.c | 7 +++++++ arch/arc/plat-eznps/include/plat/ctop.h | 1 + 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c index 2a018de..d3c39e4 100644 --- a/arch/arc/kernel/process.c +++ b/arch/arc/kernel/process.c @@ -82,10 +82,17 @@ void arch_cpu_idle(void) { /* sleep, but enable all interrupts before committing */ +#if !defined(CONFIG_EZNPS_MTM_EXT) __asm__ __volatile__( "sleep %0 \n" : :"I"(ISA_SLEEP_ARG)); /* can't be "r" has to be embedded const */ +#else + __asm__ __volatile__( + ".word %0 \n" + : + :"i"(CTOP_INST_HWSCHD_WFT_IE12)); +#endif } asmlinkage void ret_from_fork(void); diff --git a/arch/arc/plat-eznps/include/plat/ctop.h b/arch/arc/plat-eznps/include/plat/ctop.h index ee2e32d..7729d3d 100644 --- a/arch/arc/plat-eznps/include/plat/ctop.h +++ b/arch/arc/plat-eznps/include/plat/ctop.h @@ -46,6 +46,7 @@ #define CTOP_AUX_UDMC (CTOP_AUX_BASE + 0x300) /* EZchip core instructions */ +#define CTOP_INST_HWSCHD_WFT_IE12 0x3E6F7344 #define CTOP_INST_HWSCHD_OFF_R4 0x3C6F00BF #define CTOP_INST_HWSCHD_RESTORE_R4 0x3E6F7103 #define CTOP_INST_SCHD_RW 0x3E6F7004