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: 6914281 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 9542E9F39D for ; Fri, 31 Jul 2015 15:40:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01503203F3 for ; Fri, 31 Jul 2015 15:40:42 +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 7A2AD2054D for ; Fri, 31 Jul 2015 15:40:36 +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 1ZLCOZ-0000S5-TC; Fri, 31 Jul 2015 15:38:51 +0000 Received: from mail-pd0-f171.google.com ([209.85.192.171]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZLCNy-0000Dj-Tf for linux-arm-kernel@lists.infradead.org; Fri, 31 Jul 2015 15:38:15 +0000 Received: by pdrg1 with SMTP id g1so44553002pdr.2 for ; Fri, 31 Jul 2015 08:37:58 -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=L1edUUjWshgDbRgH8n8ffNC45R97nNpdv7TEslv1Lug=; b=hl4zGOSUm9rrsIdNx6VN1Tzl6n98stCEHrHNv5ePBYKU9uIesELMKJMnY9uHmLfNmZ JZ7/lEMW9FWLEx1uZzrqBgh9ue7a3NvTc9kXfNd1bQ6gwwFWOlTSyXvR7wDY7Eg0AfIW WKFGKJSXnjZJMKw/px6RJKf4BrqnlKTGKCK7s9AjGr88M7ETuS9xKjyRWm31/JtlwY8Y MQjWpBnrnlMEMFcsn9xZDBB4ISZmOnApORyBl9oQRmAw6qgi6tNfkkLG6ahAPRc+fIaV HJuVQ7SQaAdfFcg/hU8DQJGW8hIc8lzK3Nxmt03+noECDoDF7AcICZ8xz47Yhr8oVxJH Mj/A== X-Gm-Message-State: ALoCoQmXmWTN6m4LirEbfOn/acvNbXNltf2wLcunsdEmURVFvTazQKsG6w+kCBUR7+xgKvklLSWm 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150731_083814_993376_7EDCE7AF 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: mathieu.poirier@linaro.org, linux-kernel@vger.kernel.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.6 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 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