From patchwork Wed Apr 19 13:05:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 752277 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w7NBX2Cx5z9ryk for ; Wed, 19 Apr 2017 23:29:08 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="E3LO+F/L"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3w7NBX19JTzDr4R for ; Wed, 19 Apr 2017 23:29:08 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="E3LO+F/L"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-io0-x242.google.com (mail-io0-x242.google.com [IPv6:2607:f8b0:4001:c06::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3w7Mh70gjTzDqwK for ; Wed, 19 Apr 2017 23:06:15 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="E3LO+F/L"; dkim-atps=neutral Received: by mail-io0-x242.google.com with SMTP id x86so3491822ioe.3 for ; Wed, 19 Apr 2017 06:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7lAig8m7lnA622CY5JOHs0ZyHzevEzJ/E99GfCwfw1M=; b=E3LO+F/LObRj/DVUCagpOOrEgYpztOzP31szPZgfO25Vz1IzbmJNZ9TYIK4ewh2hgY QuX8ROpouDXzFqTFqI/PQliz5MjGT6UGE15hTwI+wHcxVY7yxuN+RKEM+tfET5kRz4/H svsHUerXnIc1jMC/XP21KMkTDje8mWwN3hx7qrGK0P0eH1ye3Vnl/DO8C7iK6wWTdIS9 UxBPN2goeM4I4U2grRJB9+G9SCtDGmn2qwDAbmiopFNi6YxCsilDlheu0OTP1bO0PyG2 2Z/jlFA/nAY2Ae1TfaHijH4HA/tFQ6J9MNelfCLLRXeNqLyep4Nijo/ZtKAtATcLQ8IC s7UA== 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=7lAig8m7lnA622CY5JOHs0ZyHzevEzJ/E99GfCwfw1M=; b=DvoVTOC9ZRzSCKhbubu6xAcrgiq6Q3hV4WE0KXXqBGUET6oGITbQh+HefVTC2E5FIh SJDaK2ylkMWdUoF4fACu+4q5tkBtuHw154PGB+o83Md2yzST9uhWnZeEHNG6mq6jd3xZ A4rGREXfrhspJ5uB1f1TfhLsZoo0m7R+GxVoiaYvRgArjZXR5H6DyPZ0FUeqkAngnKNA Q24j8fCeVOk6GK0KtCIL3VanbS/dqjVTIIP8DEEAEW++v+LzJ+DW3w3JXgrsEM38+5mN xkmBER1lTkMmoX8kDr6/XiVECHPcoXuFHbWEVcXRGNys3ZyV9PApvijaQ+97aPrKRORK Gi9g== X-Gm-Message-State: AN3rC/4n4s72QEKpLmqirmPekFs1Dfn9o9Ps+WtVLWwJNc7psgB3OtiE uHWfoLWjF7nTgQ== X-Received: by 10.98.212.68 with SMTP id u4mr3015783pfl.73.1492607173354; Wed, 19 Apr 2017 06:06:13 -0700 (PDT) Received: from roar.au.ibm.com (14-202-189-126.tpgi.com.au. [14.202.189.126]) by smtp.gmail.com with ESMTPSA id i15sm4728860pfj.51.2017.04.19.06.06.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Apr 2017 06:06:12 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 4/9] powerpc/64s: use alternative feature patching Date: Wed, 19 Apr 2017 23:05:46 +1000 Message-Id: <20170419130551.32378-5-npiggin@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170419130551.32378-1-npiggin@gmail.com> References: <20170419130551.32378-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This reduces the number of nops for POWER8. Reviewed-by: Gautham R. Shenoy Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/idle_book3s.S | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S index effc02d8cd8a..695cff40b0fe 100644 --- a/arch/powerpc/kernel/idle_book3s.S +++ b/arch/powerpc/kernel/idle_book3s.S @@ -421,7 +421,11 @@ power9_dd1_recover_paca: */ .global pnv_powersave_wakeup pnv_powersave_wakeup: - bl pnv_restore_hyp_resource +BEGIN_FTR_SECTION + bl pnv_restore_hyp_resource_arch300 +FTR_SECTION_ELSE + bl pnv_restore_hyp_resource_arch207 +ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_300) li r0,PNV_THREAD_RUNNING stb r0,PACA_THREAD_IDLE_STATE(r13) /* Clear thread state */ @@ -449,7 +453,11 @@ pnv_powersave_wakeup: * * cr3 - set to gt if waking up with partial/complete hypervisor state loss */ -pnv_restore_hyp_resource: +pnv_restore_hyp_resource_arch300: + /* + * POWER ISA 3. Use PSSCR to determine if we + * are waking up from deep idle state + */ BEGIN_FTR_SECTION mflr r6 bl power9_dd1_recover_paca @@ -458,11 +466,6 @@ FTR_SECTION_ELSE ld r2, PACATOC(r13) ALT_FTR_SECTION_END_IFSET(CPU_FTR_POWER9_DD1) -BEGIN_FTR_SECTION - /* - * POWER ISA 3. Use PSSCR to determine if we - * are waking up from deep idle state - */ LOAD_REG_ADDRBASE(r5,pnv_first_deep_stop_state) ld r4,ADDROFF(pnv_first_deep_stop_state)(r5) @@ -477,12 +480,14 @@ BEGIN_FTR_SECTION blr /* Waking up without hypervisor state loss. */ -END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) - +/* Same calling convention as arch300 */ +pnv_restore_hyp_resource_arch207: /* * POWER ISA 2.07 or less. * Check if we slept with winkle. */ + ld r2,PACATOC(r13); + lbz r0,PACA_THREAD_IDLE_STATE(r13) cmpwi cr2,r0,PNV_THREAD_NAP cmpwi cr4,r0,PNV_THREAD_WINKLE