From patchwork Mon Nov 4 18:12:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 178464 Delivered-To: patch@linaro.org Received: by 2002:ac9:3c86:0:0:0:0:0 with SMTP id w6csp4389490ocf; Mon, 4 Nov 2019 10:13:29 -0800 (PST) X-Google-Smtp-Source: APXvYqz7O+wSUdEDa9x6DajQ8K05x8T/uuaaiy5RDqq8bSWl/ja9PVsMp4AMMF9B5XGkb205btxc X-Received: by 2002:a05:6402:b02:: with SMTP id bm2mr8799185edb.130.1572891209721; Mon, 04 Nov 2019 10:13:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572891209; cv=none; d=google.com; s=arc-20160816; b=cEZ9ZjVI3zqWDZ0hs76Evyt95imXCfHGLaothJHIm9Z0K9Bqbalt3E6ajS5SLIEo5j yZB2yxYd5fjTcuR0mJ3QGX3K0fuEqS2SSc8axkqumNTyXhiSfur9mMBoW4vwLDiuU+4I xqP68Q+tlOxzzaKySicfbp8wbWmp4zw2ztKFelv4hHPvzQ9K9UOX6PWiG8QezAsk+v0B VWmjQ7ZNaczAyZHIMMhgyy8ZA9ZrvsziAcKnK0WL6eDhOTU/fAxUoK0JgbSOMTzm36Sx J0R2C3ohprsiSUVb+KRTLVVeQkR5oNnZbo5gRSvavkeyexbXgof965NaCew7vD7qL42o MwMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=UoBtG+nF16UHzafLtrzcMC8PlFDrifr/5EvMb5ijQAs=; b=B8vSLM6+Z2QUo3rCOh8PIj/w/sKQBFOtFGu0b82GVl3hC+nkx58G/2qdl+lwXGcyxO xZ1Asdxw0pF+mwqh7oqrFIfQFhYjeZCvrN/ywR1ZN4ZXFT8LKqvL/wYBU2JVQYs6Q6Un cB0+LXE6iTceOMvMztuDRlGwbSdBmk7EGhzMr6HNbSAVI+fqSb7HVzGQVIG+aIxDCsCe uJyuI3A8d+Z1ogzGZiqs+mh1i4R0dZo7gS4y0AznknnsMdSRG56vZBvyAg5nbWJT+Th/ osZdoeH3QD1oj4nyMm2Bu8aVwuU2yHmEpb1vUiTG4Z8Ryeqd+Etn4Owfaxa5PpEF7rCA TFZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jVYwJFxe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si4722268ejr.30.2019.11.04.10.13.29; Mon, 04 Nov 2019 10:13:29 -0800 (PST) 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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jVYwJFxe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729601AbfKDSNH (ORCPT + 26 others); Mon, 4 Nov 2019 13:13:07 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43768 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729560AbfKDSNC (ORCPT ); Mon, 4 Nov 2019 13:13:02 -0500 Received: by mail-pf1-f194.google.com with SMTP id 3so12828302pfb.10 for ; Mon, 04 Nov 2019 10:13:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UoBtG+nF16UHzafLtrzcMC8PlFDrifr/5EvMb5ijQAs=; b=jVYwJFxeB6vT5IGMoonP3YF6fOpjwXCdfVOS/7OpSJX4cc4wXAj962jWkdB9GsBCxY bjHhNgBeA2Wm7EGhnkcZXmP62Jt4Uo6WmftW4ZmaPG9Xoq3lKYwZwI3+BAKuCuxz1IGu B6rbpe7+yCnDIM3QCEx8zpAxF+vB0bURB+tKN4patZAPNoZfFHHvtTZJsMVfcgxjAMq9 WWCAZGyCSkc0BoG2GUS+qmk7k46nvqAE+KEAydo59RoC8UPRfp4OthjYV+v3tiW4rN4N 8YQuDnqeOKhMqkwx5pxBv37c6L6CGZUs/tVRDIahaJl5bYHJGjWBGbi7CNKcvFpQqFdW SPwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UoBtG+nF16UHzafLtrzcMC8PlFDrifr/5EvMb5ijQAs=; b=LWzDIhgHq6M7e4RqWSS57Mq1b8EBsK3Anx0yc1juz8sjyA/0RMLAygd7lK+pBub+Z1 +1HSZTeseNA1MH/CeV8d2V4Huerz0udnGYHYyYp9n1gKYbx7pFa/qFee8qK5P1mTtgXG 1Z52IiFdqBxe/OW/7MADNu1DNoXZLDd3qxy14IEF5NckqIeARilwU7whrOtSBN+fOOTA 4a8yXRSbIQ7PgaVqGOSUarMQ1qccMhUIka+oSDfMDhmu4mGfSG3BPK3WjJdctlTdqM3D bfhFkoPyqwOVKjnLoNqkwKvuNvWwFtLxK6C9J2V3gwG1f+M81/zhudhGBJOuYV/PtVO4 7vJg== X-Gm-Message-State: APjAAAX/xzkEj3HCe+AGU8/lxmoOqMnBHuY4sEzDBhjSi9FEz2F2c+fL IgJOOQILLQYXp7GiLS2kpZ9wxdxtcQc= X-Received: by 2002:a63:e009:: with SMTP id e9mr24399463pgh.222.1572891180912; Mon, 04 Nov 2019 10:13:00 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id o12sm16149520pgl.86.2019.11.04.10.12.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2019 10:13:00 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/14] coresight: etm4x: Fix issues with start-stop logic. Date: Mon, 4 Nov 2019 11:12:44 -0700 Message-Id: <20191104181251.26732-8-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191104181251.26732-1-mathieu.poirier@linaro.org> References: <20191104181251.26732-1-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Leach Fixes the following issues when using the ETMv4 start-stop logic. 1) Setting a start or a stop address should not automatically set the start-stop status to 'on'. The value set by the user in 'mode' must be respected or start instances could be missed. 2) Missing API for controlling TRCVIPCSSCTLR - start stop control by PE comparators. 3) Default ETM configuration sets a trace all range, and correctly sets the start-stop status bit. This was not being correctly reflected in the 'mode' parameter. Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier --- .../coresight/coresight-etm4x-sysfs.c | 39 +++++++++++++++++-- drivers/hwtracing/coresight/coresight-etm4x.c | 1 + 2 files changed, 36 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c index 97a33cf98797..ea1e034809a0 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -217,6 +217,7 @@ static ssize_t reset_store(struct device *dev, /* No start-stop filtering for ViewInst */ config->vissctlr = 0x0; + config->vipcssctlr = 0x0; /* Disable seq events */ for (i = 0; i < drvdata->nrseqstate-1; i++) @@ -1059,8 +1060,6 @@ static ssize_t addr_start_store(struct device *dev, config->addr_val[idx] = (u64)val; config->addr_type[idx] = ETM_ADDR_TYPE_START; config->vissctlr |= BIT(idx); - /* SSSTATUS, bit[9] - turn on start/stop logic */ - config->vinst_ctrl |= BIT(9); spin_unlock(&drvdata->spinlock); return size; } @@ -1116,8 +1115,6 @@ static ssize_t addr_stop_store(struct device *dev, config->addr_val[idx] = (u64)val; config->addr_type[idx] = ETM_ADDR_TYPE_STOP; config->vissctlr |= BIT(idx + 16); - /* SSSTATUS, bit[9] - turn on start/stop logic */ - config->vinst_ctrl |= BIT(9); spin_unlock(&drvdata->spinlock); return size; } @@ -1274,6 +1271,39 @@ static ssize_t addr_exlevel_s_ns_store(struct device *dev, } static DEVICE_ATTR_RW(addr_exlevel_s_ns); +static ssize_t vinst_pe_cmp_start_stop_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + unsigned long val; + struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); + struct etmv4_config *config = &drvdata->config; + + if (!drvdata->nr_pe_cmp) + return -EINVAL; + val = config->vipcssctlr; + return scnprintf(buf, PAGE_SIZE, "%#lx\n", val); +} +static ssize_t vinst_pe_cmp_start_stop_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t size) +{ + unsigned long val; + struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); + struct etmv4_config *config = &drvdata->config; + + if (kstrtoul(buf, 16, &val)) + return -EINVAL; + if (!drvdata->nr_pe_cmp) + return -EINVAL; + + spin_lock(&drvdata->spinlock); + config->vipcssctlr = val; + spin_unlock(&drvdata->spinlock); + return size; +} +static DEVICE_ATTR_RW(vinst_pe_cmp_start_stop); + static ssize_t seq_idx_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -2080,6 +2110,7 @@ static struct attribute *coresight_etmv4_attrs[] = { &dev_attr_addr_ctxtype.attr, &dev_attr_addr_context.attr, &dev_attr_addr_exlevel_s_ns.attr, + &dev_attr_vinst_pe_cmp_start_stop.attr, &dev_attr_seq_idx.attr, &dev_attr_seq_state.attr, &dev_attr_seq_event.attr, diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index efe120925f9d..d5148afdbe80 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -887,6 +887,7 @@ static void etm4_set_default_filter(struct etmv4_config *config) * in the started state */ config->vinst_ctrl |= BIT(9); + config->mode |= ETM_MODE_VIEWINST_STARTSTOP; /* No start-stop filtering for ViewInst */ config->vissctlr = 0x0;