From patchwork Fri Jul 31 15:37:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 51779 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id D0D0B22D9C for ; Fri, 31 Jul 2015 15:39:24 +0000 (UTC) Received: by labth1 with SMTP id th1sf443913lab.2 for ; Fri, 31 Jul 2015 08:39:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=9cWJu5zNADu6kxZRN/OY/DOM1SWpsHjfeHEPk4NwqUY=; b=eO0zGhaZRILeTqEi+88i1D6bsZHuJBnVhVoxusbkMTeVZdB+tO24MmCzeWmws3x48m O0KNxN0fjIe8bI2i8ba5/9knbC3t2c0UkTtdfSCry0YPax8dTnesR8ETRdk4adGXApoR GyO2/bcd8IEdh5aXjNU+yUmTl1wB1xvLgl4ipjKUzbVnzO8ZfJ4/uIcGwJkGq0/o7VgF fd+n8ogToKvs9mOtNCmIA850lHjSpPVbj/quIUwXS9K0l/0xJEtE2F//zAMElQ2kfhFW GoiiyMrSM86qq9y0XZ5EPmzzbTjyfk1PukiNRX+CvHf6vUlLxu2IzMx9lmeIEU/wgG6O wPcw== X-Gm-Message-State: ALoCoQlVnfgka+Ly1dKu07BpheBe36ZEyIsGWCi1vPNxkWUL+eBGJZ2rYvA/F7hQ7PQ+vaI5bWMG X-Received: by 10.194.179.42 with SMTP id dd10mr1115243wjc.7.1438357163765; Fri, 31 Jul 2015 08:39:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.116.36 with SMTP id jt4ls334433lab.4.gmail; Fri, 31 Jul 2015 08:39:23 -0700 (PDT) X-Received: by 10.152.4.98 with SMTP id j2mr3580825laj.67.1438357163495; Fri, 31 Jul 2015 08:39:23 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id kx6si4069119lac.108.2015.07.31.08.39.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Jul 2015 08:39:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by lbbyj8 with SMTP id yj8so48592893lbb.0 for ; Fri, 31 Jul 2015 08:39:23 -0700 (PDT) X-Received: by 10.112.120.134 with SMTP id lc6mr3737817lbb.86.1438357163390; Fri, 31 Jul 2015 08:39:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp464938lba; Fri, 31 Jul 2015 08:39:22 -0700 (PDT) X-Received: by 10.70.129.3 with SMTP id ns3mr8145358pdb.166.1438357161393; Fri, 31 Jul 2015 08:39:21 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si1658459pdf.39.2015.07.31.08.39.20; Fri, 31 Jul 2015 08:39:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754772AbbGaPjP (ORCPT + 28 others); Fri, 31 Jul 2015 11:39:15 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:35130 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754131AbbGaPh6 (ORCPT ); Fri, 31 Jul 2015 11:37:58 -0400 Received: by pdrg1 with SMTP id g1so44553003pdr.2 for ; Fri, 31 Jul 2015 08:37:58 -0700 (PDT) X-Received: by 10.70.3.4 with SMTP id 4mr8103779pdy.103.1438357078113; Fri, 31 Jul 2015 08:37:58 -0700 (PDT) Received: from t430.cg.shawcable.net ([184.64.168.246]) by smtp.gmail.com with ESMTPSA id y2sm8317284pdi.80.2015.07.31.08.37.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 31 Jul 2015 08:37:57 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org Subject: [PATCH 06/10] Coresight: Add an interface for supporting ETM3/4 Context ID tracing Date: Fri, 31 Jul 2015 09:37:26 -0600 Message-Id: <1438357050-22486-7-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438357050-22486-1-git-send-email-mathieu.poirier@linaro.org> References: <1438357050-22486-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mathieu.poirier@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Chunyan Zhang 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 Signed-off-by: Mathieu Poirier --- include/linux/coresight.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 3486b9082adb..626da6948ca2 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