From patchwork Tue May 26 23:39:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankit Gupta X-Patchwork-Id: 6486321 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 186B89F38C for ; Tue, 26 May 2015 23:39:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 063FA206D2 for ; Tue, 26 May 2015 23:39:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EFD53206CC for ; Tue, 26 May 2015 23:39:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751295AbbEZXj1 (ORCPT ); Tue, 26 May 2015 19:39:27 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38579 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751061AbbEZXj0 (ORCPT ); Tue, 26 May 2015 19:39:26 -0400 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 2D38D140CAD; Tue, 26 May 2015 23:39:25 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 0E0F2140F68; Tue, 26 May 2015 23:39:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gavidov-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ankgupta@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 03BCB140CAD; Tue, 26 May 2015 23:39:22 +0000 (UTC) From: Ankit Gupta To: gavidov@codeaurora.org, sdharia@codeaurora.org, ivan.ivanov@linaro.org, svarbanov@mm-sol.com, rostedt@goodmis.org, linux-arm-msm@vger.kernel.org, gregkh@linuxfoundation.org, sboyd@codeaurora.org, collinsd@codeaurora.org, osvaldob@codeaurora.org Cc: linux-kernel@vger.kernel.org, mlocke@codeaurora.org, galak@codeaurora.org, agross@codeaurora.org, Ankit Gupta Subject: [PATCH] spmi-pmic-arb: add irq tracepoints to the pmic-arb driver Date: Tue, 26 May 2015 17:39:15 -0600 Message-Id: <1432683555-4644-1-git-send-email-ankgupta@codeaurora.org> X-Mailer: git-send-email 2.3.0 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The spmi-pmic-arb is also an interrupt controller. It gets a single aggregate irq and disseminates it to individual pmic-peripheral drivers. Each pmic-peripheral has a unique apid number, and can have multiple interrupt capable functions. The registered apid range shows the lowest and highest apid numbers of pmic-peripheral drivers which request irqs. Pid is the base address of that peripheral. For performance measurement, tracepoints are added at the beginning of the aggregate irq and at the end of the individual pmic-peripheral irqs. Following is a list showing the new tracepoint events: spmi_pmic_arb_aggregate_irq_start: aggregate irq number and registered apid range. spmi_pmic_arb_apid_irq_end: apid, irq, func_num, sid and pid. SPMI Interrupts tracepoints can be enabled like: echo 1 >/sys/kernel/debug/tracing/events/spmi-pmic-arb/enable and will dump messages that can be viewed in /sys/kernel/debug/tracing/trace that look like: ... spmi_pmic_arb_aggregate_irq_start: irq=150 registered apid range=(3,189) ... spmi_pmic_arb_apid_irq_end: apid=3 irq=1 func_num=0 sid=0 pid=0x8 Suggested-by: Sagar Dharia Signed-off-by: Gilad Avidov Signed-off-by: Ankit Gupta --- drivers/spmi/spmi-pmic-arb.c | 15 ++++++--- include/trace/events/spmi-pmic-arb.h | 62 ++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 include/trace/events/spmi-pmic-arb.h diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 20559ab..342a71d 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -23,6 +23,9 @@ #include #include +#define CREATE_TRACE_POINTS +#include + /* PMIC Arbiter configuration registers */ #define PMIC_ARB_VERSION 0x0000 #define PMIC_ARB_INT_EN 0x0004 @@ -375,16 +378,17 @@ static void periph_interrupt(struct spmi_pmic_arb_dev *pa, u8 apid) unsigned int irq; u32 status; int id; + u16 ppid = pa->apid_to_ppid[apid]; + u8 sid = (ppid >> 8) & 0x0F; + u8 pid = ppid & 0xFF; status = readl_relaxed(pa->intr + SPMI_PIC_IRQ_STATUS(apid)); while (status) { id = ffs(status) - 1; status &= ~(1 << id); - irq = irq_find_mapping(pa->domain, - pa->apid_to_ppid[apid] << 16 - | id << 8 - | apid); + irq = irq_find_mapping(pa->domain, ppid << 16 | id << 8 | apid); generic_handle_irq(irq); + trace_spmi_pmic_arb_apid_irq_end(apid, irq, id, sid, pid); } } @@ -399,7 +403,8 @@ static void pmic_arb_chained_irq(unsigned int irq, struct irq_desc *desc) int i, id; chained_irq_enter(chip, desc); - + trace_spmi_pmic_arb_aggregate_irq_start(irq, pa->min_apid, + pa->max_apid); for (i = first; i <= last; ++i) { status = readl_relaxed(intr + SPMI_PIC_OWNER_ACC_STATUS(pa->ee, i)); diff --git a/include/trace/events/spmi-pmic-arb.h b/include/trace/events/spmi-pmic-arb.h new file mode 100644 index 0000000..6c4dbca --- /dev/null +++ b/include/trace/events/spmi-pmic-arb.h @@ -0,0 +1,62 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM spmi-pmic-arb + +#if !defined(_TRACE_SPMI_PMIC_ARB_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_SPMI_PMIC_ARB_H + +#include +#include + +/* + * drivers/spmi/spmi-pmic-arb.c + */ + +TRACE_EVENT(spmi_pmic_arb_aggregate_irq_start, + TP_PROTO(unsigned int irq, int first, int last), + TP_ARGS(irq, first, last), + + TP_STRUCT__entry( + __field ( unsigned int, irq ) + __field ( int, first ) + __field ( int, last ) + ), + + TP_fast_assign( + __entry->irq = irq; + __entry->first = first; + __entry->last = last; + ), + + TP_printk("irq=%d registered apid range=(%d,%d)", + (int)__entry->irq, __entry->first, __entry->last) +); + +TRACE_EVENT(spmi_pmic_arb_apid_irq_end, + TP_PROTO(u8 apid, unsigned int irq, int func_num, u8 sid, u8 pid), + TP_ARGS(apid, irq, func_num, sid, pid), + + TP_STRUCT__entry( + __field ( u8, apid ) + __field ( unsigned int, irq ) + __field ( int, func_num ) + __field ( u8, sid ) + __field ( u8, pid ) + ), + + TP_fast_assign( + __entry->apid = apid; + __entry->irq = irq; + __entry->func_num = func_num; + __entry->sid = sid; + __entry->pid = pid; + ), + + TP_printk("apid=%d irq=%d func_num=%d sid=%d pid=0x%d", + (int)__entry->apid, (int)__entry->irq, (int)__entry->func_num, + (int)__entry->sid, (int)__entry->pid) +); + +#endif /* _TRACE_SPMI_PMIC_ARB_H */ + +/* This part must be outside protection */ +#include