Received: by 10.192.165.148 with SMTP id m20csp4712526imm; Tue, 1 May 2018 02:17:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpnqeQ1R8W6UnnHW8k9rEc8mNqjGwbBoFhoplBt5IGuiS7vxyBd9asPRvoZl6s7TM02XP9x X-Received: by 2002:a17:902:bd8b:: with SMTP id q11-v6mr5001038pls.178.1525166261735; Tue, 01 May 2018 02:17:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525166261; cv=none; d=google.com; s=arc-20160816; b=R/XefN4qYUVhbnRTh9Ic9jehO/mBiV+r0ahpafBplKd30xBhy+r0SYdx0Lz7osSYvj lhlk5aQAKknjYwBm1wRjLn4wZnVqJAKywU2w/x5g5m73NzqnRO1s5cN/PILmqO2JS9CK yJqGK1Esb+B5mk+Hhw9lpGOtw0JkoaBbd/9vsTypiIW/VyIE0S1/tvkc3pxm4YBz98Em WABycWELs4tFIWrC5en/RpQEn3lRgkeh0NM75XxPugd4XUT0tD+FZp+YaMGuw6S7f2Gr 1VUB2bcLrCjU2WehxDl1w3HXmuWvo5ShxFmi9Rv/sQQCQcB+57M0dz6QXKkmdywxBKyB 8eCQ== 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:arc-authentication-results; bh=cPj85Vld6rl29f/ZsdP2ELAyiZdoJ5LZSOhJewo/2gE=; b=KqI7dL3VSWyZsqWu9jPMwGtBFX6bHLmb6YWxY4mIA9fYQArvuHvIeMBBg3qE+Sd7P0 +zoaJbi7lvkBEw4EXfq7s/AgG3Xk16x0NICQAK+AyMwg9tzI7zfZBRHbTNdgII8dAOQ/ Ct/y0Obo4cag3Upwa6tdxrwnYu3+ZVyg1ONJMtaAqs6aREEWsPy2BF8o66hTXhhcBdyG JTqxloQSWkmQn/wBv1pbORi8RdPAWWPdd66KpQhJnQ1feIMPqtGfofiP/gW7nQMINXg6 dYcG6xdGQ0jOwBjrfLmqN5/5f4mcmYXJcUOroebKq5TmVLbrTcrxc7CtIFlL94hk2SYu Twdg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a81si8793202pfj.300.2018.05.01.02.17.27; Tue, 01 May 2018 02:17:41 -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; Authentication-Results: mx.google.com; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755074AbeEAJPu (ORCPT + 99 others); Tue, 1 May 2018 05:15:50 -0400 Received: from foss.arm.com ([217.140.101.70]:44156 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754550AbeEAJLj (ORCPT ); Tue, 1 May 2018 05:11:39 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DD2D8164F; Tue, 1 May 2018 02:11:38 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.206.73]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A9A2F3F487; Tue, 1 May 2018 02:11:36 -0700 (PDT) From: Suzuki K Poulose To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org, mike.leach@linaro.org, robert.walker@arm.com, mark.rutland@arm.com, will.deacon@arm.com, robin.murphy@arm.com, sudeep.holla@arm.com, frowand.list@gmail.com, robh@kernel.org, john.horley@arm.com, Suzuki K Poulose Subject: [PATCH v2 12/27] coresight: tmc-etr: Allow commandline option to override SG use Date: Tue, 1 May 2018 10:10:42 +0100 Message-Id: <1525165857-11096-13-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525165857-11096-1-git-send-email-suzuki.poulose@arm.com> References: <1525165857-11096-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Coresight TMC-ETR SG mode could be unsafe on a platform where the ETR is not properly connected to account for READ operations. We use a DT node property to indicate if the system is safe. This patch also provides a command line parameter to "force" the use of SG mode to override the firmware information. Cc: Mathieu Poirier Cc: Mike Leach Signed-off-by: Suzuki K Poulose --- Hi This is more of a debug patch for people who may want to test their platform without too much of hacking. I am not too keen on pushing this patch in. --- Documentation/admin-guide/kernel-parameters.txt | 8 ++++++++ drivers/hwtracing/coresight/coresight-tmc.c | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 11fc28e..03b51c3 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -675,6 +675,14 @@ Enable/disable the CPU sampling based debugging. 0: default value, disable debugging 1: enable debugging at boot time + coresight_tmc.etr_force_sg + [ARM, ARM64] + Format: + Force using the TMC ETR builtin scatter-gather mode + even when it may be unsafe to use. + Default : 0, do not force using the builtin SG mode. + 1, Allow using the SG, ignoring the firmware + provided information. cpuidle.off=1 [CPU_IDLE] disable the cpuidle sub-system diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index e38379c..c7bc681 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,8 @@ #include "coresight-priv.h" #include "coresight-tmc.h" +static bool etr_force_sg; + void tmc_wait_for_tmcready(struct tmc_drvdata *drvdata) { /* Ensure formatter, unformatter and hardware fifo are empty */ @@ -307,7 +310,8 @@ const struct attribute_group *coresight_tmc_groups[] = { static inline bool tmc_etr_can_use_sg(struct tmc_drvdata *drvdata) { - return fwnode_property_present(drvdata->dev->fwnode, "scatter-gather"); + return etr_force_sg || + fwnode_property_present(drvdata->dev->fwnode, "scatter-gather"); } /* Detect and initialise the capabilities of a TMC ETR */ @@ -482,3 +486,4 @@ static struct amba_driver tmc_driver = { .id_table = tmc_ids, }; builtin_amba_driver(tmc_driver); +module_param(etr_force_sg, bool, 0); -- 2.7.4