From patchwork Fri Feb 26 06:05:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaidyanathan Srinivasan X-Patchwork-Id: 46306 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 4FC60B7F58 for ; Fri, 26 Feb 2010 17:05:23 +1100 (EST) Received: by ozlabs.org (Postfix) id 95CB6B7CC2; Fri, 26 Feb 2010 17:05:15 +1100 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from e23smtp05.au.ibm.com (e23smtp05.au.ibm.com [202.81.31.147]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e23smtp05.au.ibm.com", Issuer "Equifax" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 8B35DB7CBD for ; Fri, 26 Feb 2010 17:05:13 +1100 (EST) Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [202.81.31.247]) by e23smtp05.au.ibm.com (8.14.3/8.13.1) with ESMTP id o1Q61gal002876 for ; Fri, 26 Feb 2010 17:01:42 +1100 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o1Q5xeT51175728 for ; Fri, 26 Feb 2010 16:59:40 +1100 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o1Q65B5T030283 for ; Fri, 26 Feb 2010 17:05:11 +1100 Received: from dirshya.in.ibm.com ([9.126.239.8]) by d23av04.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o1Q655qG030172 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 26 Feb 2010 17:05:09 +1100 Date: Fri, 26 Feb 2010 11:35:03 +0530 From: Vaidyanathan Srinivasan To: Benjamin Herrenschmidt , Paul Mackerras , Anton Blanchard Subject: [PATCH] powerpc: export data from new hcall H_EM_GET_PARMS Message-ID: <20100226060503.GA19115@dirshya.in.ibm.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Cc: linuxppc-dev@ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: svaidy@linux.vnet.ibm.com List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Hi, A new hcall H_EM_GET_PARMS as been added to obtain power mode data from the platform. This data can be used by user space administrative tools for better power management. The following patch add data from this new hcall into the lparcfg driver and exports to user space along with other existing lpar data in /proc/powerpc/lparcfg Please review and include in powerpc tree. Thanks, Vaidy --- powerpc: export data from new hcall H_EM_GET_PARMS Add support for H_EM_GET_PARM hcall that will return data related to power modes from the platform. Export the data directly to user space for administrative tools to interpret and use. cat /proc/powerpc/lparcfg will export power mode data Signed-off-by: Vaidyanathan Srinivasan --- arch/powerpc/include/asm/hvcall.h | 1 + arch/powerpc/kernel/lparcfg.c | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h index f027581..ebe7493 100644 --- a/arch/powerpc/include/asm/hvcall.h +++ b/arch/powerpc/include/asm/hvcall.h @@ -228,6 +228,7 @@ #define H_JOIN 0x298 #define H_VASI_STATE 0x2A4 #define H_ENABLE_CRQ 0x2B0 +#define H_GET_EM_PARMS 0x2B8 #define H_SET_MPP 0x2D0 #define H_GET_MPP 0x2D4 #define MAX_HCALL_OPCODE H_GET_MPP diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c index 79a00bb..2e7dd7e 100644 --- a/arch/powerpc/kernel/lparcfg.c +++ b/arch/powerpc/kernel/lparcfg.c @@ -37,7 +37,7 @@ #include #include -#define MODULE_VERS "1.8" +#define MODULE_VERS "1.9" #define MODULE_NAME "lparcfg" /* #define LPARCFG_DEBUG */ @@ -486,6 +486,21 @@ static void splpar_dispatch_data(struct seq_file *m) seq_printf(m, "dispatch_dispersions=%lu\n", dispatch_dispersions); } + +static void parse_em_data(struct seq_file *m) +{ + int rc; + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; + + rc = plpar_hcall(H_GET_EM_PARMS, retbuf); + + if (rc != H_SUCCESS) + return; + + seq_printf(m, "power_mode_data=%016lx\n", retbuf[0]); + return; + +} static int pseries_lparcfg_data(struct seq_file *m, void *v) { int partition_potential_processors; @@ -540,6 +555,8 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) seq_printf(m, "slb_size=%d\n", mmu_slb_size); + parse_em_data(m); + return 0; }