Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751945AbdFEMb5 (ORCPT ); Mon, 5 Jun 2017 08:31:57 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52108 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751530AbdFEMbz (ORCPT ); Mon, 5 Jun 2017 08:31:55 -0400 From: Anju T Sudhakar To: mpe@ellerman.id.au Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, ego@linux.vnet.ibm.com, bsingharora@gmail.com, anton@samba.org, sukadev@linux.vnet.ibm.com, mikey@neuling.org, stewart@linux.vnet.ibm.com, dja@axtens.net, eranian@google.com, hemant@linux.vnet.ibm.com, maddy@linux.vnet.ibm.com, anju@linux.vnet.ibm.com Subject: [PATCH v9 08/10] powerpc/powernv: Thread IMC events detection Date: Mon, 5 Jun 2017 18:00:17 +0530 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496665818-543-1-git-send-email-anju@linux.vnet.ibm.com> References: <1496665818-543-1-git-send-email-anju@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17060512-0012-0000-0000-0000023EE368 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060512-0013-0000-0000-00000756FFD4 Message-Id: <1496665818-543-7-git-send-email-anju@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-05_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706050237 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3350 Lines: 93 Code to add support for detection of thread IMC events. It adds a new domain IMC_DOMAIN_THREAD and it is determined with the help of the "type" property in the imc device-tree. Signed-off-by: Anju T Sudhakar Signed-off-by: Hemant Kumar Signed-off-by: Madhavan Srinivasan --- arch/powerpc/include/asm/imc-pmu.h | 1 + arch/powerpc/include/asm/opal-api.h | 1 + arch/powerpc/perf/imc-pmu.c | 1 + arch/powerpc/platforms/powernv/opal-imc.c | 9 ++++++++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/imc-pmu.h b/arch/powerpc/include/asm/imc-pmu.h index 5227660..5cbc61d 100644 --- a/arch/powerpc/include/asm/imc-pmu.h +++ b/arch/powerpc/include/asm/imc-pmu.h @@ -96,6 +96,7 @@ struct imc_pmu { */ #define IMC_DOMAIN_NEST 1 #define IMC_DOMAIN_CORE 2 +#define IMC_DOMAIN_THREAD 3 #define IMC_COUNTER_ENABLE 1 #define IMC_COUNTER_DISABLE 0 diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h index 047370e..ba1f534 100644 --- a/arch/powerpc/include/asm/opal-api.h +++ b/arch/powerpc/include/asm/opal-api.h @@ -1008,6 +1008,7 @@ enum { /* In-Memory Collection Counters Type */ enum { + IMC_COUNTER_PER_THREAD = 0x1, IMC_COUNTER_PER_SUB_CORE = 0x2, IMC_COUNTER_PER_CORE = 0x4, IMC_COUNTER_PER_QUAD = 0x8, diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c index 6d32c3f..e67680f 100644 --- a/arch/powerpc/perf/imc-pmu.c +++ b/arch/powerpc/perf/imc-pmu.c @@ -21,6 +21,7 @@ /* Needed for sanity check */ extern u64 nest_max_offset; extern u64 core_max_offset; +extern u64 thread_max_offset; struct imc_pmu *per_nest_pmu_arr[IMC_MAX_PMUS]; static cpumask_t nest_imc_cpumask; diff --git a/arch/powerpc/platforms/powernv/opal-imc.c b/arch/powerpc/platforms/powernv/opal-imc.c index d0d26dd..9bcf58b 100644 --- a/arch/powerpc/platforms/powernv/opal-imc.c +++ b/arch/powerpc/platforms/powernv/opal-imc.c @@ -36,6 +36,7 @@ u64 nest_max_offset; u64 core_max_offset; +u64 thread_max_offset; static int imc_event_prop_update(char *name, struct imc_events *events) { @@ -120,6 +121,10 @@ static void update_max_value(u32 value, int pmu_domain) if (core_max_offset < value) core_max_offset = value; break; + case IMC_DOMAIN_THREAD: + if (thread_max_offset < value) + thread_max_offset = value; + break; default: /* Unknown domain, return */ return; @@ -405,7 +410,7 @@ static int imc_get_mem_addr_nest(struct device_node *node, /* * imc_pmu_create : Takes the parent device which is the pmu unit, pmu_index * and domain as the inputs. - * Allocates memory for the pmu, sets up its domain (NEST/CORE), and + * Allocates memory for the pmu, sets up its domain (NEST/CORE/THREAD), and * calls imc_events_setup() to allocate memory for the events supported * by this pmu. Assigns a name for the pmu. * @@ -524,6 +529,8 @@ static int opal_imc_counters_probe(struct platform_device *pdev) domain = IMC_DOMAIN_NEST; else if (type == IMC_COUNTER_PER_CORE) domain = IMC_DOMAIN_CORE; + else if (type == IMC_COUNTER_PER_THREAD) + domain = IMC_DOMAIN_THREAD; else continue; if (!imc_pmu_create(imc_dev, pmu_count, domain)) -- 2.7.4