From patchwork Fri Nov 17 14:08:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 839016 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ydg7w0gg1z9ryr for ; Sat, 18 Nov 2017 01:13:32 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sNsigP+5"; 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 3ydg7v6SkzzDrRk for ; Sat, 18 Nov 2017 01:13:31 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sNsigP+5"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c00::244; helo=mail-pf0-x244.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sNsigP+5"; dkim-atps=neutral Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (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 3ydg2f23gCzDrSH for ; Sat, 18 Nov 2017 01:08:58 +1100 (AEDT) Received: by mail-pf0-x244.google.com with SMTP id a84so2044344pfl.0 for ; Fri, 17 Nov 2017 06:08:58 -0800 (PST) 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=oyXAQe3mbDyP+x4EiK94A+aSgc22h/24rhHcd42ll/U=; b=sNsigP+5Truivd3z/eJX4qah9Y5Oe6MWFp2hGAxN76x1lNuulYeT6xnBm/n+LuicNc SD92CMEGpYeDWYah+5Ih8h87uX5+4x5AkhlCTWUec2XljiEHqBAkMo2eXAUEEqFWcq8N VAVZ8VQ9zuajDW1u+WUUtmtfKlLT/HgVNF6kOFMbvzYsYtvaM6ejHHT3CCyykaJTkSE/ dH9Jke3LJhkKNpgknqId5rdj/EvslTE1dKUW/Kdf4f9kRvqYeIqDsU0Op3YOzjH4tWXe GZ8hH15Xg4PuzQtGthbXDn3RKkWYqvooM8Hzj2kXUV50OabwbfpR+DqAqh0ToTvJhbYp zEgw== 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=oyXAQe3mbDyP+x4EiK94A+aSgc22h/24rhHcd42ll/U=; b=DS1GqWa5SmR6GGHiiqmo1PM8OmrVHQluWTKgPAAcuB5AEOjuo4LeIj/IQ2YZCHMDCz GkP2q47N9rfrRXO8JNcELn6mGfS2AIt4OZDtQIu6tPtk44QCDrfCtKFKpv9m6GEZ8rK+ oyJKKKeV/RIE2GWazzb95pJ3/nHSXC3FdUiqpE7LgCu1LDF2QipQVjUTn7ZnL108v9w5 ixXEGp7w3eN56lpNKF2H6uR5M1UmQj6EbIoW96FwjqbM/WzUSPsUd1xIpuquIqucrcSv OzdkCvMeNAMXAL5AoYTDf+8j3tnI5a1GEncJv3f/0jeZ1qeg1kgDdcKRl+xaCYnjrs/1 oc8A== X-Gm-Message-State: AJaThX5q9uA5Ur4Hz7JBIwIA4fYi1kKZ+6xL2ngurbBtyCENRwqg06za tciQq73hS7R7s++8XlQqwsWYsQ== X-Google-Smtp-Source: AGs4zMZRw2FEG0xs2ZNbINTqL5c3GPvKnkuis6HIa7apRoh0gONyYdBjSrv8FL0MYewAjbRvQGCj+g== X-Received: by 10.84.132.35 with SMTP id 32mr5249499ple.225.1510927735991; Fri, 17 Nov 2017 06:08:55 -0800 (PST) Received: from roar.au.ibm.com (27-33-241-2.tpgi.com.au. [27.33.241.2]) by smtp.gmail.com with ESMTPSA id w64sm9024357pfj.62.2017.11.17.06.08.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 06:08:55 -0800 (PST) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 1/3] powerpc/64s/idle: POWER9 implement a separate idle stop function for hotplug Date: Sat, 18 Nov 2017 00:08:05 +1000 Message-Id: <20171117140807.22105-2-npiggin@gmail.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171117140807.22105-1-npiggin@gmail.com> References: <20171117140807.22105-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Gautham R . Shenoy" , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Implement a new function to invoke stop, power9_offline_stop, which is like power9_idle_stop but used by the cpu hotplug code. Move KVM secondary state manipulation code to the offline case. Signed-off-by: Nicholas Piggin Reviewed-by: Vaidyanathan Srinivasan --- arch/powerpc/include/asm/processor.h | 1 + arch/powerpc/kernel/idle_book3s.S | 24 ++++++++++++++++++------ arch/powerpc/platforms/powernv/idle.c | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index bdab3b74eb98..0ebdb58460ce 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h @@ -500,6 +500,7 @@ extern int powersave_nap; /* set if nap mode can be used in idle loop */ extern unsigned long power7_idle_insn(unsigned long type); /* PNV_THREAD_NAP/etc*/ extern void power7_idle_type(unsigned long type); extern unsigned long power9_idle_stop(unsigned long psscr_val); +extern unsigned long power9_offline_stop(unsigned long psscr_val); extern void power9_idle_type(unsigned long stop_psscr_val, unsigned long stop_psscr_mask); diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S index 01e1c1997893..2f8364e7b489 100644 --- a/arch/powerpc/kernel/idle_book3s.S +++ b/arch/powerpc/kernel/idle_book3s.S @@ -325,12 +325,6 @@ enter_winkle: * r3 - PSSCR value corresponding to the requested stop state. */ power_enter_stop: -#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE - /* Tell KVM we're entering idle */ - li r4,KVM_HWTHREAD_IN_IDLE - /* DO THIS IN REAL MODE! See comment above. */ - stb r4,HSTATE_HWTHREAD_STATE(r13) -#endif /* * Check if we are executing the lite variant with ESL=EC=0 */ @@ -435,6 +429,24 @@ _GLOBAL(power9_idle_stop) b pnv_powersave_common /* No return */ +/* + * Entered with MSR[EE]=0 and no soft-masked interrupts pending. + * r3 contains desired PSSCR register value. + */ +_GLOBAL(power9_offline_stop) + std r3, PACA_REQ_PSSCR(r13) + mtspr SPRN_PSSCR,r3 +#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE + /* Tell KVM we're entering idle */ + li r4,KVM_HWTHREAD_IN_IDLE + /* DO THIS IN REAL MODE! See comment above. */ + stb r4,HSTATE_HWTHREAD_STATE(r13) +#endif + LOAD_REG_ADDR(r4,power_enter_stop) + b pnv_powersave_common + /* No return */ + + /* * On waking up from stop 0,1,2 with ESL=1 on POWER9 DD1, * HSPRG0 will be set to the HSPRG0 value of one of the diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c index 443d5ca71995..a921d5428d76 100644 --- a/arch/powerpc/platforms/powernv/idle.c +++ b/arch/powerpc/platforms/powernv/idle.c @@ -434,7 +434,7 @@ unsigned long pnv_cpu_offline(unsigned int cpu) psscr = mfspr(SPRN_PSSCR); psscr = (psscr & ~pnv_deepest_stop_psscr_mask) | pnv_deepest_stop_psscr_val; - srr1 = power9_idle_stop(psscr); + srr1 = power9_offline_stop(psscr); } else if ((idle_states & OPAL_PM_WINKLE_ENABLED) && (idle_states & OPAL_PM_LOSE_FULL_CONTEXT)) {