Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1997632ybv; Fri, 21 Feb 2020 07:04:04 -0800 (PST) X-Google-Smtp-Source: APXvYqxQIDbQNinzN1wh1LJ9oFKNM4UMojM69vdl1wEjhXlvu495fn3AuM45Po/ensV9zKZh9nMN X-Received: by 2002:a05:6830:12d5:: with SMTP id a21mr29381295otq.296.1582297444458; Fri, 21 Feb 2020 07:04:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582297444; cv=none; d=google.com; s=arc-20160816; b=kRp3j0gMQvzcUDaSviVyjKfRaLx6/mljUcAvyOuhENA+kGQ+pF5g87ayBcAOEsQcvz MPbB4c+ZhaPC7rxhw13VttVjPtgkGORMWoAvyib9xNLlgIeevIxa4XA8/ltDjSGAk89d UlTMPeQLm/AkUyGRPgHWOnsL5/505lTIVOzOu0rp/+/C22CEwBHqeQWDqqiXvtanr2UU rf4jKs+lAQkZuKxI+PfElmoP0oPYT3qmTu9IxBiZ0pts0EMtY5B6xXFyIyEqfWoHbrvJ 09NsJ1ptuY7RehCHMq/1pYiQMqDcRtfgo17WTPCWQCsDa5L6yBZp+hnh/qsFlpGn/7v2 aJFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=mXg//dSw27nPdbFxtD08IYInmwAkE7g/oT8l0EpzlsA=; b=T+HSEJKRGKojKy4sfoAmFG8DasRgR44prQ2WbJ+kgmEWm5YekEm6CmpCHXkEkMdQ2L 5aJjmtUrf/9QaRiC5nD/Jd0JUq35gp5Aa+mP663oGuHZNPEQJFqUjti7zV7De3TUrCNs AORet5101xu2n6U1i/ntsgdNAxQ1Y/nr8p+bFX2lRguRqSjpEmGyoRkfzdjZj7YRCzp7 koMNTXu4/z1MC7UdHZPJp088/aW0JQXohNdij5WjF3o1sB6bcmR1xCHNla3UPoCdIIdD tngls7l5h5R1+ieiH3IaBom1wIvYwBs4gD9W40ny0NKyVfaGxwHW1LVICYIZTFQVL4dG iKSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3si903322oif.122.2020.02.21.07.03.34; Fri, 21 Feb 2020 07:04:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728901AbgBUPD0 (ORCPT + 99 others); Fri, 21 Feb 2020 10:03:26 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:46096 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727315AbgBUPD0 (ORCPT ); Fri, 21 Feb 2020 10:03:26 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01LEscNa128445; Fri, 21 Feb 2020 10:03:19 -0500 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y9sbvkjv0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Feb 2020 10:03:18 -0500 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 01LF0bt0002688; Fri, 21 Feb 2020 15:03:18 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma03dal.us.ibm.com with ESMTP id 2y6897u8rs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Feb 2020 15:03:17 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01LF3GOB54067536 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Feb 2020 15:03:16 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 95F98136066; Fri, 21 Feb 2020 15:03:16 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 86245136065; Fri, 21 Feb 2020 15:03:16 +0000 (GMT) Received: from localhost (unknown [9.41.179.160]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 21 Feb 2020 15:03:16 +0000 (GMT) From: Nathan Lynch To: "Gautham R. Shenoy" Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Michael Ellerman , Vaidyanathan Srinivasan , Kamalesh Babulal , "Naveen N. Rao" , Tyrel Datwyler Subject: Re: [PATCH v2 1/5] powerpc: Move idle_loop_prolog()/epilog() functions to header file In-Reply-To: <1582262314-8319-2-git-send-email-ego@linux.vnet.ibm.com> References: <1582262314-8319-1-git-send-email-ego@linux.vnet.ibm.com> <1582262314-8319-2-git-send-email-ego@linux.vnet.ibm.com> Date: Fri, 21 Feb 2020 09:03:16 -0600 Message-ID: <87lfowt22z.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-21_04:2020-02-21,2020-02-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 mlxscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 suspectscore=1 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002210115 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Gautham R. Shenoy" writes: > From: "Gautham R. Shenoy" > > Currently prior to entering an idle state on a Linux Guest, the > pseries cpuidle driver implement an idle_loop_prolog() and > idle_loop_epilog() functions which ensure that idle_purr is correctly > computed, and the hypervisor is informed that the CPU cycles have been > donated. > > These prolog and epilog functions are also required in the default > idle call, i.e pseries_lpar_idle(). Hence move these accessor > functions to a common header file and call them from > pseries_lpar_idle(). Since the existing header files such as > asm/processor.h have enough clutter, create a new header file > asm/idle.h. > > Signed-off-by: Gautham R. Shenoy > --- > arch/powerpc/include/asm/idle.h | 27 +++++++++++++++++++++++++++ > arch/powerpc/platforms/pseries/setup.c | 7 +++++-- > drivers/cpuidle/cpuidle-pseries.c | 24 +----------------------- > 3 files changed, 33 insertions(+), 25 deletions(-) > create mode 100644 arch/powerpc/include/asm/idle.h > > diff --git a/arch/powerpc/include/asm/idle.h b/arch/powerpc/include/asm/idle.h > new file mode 100644 > index 0000000..f32a7d8 > --- /dev/null > +++ b/arch/powerpc/include/asm/idle.h > @@ -0,0 +1,27 @@ > +#ifndef _ASM_POWERPC_IDLE_H > +#define _ASM_POWERPC_IDLE_H > +#include > + > +static inline void idle_loop_prolog(unsigned long *in_purr) > +{ > + ppc64_runlatch_off(); > + *in_purr = mfspr(SPRN_PURR); > + /* > + * Indicate to the HV that we are idle. Now would be > + * a good time to find other work to dispatch. > + */ > + get_lppaca()->idle = 1; > +} > + > +static inline void idle_loop_epilog(unsigned long in_purr) > +{ > + u64 wait_cycles; > + > + wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles); > + wait_cycles += mfspr(SPRN_PURR) - in_purr; > + get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles); > + get_lppaca()->idle = 0; > + > + ppc64_runlatch_on(); > +} > +#endif Looks fine and correct as a cleanup, but asm/include/idle.h and idle_loop_prolog, idle_loop_epilog, strike me as too generic for pseries-specific code.