From patchwork Mon Nov 7 04:47:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ananth N Mavinakayanahalli X-Patchwork-Id: 123997 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 6528FB71E2 for ; Mon, 7 Nov 2011 15:47:56 +1100 (EST) Received: by ozlabs.org (Postfix) id 4C49CB6F75; Mon, 7 Nov 2011 15:47:47 +1100 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from e4.ny.us.ibm.com (e4.ny.us.ibm.com [32.97.182.144]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e4.ny.us.ibm.com", Issuer "Equifax" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 84CB9B6F7D for ; Mon, 7 Nov 2011 15:47:44 +1100 (EST) Received: from /spool/local by e4.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 6 Nov 2011 23:47:40 -0500 Received: from d01relay04.pok.ibm.com ([9.56.227.236]) by e4.ny.us.ibm.com ([192.168.1.104]) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 6 Nov 2011 23:47:39 -0500 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pA74lcBi321230 for ; Sun, 6 Nov 2011 23:47:38 -0500 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pA74lbQD027281 for ; Sun, 6 Nov 2011 21:47:37 -0700 Received: from thinktux.localdomain (thinktux.in.ibm.com [9.124.35.28]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id pA74la6v027266; Sun, 6 Nov 2011 21:47:36 -0700 Received: by thinktux.localdomain (Postfix, from userid 500) id 0AFBE220179; Mon, 7 Nov 2011 10:17:50 +0530 (IST) Date: Mon, 7 Nov 2011 10:17:50 +0530 From: Ananth N Mavinakayanahalli To: linuxppc-dev@ozlabs.org Subject: [PATCH] powerpc: Export PIR data through sysfs Message-ID: <20111107044750.GB4361@in.ibm.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17 (2007-11-01) x-cbid: 11110704-3534-0000-0000-000001513842 Cc: Anton Blanchard , mahesh@linux.vnet.ibm.com X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: ananth@in.ibm.com List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org The Processor Identification Register (PIR) on powerpc provides information to decode the processor identification tag. Decoding this information platform specfic. Export PIR data via sysfs. (Powerpc manuals state this register is 'optional'. I am not sure though if there are any Linux supported powerpc platforms that don't have it. Code in the kernel referencing PIR isn't under a platform ifdef). Signed-off-by: Ananth N Mavinakayanahalli --- arch/powerpc/kernel/sysfs.c | 6 ++++++ 1 file changed, 6 insertions(+) Index: linux-3.1/arch/powerpc/kernel/sysfs.c =================================================================== --- linux-3.1.orig/arch/powerpc/kernel/sysfs.c +++ linux-3.1/arch/powerpc/kernel/sysfs.c @@ -177,11 +177,13 @@ SYSFS_PMCSETUP(mmcra, SPRN_MMCRA); SYSFS_PMCSETUP(purr, SPRN_PURR); SYSFS_PMCSETUP(spurr, SPRN_SPURR); SYSFS_PMCSETUP(dscr, SPRN_DSCR); +SYSFS_PMCSETUP(pir, SPRN_PIR); static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra); static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL); static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr); static SYSDEV_ATTR(purr, 0600, show_purr, store_purr); +static SYSDEV_ATTR(pir, 0400, show_pir, NULL); unsigned long dscr_default = 0; EXPORT_SYMBOL(dscr_default); @@ -394,6 +396,8 @@ static void __cpuinit register_cpu_onlin sysdev_create_file(s, &attr_dscr); #endif /* CONFIG_PPC64 */ + sysdev_create_file(s, &attr_pir); + cacheinfo_cpu_online(cpu); } @@ -464,6 +468,8 @@ static void unregister_cpu_online(unsign sysdev_remove_file(s, &attr_dscr); #endif /* CONFIG_PPC64 */ + sysdev_remove_file(s, &attr_pir); + cacheinfo_cpu_offline(cpu); }