From patchwork Fri Jul 31 15:37:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 51775 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 0B00E22D9C for ; Fri, 31 Jul 2015 15:38:22 +0000 (UTC) Received: by labth1 with SMTP id th1sf435315lab.2 for ; Fri, 31 Jul 2015 08:38:21 -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=j3LkhBSrQcFwVQlcHIZu3CB/74gA+tbR0OWaiGdGUVg=; b=kv5IG6s8i5eDVuw9iDA14hxaYOHQzabQCLSc4+Nq7y9aFNYWzwcph/VJEWrLnVJNng /qnXZcwKqojoqij2fQQktNmo7skPcAdSaBT54r0P1Ed9hUoS3YdL1N369PGkLFOc+6DT HkAWYU92UjWbBKNUcqDQcS0+lQtfwuT18FodgAsfxUO/UJgHfBoJVN4JwxhozF1g9gRU zmPow1egEL+NMTS3LhUChAAjAuwmXTqdai/v4ZXiJCgFBRbGjJsPwjZhqny2YUAd7Xed C6lktoPej0Zp4uYpZ3I5sXjowHW+W7uL8aGZqJ4UvodhTJ3KinCbF1sk9DQh+lnf++z+ AsSw== X-Gm-Message-State: ALoCoQnTtg9NBh/JTeHeEbNVv6I0CI2vcPULyL5J6bHi1XWVluhlJkIlVvx35yLLreqPGcj68vcJ X-Received: by 10.180.11.226 with SMTP id t2mr1263133wib.0.1438357101022; Fri, 31 Jul 2015 08:38:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.161 with SMTP id x1ls319396lal.45.gmail; Fri, 31 Jul 2015 08:38:20 -0700 (PDT) X-Received: by 10.152.29.6 with SMTP id f6mr3541320lah.85.1438357100823; Fri, 31 Jul 2015 08:38:20 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id lm12si4064699lac.115.2015.07.31.08.38.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Jul 2015 08:38:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by lafd3 with SMTP id d3so46638406laf.1 for ; Fri, 31 Jul 2015 08:38:20 -0700 (PDT) X-Received: by 10.152.18.162 with SMTP id x2mr3706937lad.73.1438357100725; Fri, 31 Jul 2015 08:38:20 -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 l6csp464374lba; Fri, 31 Jul 2015 08:38:19 -0700 (PDT) X-Received: by 10.70.37.77 with SMTP id w13mr8196506pdj.49.1438357094478; Fri, 31 Jul 2015 08:38:14 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id am4si11060662pad.93.2015.07.31.08.38.13; Fri, 31 Jul 2015 08:38:14 -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 S1754480AbbGaPiI (ORCPT + 28 others); Fri, 31 Jul 2015 11:38:08 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:35155 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753912AbbGaPiA (ORCPT ); Fri, 31 Jul 2015 11:38:00 -0400 Received: by pdrg1 with SMTP id g1so44553559pdr.2 for ; Fri, 31 Jul 2015 08:38:00 -0700 (PDT) X-Received: by 10.70.54.196 with SMTP id l4mr8285108pdp.42.1438357080332; Fri, 31 Jul 2015 08:38:00 -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.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 31 Jul 2015 08:37:59 -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 08/10] coresight-etm4x: Support context-ID tracing when PID namespace is enabled Date: Fri, 31 Jul 2015 09:37:28 -0600 Message-Id: <1438357050-22486-9-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.215.46 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 Like ETTv3, ETMv4 also needs the similar modifications to support Context ID tracing when PID namespace is enabled. Signed-off-by: Chunyan Zhang Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm4x.c | 21 +++++++++++++++------ drivers/hwtracing/coresight/coresight-etm4x.h | 3 +++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index 9afbda54b013..254a81a4e6f4 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -506,8 +506,11 @@ static ssize_t reset_store(struct device *dev, } drvdata->ctxid_idx = 0x0; - for (i = 0; i < drvdata->numcidc; i++) + for (i = 0; i < drvdata->numcidc; i++) { drvdata->ctxid_pid[i] = 0x0; + drvdata->ctxid_vpid[i] = 0x0; + } + drvdata->ctxid_mask0 = 0x0; drvdata->ctxid_mask1 = 0x0; @@ -1825,7 +1828,7 @@ static ssize_t ctxid_pid_show(struct device *dev, spin_lock(&drvdata->spinlock); idx = drvdata->ctxid_idx; - val = (unsigned long)drvdata->ctxid_pid[idx]; + val = (unsigned long)drvdata->ctxid_vpid[idx]; spin_unlock(&drvdata->spinlock); return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); } @@ -1835,7 +1838,7 @@ static ssize_t ctxid_pid_store(struct device *dev, const char *buf, size_t size) { u8 idx; - unsigned long val; + unsigned long vpid, pid; struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); /* @@ -1845,12 +1848,15 @@ static ssize_t ctxid_pid_store(struct device *dev, */ if (!drvdata->ctxid_size || !drvdata->numcidc) return -EINVAL; - if (kstrtoul(buf, 16, &val)) + if (kstrtoul(buf, 16, &vpid)) return -EINVAL; + pid = coresight_vpid_to_pid(vpid); + spin_lock(&drvdata->spinlock); idx = drvdata->ctxid_idx; - drvdata->ctxid_pid[idx] = (u64)val; + drvdata->ctxid_pid[idx] = (u64)pid; + drvdata->ctxid_vpid[idx] = (u64)vpid; spin_unlock(&drvdata->spinlock); return size; } @@ -2513,8 +2519,11 @@ static void etm4_init_default_data(struct etmv4_drvdata *drvdata) drvdata->addr_type[1] = ETM_ADDR_TYPE_RANGE; } - for (i = 0; i < drvdata->numcidc; i++) + for (i = 0; i < drvdata->numcidc; i++) { drvdata->ctxid_pid[i] = 0x0; + drvdata->ctxid_vpid[i] = 0x0; + } + drvdata->ctxid_mask0 = 0x0; drvdata->ctxid_mask1 = 0x0; diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index 1e8fb369daaf..c34100205ca9 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -266,6 +266,8 @@ * @ctxid_idx: Context ID index selector. * @ctxid_size: Size of the context ID field to consider. * @ctxid_pid: Value of the context ID comparator. + * @ctxid_vpid: Virtual PID seen by users if PID namespace is enabled, otherwise + * the same value of ctxid_pid. * @ctxid_mask0:Context ID comparator mask for comparator 0-3. * @ctxid_mask1:Context ID comparator mask for comparator 4-7. * @vmid_idx: VM ID index selector. @@ -353,6 +355,7 @@ struct etmv4_drvdata { u8 ctxid_idx; u8 ctxid_size; u64 ctxid_pid[ETMv4_MAX_CTXID_CMP]; + u64 ctxid_vpid[ETMv4_MAX_CTXID_CMP]; u32 ctxid_mask0; u32 ctxid_mask1; u8 vmid_idx;