From patchwork Tue Jul 7 08:41:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 6731241 Return-Path: X-Original-To: patchwork-linux-arm@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 0AF709F38C for ; Tue, 7 Jul 2015 08:46:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 40A6A2073F for ; Tue, 7 Jul 2015 08:46:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5B3C204FF for ; Tue, 7 Jul 2015 08:46:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZCOU5-0000qx-Tb; Tue, 07 Jul 2015 08:44:09 +0000 Received: from mail-pd0-f169.google.com ([209.85.192.169]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZCOTl-0000TL-Hs for linux-arm-kernel@lists.infradead.org; Tue, 07 Jul 2015 08:43:50 +0000 Received: by pdbep18 with SMTP id ep18so121985490pdb.1 for ; Tue, 07 Jul 2015 01:43:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8M/fJNtPgSFnleI0Uu5Pv6Fi45LxWrB2I66dp+nYuRA=; b=BtT57JpEmVk79qPt6f76N7/iAnLHJODM6M+EazCKWiBorQqHPG8h+V0YYhqhTzG6OC MsaxPAjgtMPOudIYJzRChahOF/a7MaVCrMdgeryeFO5rcAAcDUNIKUTe4FxgwdLZhvRB XKRtKN2P7CfzB7GfD4r6THp1NLsLDaBzddxXZX+O+8UA91HuwHKfrylP/xkaB/8NBber RTzLJDnHmq6RbehNDu46IJ+r3mstPV6RIRhp7kWTjSHgzgwkgmmwWz2upLk2tnJcaeQf iXs1Bi6mpmyPE0iVmERBObGQqIE57zXDe2vBiamc2pVUt/Q23qPXDCXFhLKR5GWtPfwP isxQ== X-Gm-Message-State: ALoCoQlUsXFuVkDPxa9800NCRwiEXjojmjqzqfx2ut6aRT+NOEFsbDjgWI9x9vizqQmhAs6XsQFr X-Received: by 10.68.252.106 with SMTP id zr10mr6632035pbc.79.1436258608772; Tue, 07 Jul 2015 01:43:28 -0700 (PDT) Received: from zcy-ubuntu.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id k3sm21037825pde.18.2015.07.07.01.43.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Jul 2015 01:43:27 -0700 (PDT) From: Chunyan Zhang To: mathieu.poirier@linaro.org, gregkh@linuxfoundation.org Subject: [PATCH 3/5] Coresight: Add an interface for supporting ETM3/4 Context ID tracing Date: Tue, 7 Jul 2015 16:41:56 +0800 Message-Id: <1436258518-9339-4-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436258518-9339-1-git-send-email-zhang.chunyan@linaro.org> References: <1436258518-9339-1-git-send-email-zhang.chunyan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150707_014349_617741_EE8D5B7F X-CRM114-Status: GOOD ( 13.76 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: zhang.lyra@gmail.com, linux-kernel@vger.kernel.org, broonie@kernel.org, linux-api@vger.kernel.org, serge.broslavsky@linaro.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If PID namespace is enabled, everytime users configure the Context ID register to trace the specific process, there needs to be a translation between the real PID seen from the kernel and VPID seen from the namespace in which the user's process resides . This patch just adds the translation interface for ETMs. Signed-off-by: Chunyan Zhang --- include/linux/coresight.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 3486b90..626da69 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -248,4 +248,24 @@ static inline struct coresight_platform_data *of_get_coresight_platform_data( struct device *dev, struct device_node *node) { return NULL; } #endif +#ifdef CONFIG_PID_NS +static inline unsigned long +coresight_vpid_to_pid(unsigned long vpid) +{ + struct task_struct *task = NULL; + unsigned long pid = 0; + + rcu_read_lock(); + task = find_task_by_vpid(vpid); + if (task) + pid = task_pid_nr(task); + rcu_read_unlock(); + + return pid; +} +#else +static inline unsigned long +coresight_vpid_to_pid(unsigned long vpid) { return vpid; } +#endif + #endif