From patchwork Tue Mar 14 09:23: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: 738597 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 3vj8gY2MH7z9s0g for ; Tue, 14 Mar 2017 20:33:45 +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="pd/47nN5"; 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 3vj8gY1K2wzDqkc for ; Tue, 14 Mar 2017 20:33:45 +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="pd/47nN5"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::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 3vj8Sm0ds2zDqYy for ; Tue, 14 Mar 2017 20:24:24 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="pd/47nN5"; dkim-atps=neutral Received: by mail-pg0-x242.google.com with SMTP id b5so23281441pgg.1 for ; Tue, 14 Mar 2017 02:24:23 -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=cDvLmu6Ya/2yGjlMh8L2ZxtGYZOF+ZulEoxTeHcrp1Q=; b=pd/47nN5r0CjyNi21MfDsJvpZozv8o4EZ7lplQVmctK8+jMwmkHtRdRLVTwrEteaep S1jWplr89OUHihP9dvMeaQy3x1XdLWqaIzYyxhr8jUS7Giq2z5f2CqG2MNwPSgO5jRkY QyqAYFghczt3CRPOBgUsOyYhpXRJh90LAf5DGM6ZzwAF9mcpwSrWne8KpvPqHJJRDB5k gCWSd/kMXCAAqSqXWGk4RoqZoP6siqzalQGFu+cPlY1lMqg4ckE1WhKd7tEx64sbK9sb N+wgRpMEmdpN/yZgTe9WOi8jsugtEraA6tfatntxgXhBYHBJ6xj6lmIhgmuLgVEumd0E ok8g== 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=cDvLmu6Ya/2yGjlMh8L2ZxtGYZOF+ZulEoxTeHcrp1Q=; b=kaOzRrah9zK9S0WiBJvUgR3FMD/81N0MH7WR2YzSIliErH8OmRVASajQUHII27pMFa rZvxlCNa7IapTayAcQUw/n5MMo2TNf+5ZeYmU8EDtQFh4CrHyRdqFznTsYuZoon9prND 3fhjvd4HuchN2rab29afN8sqJWBDqTnUIh0cgDJ0GdvBGfkbncsj0G5+nMGrG3uFzLYd 6aCtuvbxV6VoK1YDjczcDjJsolvItQXKHqLvlM3K8tYOAWN6vkHpymjM2eZewU1F6xKK 64ONQeyfij15IUawScb8LmxTWGHCLAKKRJVeDGnhICWnxPd7tcRvZn9U+zHLvnIrLYMw EWvA== X-Gm-Message-State: AMke39mUHDyoB1D7x5KaJTTbV2vM4cxWP5CgCJWtbwFCYfiITNqaz1GOHP0nyaQ/V4I3jA== X-Received: by 10.84.231.9 with SMTP id f9mr55213138plk.117.1489483462045; Tue, 14 Mar 2017 02:24:22 -0700 (PDT) Received: from roar.au.ibm.com ([203.221.48.234]) by smtp.gmail.com with ESMTPSA id s21sm37262882pfs.87.2017.03.14.02.24.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 02:24:20 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 5/8] powerpc/64s: use PACA_THREAD_IDLE_STATE only in POWER8 Date: Tue, 14 Mar 2017 19:23:46 +1000 Message-Id: <20170314092349.10981-6-npiggin@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170314092349.10981-1-npiggin@gmail.com> References: <20170314092349.10981-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: Gautham R Shenoy , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" POWER9 does not use this field, so it should be moved into the POWER8 code. Update the documentation in the paca struct too. Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/paca.h | 12 ++++++++++-- arch/powerpc/kernel/idle_book3s.S | 13 +++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h index 708c3e592eeb..bbb59e226a9f 100644 --- a/arch/powerpc/include/asm/paca.h +++ b/arch/powerpc/include/asm/paca.h @@ -165,11 +165,19 @@ struct paca_struct { #endif #ifdef CONFIG_PPC_POWERNV - /* Per-core mask tracking idle threads and a lock bit-[L][TTTTTTTT] */ + /* CPU idle fields */ + + /* + * Per-core word used to synchronize between threads. See + * asm/cpuidle.h, PNV_CORE_IDLE_* + */ u32 *core_idle_state_ptr; - u8 thread_idle_state; /* PNV_THREAD_RUNNING/NAP/SLEEP */ /* Mask to indicate thread id in core */ u8 thread_mask; + + /* POWER8 specific fields */ + /* PNV_THREAD_RUNNING/NAP/SLEEP */ + u8 thread_idle_state; /* Mask to denote subcore sibling threads */ u8 subcore_sibling_mask; #endif diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S index 9284ea0762b1..9bdfba75a5e7 100644 --- a/arch/powerpc/kernel/idle_book3s.S +++ b/arch/powerpc/kernel/idle_book3s.S @@ -389,9 +389,6 @@ 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 */ - #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE li r0,KVM_HWTHREAD_IN_KERNEL stb r0,HSTATE_HWTHREAD_STATE(r13) @@ -445,9 +442,13 @@ pnv_restore_hyp_resource_arch207: ld r2,PACATOC(r13); lbz r0,PACA_THREAD_IDLE_STATE(r13) - cmpwi cr2,r0,PNV_THREAD_NAP - cmpwi cr4,r0,PNV_THREAD_WINKLE - bgt cr2,pnv_wakeup_tb_loss /* Either sleep or Winkle */ + cmpwi cr2,r0,PNV_THREAD_NAP + cmpwi cr4,r0,PNV_THREAD_WINKLE + li r0,PNV_THREAD_RUNNING + stb r0,PACA_THREAD_IDLE_STATE(r13) /* Clear thread state */ + + bgt cr2,pnv_wakeup_tb_loss /* Either sleep or Winkle */ + /* * We fall through here if PACA_THREAD_IDLE_STATE shows we are waking