Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp145684lqr; Wed, 5 Jun 2024 01:25:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVohOUBWkz5FQuXGXSA3rh3WV9wvkSTHdVuYJ74+laou4Nu06V5haj6TjKxsWRZKK1sTHhNG0DvEb7yzRBROJs149ZNgCPeY6EmssbNqA== X-Google-Smtp-Source: AGHT+IHB7idMc1tnHeokfKpYMpN/tfsAI3X9Sa+zl970Xx6tQdgVlmwwtZIV2JS7pXFzWZNETmM+ X-Received: by 2002:a05:622a:20d:b0:43a:e995:f1a4 with SMTP id d75a77b69052e-4402b599fe4mr18354511cf.30.1717575935987; Wed, 05 Jun 2024 01:25:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717575935; cv=pass; d=google.com; s=arc-20160816; b=aA2F7RwdDf0BoRfulf3uhavBt5Cyqm2LB8Bm8t7q/ZZnFe61ETBG9IQFvbVoBaN6Du dV8AsmrjLpVtnWsy+yc8FBTTImyp3n1BlRrrdrMurUwRXkXCITVoICVgjb+B+wSsPkJA I7EiPsYj8i+a0MDUh0Cf5fjT3CMrnybug5FKR49mKH3cGR41nopeE8yL3U+llSiYujSD kL5bfBRGUkNcuy/jhQ7eNZP1JfYNh6uyF5Z2UliZvyLAwpszrYVZF5MYiLdOfi8lA4Z1 VfLOlnjHHQyNDLNAsVwd1Fj+WzJ/uPnOvBtogW0F6bJ98LHYkhj4WfDWqhZJZZUCF0bT AKEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=PL44a3oSwg6fW7HWjjUgbuaM6mDQwdDuzi6m1DlIqrY=; fh=Lmcwnbrzc6iXxb3h/s4EQlBYs2WnsA2bZNBJIYM8/3Y=; b=slyoBe+8Xv568NL/uhgYTPahLIpx/z8p0TdOfHvD2kyniENDF9egJND0QrGpABlz3G geOBYaarpDglBsQBNA/n/a5rX6dhG0KEQVPeVYSYkTyMRurSwjjxt09Qj3AtnIR9+fvE 4tcvSIcHoTCTKgbuUVPZgZF9ThPji8gyZwfOcSBn922cDtg6+Wm82r9SwwprfUBgDk5m kU2PLqE35INZ50B9A8AjIUwWLlWTbO2NngbL5t127SpFYYMBT7hqFMbniO6FyiAPo4B5 3leKM4fIBlSQJK/SSH5ZDgrwhSJnhkkbSTX3Jl3QJZOywjACylb5+hdE86FRluOdYGTb OAqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=f1UkljDM; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-201983-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201983-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43ff25c39c3si128283971cf.791.2024.06.05.01.25.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 01:25:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201983-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=f1UkljDM; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-201983-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201983-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A07EC1C2091D for ; Wed, 5 Jun 2024 08:25:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2FFB8191483; Wed, 5 Jun 2024 08:19:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="f1UkljDM" Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B207919925A; Wed, 5 Jun 2024 08:19:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.156.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717575542; cv=none; b=FlQgvpr5epLyarK0QH4JeNGgHii/mCSIpUN3uKnlcHSBtrmjI/JwOK3bIXkSXiW2sdNFWQWS4Y4Jbhx7dnkLsfxsElqWyuXn+dtLEgBQG+gYxnvqOm8bD3bwNFdHeyQxBbf2PCXw+txBkghxAYdsEx7bfJ4vSgBDb/q0IKVSKw8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717575542; c=relaxed/simple; bh=dE020p3x7ejjd5Ua7MTWxIrOjmUH897gLahJpmGZrC4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=k+r/SKScQG9GIkJ60YVoYbNwAset5jjOy/XsjgGMamc0zt4jEE/8za1gLJSsZS84fbD8lrfeEAgiGeo7sbd1asBkBp/a+ib2OYNrK7ms2f3ptKkZ/YstQ/+lghfO3WiycEKwLHO6xcX58/SuG/j9FqKlmJo4rQFPrlUxYEb7DUA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=f1UkljDM; arc=none smtp.client-ip=67.231.156.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 454KRqZb004139; Wed, 5 Jun 2024 01:18:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=P L44a3oSwg6fW7HWjjUgbuaM6mDQwdDuzi6m1DlIqrY=; b=f1UkljDMgFwZypwIK 2ovCZFR98hYt6lirD+IVezvhwZ7Wsb5DjWiVcODeK2XtHB8sBHbk+yNWPDcKVZ/F ajWmYfuO/qnB35DfVqUvFmnaqcQKljGzl5jdM58fCivKT73HxyWHD3pmaXZrK2Tb a4haiWzmSUEh9r3kPfP8qh29E5GU//crYTYS/gFKW7i/+l+mGu7W6zQEW3P6rBsI REaPnb2Qgxwkp0+5ru8O9qngLi8U+HspSYr2BGvoydS4dVmWjQnhhag5BjIib1fp gmKz4DJB1L4uWZI62p5edDgG/19bI+jkKAJ6T9rGFR92QmXwhhRbYW0HKGjaAqcn bFflw== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3yj167cf60-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Jun 2024 01:18:21 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 5 Jun 2024 01:18:12 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 5 Jun 2024 01:18:12 -0700 Received: from virtx40.. (unknown [10.28.34.196]) by maili.marvell.com (Postfix) with ESMTP id 6A1253F70A5; Wed, 5 Jun 2024 01:18:08 -0700 (PDT) From: Linu Cherian To: , , CC: , , , , , , , , , Linu Cherian Subject: [PATCH v9 7/7] coresight: config: Add preloaded configuration Date: Wed, 5 Jun 2024 13:47:25 +0530 Message-ID: <20240605081725.622953-8-lcherian@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605081725.622953-1-lcherian@marvell.com> References: <20240605081725.622953-1-lcherian@marvell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: npJ9hCOgm7I8QKd1cl4qG0-h5X64wRoG X-Proofpoint-GUID: npJ9hCOgm7I8QKd1cl4qG0-h5X64wRoG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-04_11,2024-06-05_01,2024-05-17_01 Add a preloaded configuration for generating external trigger on address match. This can be used by CTI and ETR blocks to stop trace capture on kernel panic. Kernel address for "panic" function is used as the default trigger address. This new configuration is available as, /sys/kernel/config/cs-syscfg/configurations/panicstop Signed-off-by: Linu Cherian Reviewed-by: James Clark --- Changelog from v8: Added Reviewed-by tag. drivers/hwtracing/coresight/Makefile | 2 +- .../coresight/coresight-cfg-preload.c | 2 + .../coresight/coresight-cfg-preload.h | 2 + .../hwtracing/coresight/coresight-cfg-pstop.c | 83 +++++++++++++++++++ 4 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 drivers/hwtracing/coresight/coresight-cfg-pstop.c diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile index 4ba478211b31..46ce7f39d05f 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -25,7 +25,7 @@ subdir-ccflags-y += $(condflags) obj-$(CONFIG_CORESIGHT) += coresight.o coresight-y := coresight-core.o coresight-etm-perf.o coresight-platform.o \ coresight-sysfs.o coresight-syscfg.o coresight-config.o \ - coresight-cfg-preload.o coresight-cfg-afdo.o \ + coresight-cfg-preload.o coresight-cfg-afdo.o coresight-cfg-pstop.o \ coresight-syscfg-configfs.o coresight-trace-id.o obj-$(CONFIG_CORESIGHT_LINK_AND_SINK_TMC) += coresight-tmc.o coresight-tmc-y := coresight-tmc-core.o coresight-tmc-etf.o \ diff --git a/drivers/hwtracing/coresight/coresight-cfg-preload.c b/drivers/hwtracing/coresight/coresight-cfg-preload.c index e237a4edfa09..4980e68483c5 100644 --- a/drivers/hwtracing/coresight/coresight-cfg-preload.c +++ b/drivers/hwtracing/coresight/coresight-cfg-preload.c @@ -13,6 +13,7 @@ static struct cscfg_feature_desc *preload_feats[] = { #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) &strobe_etm4x, + &gen_etrig_etm4x, #endif NULL }; @@ -20,6 +21,7 @@ static struct cscfg_feature_desc *preload_feats[] = { static struct cscfg_config_desc *preload_cfgs[] = { #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) &afdo_etm4x, + &pstop_etm4x, #endif NULL }; diff --git a/drivers/hwtracing/coresight/coresight-cfg-preload.h b/drivers/hwtracing/coresight/coresight-cfg-preload.h index 21299e175477..291ba530a6a5 100644 --- a/drivers/hwtracing/coresight/coresight-cfg-preload.h +++ b/drivers/hwtracing/coresight/coresight-cfg-preload.h @@ -10,4 +10,6 @@ #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) extern struct cscfg_feature_desc strobe_etm4x; extern struct cscfg_config_desc afdo_etm4x; +extern struct cscfg_feature_desc gen_etrig_etm4x; +extern struct cscfg_config_desc pstop_etm4x; #endif diff --git a/drivers/hwtracing/coresight/coresight-cfg-pstop.c b/drivers/hwtracing/coresight/coresight-cfg-pstop.c new file mode 100644 index 000000000000..c2bfbd07bfaf --- /dev/null +++ b/drivers/hwtracing/coresight/coresight-cfg-pstop.c @@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright(C) 2023 Marvell. + * Based on coresight-cfg-afdo.c + */ + +#include "coresight-config.h" + +/* ETMv4 includes and features */ +#if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) +#include "coresight-etm4x-cfg.h" + +/* preload configurations and features */ + +/* preload in features for ETMv4 */ + +/* panic_stop feature */ +static struct cscfg_parameter_desc gen_etrig_params[] = { + { + .name = "address", + .value = (u64)panic, + }, +}; + +static struct cscfg_regval_desc gen_etrig_regs[] = { + /* resource selector */ + { + .type = CS_CFG_REG_TYPE_RESOURCE, + .offset = TRCRSCTLRn(2), + .hw_info = ETM4_CFG_RES_SEL, + .val32 = 0x40001, + }, + /* single address comparator */ + { + .type = CS_CFG_REG_TYPE_RESOURCE | CS_CFG_REG_TYPE_VAL_64BIT | + CS_CFG_REG_TYPE_VAL_PARAM, + .offset = TRCACVRn(0), + .val32 = 0x0, + }, + { + .type = CS_CFG_REG_TYPE_RESOURCE, + .offset = TRCACATRn(0), + .val64 = 0xf00, + }, + /* Driver external output[0] with comparator out */ + { + .type = CS_CFG_REG_TYPE_RESOURCE, + .offset = TRCEVENTCTL0R, + .val32 = 0x2, + }, + /* end of regs */ +}; + +struct cscfg_feature_desc gen_etrig_etm4x = { + .name = "gen_etrig", + .description = "Generate external trigger on address match\n" + "parameter \'address\': address of kernel address\n", + .match_flags = CS_CFG_MATCH_CLASS_SRC_ETM4, + .nr_params = ARRAY_SIZE(gen_etrig_params), + .params_desc = gen_etrig_params, + .nr_regs = ARRAY_SIZE(gen_etrig_regs), + .regs_desc = gen_etrig_regs, +}; + +/* create a panic stop configuration */ + +/* the total number of parameters in used features */ +#define PSTOP_NR_PARAMS ARRAY_SIZE(gen_etrig_params) + +static const char *pstop_ref_names[] = { + "gen_etrig", +}; + +struct cscfg_config_desc pstop_etm4x = { + .name = "panicstop", + .description = "Stop ETM on kernel panic\n", + .nr_feat_refs = ARRAY_SIZE(pstop_ref_names), + .feat_ref_names = pstop_ref_names, + .nr_total_params = PSTOP_NR_PARAMS, +}; + +/* end of ETM4x configurations */ +#endif /* IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) */ -- 2.34.1