Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp473212rdb; Mon, 29 Jan 2024 07:55:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IER98sNJ2b2Jf5N4uyUrWDgr66IXO9aY0xhGnujUqK9YnLnC8d6jGPEwF2B7AbrElJCAEwH X-Received: by 2002:a05:6358:921:b0:175:7195:a17b with SMTP id r33-20020a056358092100b001757195a17bmr3903993rwi.49.1706543753204; Mon, 29 Jan 2024 07:55:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706543753; cv=pass; d=google.com; s=arc-20160816; b=p+dwOJtOLptRxD5PQ6Hte2cu+nqwD/Dqx3jvltUBSYYOnG5DwbHQRnUlwlbCgRlE+R lxRCX2/AjWs2qkEbD3tjBMHnfRwlLmMtBsmsenmDSxedI/NmfeIg+ZPNoVdBmxDB+9rB s9+E0LMwqfe3aV/XJtq0M2eIqrrKAI3YNB//PMGQmtqm5yGUcSFaju6A1gpSETU5sNny uIqcn9kLcrHf5AuWh7UyjbcGQ1BfR3qEQdnB91EFdN5VVleq2z+ZDdk2ueoxEKGB5qNs 5fSvEGtJC2gm6cKxh3RFqbwFzts15H+HYC3SS23h7EQWLLRqEWaC0r2Z/18565kXDvbW ov8Q== 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:message-id:date:subject:cc:to :from; bh=Fln0xK0v7IZQH9wdiyqOTJolfa5W+EpXfpzZwJ3h3zk=; fh=L0mtDxzbexvY93/TXVDPqRiMSUezBOF86XyL0RxKhcM=; b=PgLqzyQa0mmWZHyUuzRNYK7cgJag7hrhtEbZgVMHrkS5ZQti9nS94t/dNZ9uv7sEjr yoiiGE4UqvaHqi52WTO7AqSbVql5CVyKLRMlE58YmrDOfeACGviF4iMLYm52hrWpLDR6 HKeA3TAVF0Vo7FgQ/q1JPly6Rmg1Nix/Bu8cFAbp83I+eHUno1aH3YBqYGG9/k2kVyWo 03F3wIXOsjfdNtmK2DljHNytplOc0h4gHhfKCyskpKF3FJ/3k4WkezMpTUFeiNkUzyMW CEoLyaUIK+bXE2L6ZSRykniBZkFT8PDO3fm5uLEiMmF9XhZ7BNJWxR3rDpK2XWq6V0L5 h+dQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-43012-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43012-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t18-20020a63b252000000b005cd8f461cf1si5652186pgo.515.2024.01.29.07.55.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 07:55:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43012-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-43012-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43012-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A69E3B20A60 for ; Mon, 29 Jan 2024 15:41:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B92F4154446; Mon, 29 Jan 2024 15:41:10 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9EA7E154426 for ; Mon, 29 Jan 2024 15:41:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706542870; cv=none; b=HhHYlgvFmGkTQoaBlH+kSNfyPQgRWsegM8j9eNZG6NmDb9d8Bwa5EPoslN2ojJdJvVpS1Qh59mRePjGxBpu9+SodNoniENBhglaffKwPYuqnqVXGMfvfZsCzQpHJ0zbdZPhPWyM/tzyuhssqUyQ0fprJ0K8hR+LfbJYt00sVPkc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706542870; c=relaxed/simple; bh=VxMCAZG5PA+92iidZrv0IOb7p+NHuMVSN9QfCkcFCrE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=kllERQzeqU0A6jjvpZcLYbv3vFMHNDfJUrvmV67w8WN2nU5nLbRJnNXFrE61DtJ2XRzZwStv+mu00vkkDCpY0WspSV89XWsgrda4NQXcgvenouZq3hrieibIduK1iUsJmc8J6TBwlAyI63sPNOsusc8FbzXS5Y3SyezxQGRyfZI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D1EBEDA7; Mon, 29 Jan 2024 07:41:50 -0800 (PST) Received: from e127643.lan (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6D8363F738; Mon, 29 Jan 2024 07:41:04 -0800 (PST) From: James Clark To: coresight@lists.linaro.org, suzuki.poulose@arm.com Cc: James Clark , Mike Leach , Alexander Shishkin , Maxime Coquelin , Alexandre Torgue , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 00/12] coresight: Separate sysfs and Perf usage and some other cleanups Date: Mon, 29 Jan 2024 15:40:31 +0000 Message-Id: <20240129154050.569566-1-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Changes since V1: * Clarify further "the selected sink" in _coresight_build_path() * Move etm4x's mode to coresight device which was missing from V1 * Use explicit initialisers in coresight_dev_type * Create functions for handling mode changes I've been finding it quite difficult to reason about some of the state and functions in coresight-core.c because they have generic names when they are actually only relevant to the sysfs usage of Coresight rather than usage through Perf. This is probably because sysfs came first and Perf was added later. This has caused a couple of issues where these things have been used in the wrong context, for example the first commit is a fixup. To fix this I've mainly just moved all of the sysfs stuff to the sysfs file and removed the 'enable' state, which was just for sysfs. While doing the refactor it became obvious that refcnt didn't need to be atomic either, so that can be simplified along with some other comment clarifications and simplifications. Hopefully it's also a step towards to removing all of the duplicate refcnt and mode tracking code from the individual devices. That tracking pretty much always results in a one-shot enable/disable and fixes the mode to either sysfs or Perf, and there is no reason that can't exist in the core layer outside of the devices. I tried to finish that in this set, but there turned out to be some complexities, so I cut it short at a point where I can be sure that there are no behavioral changes. James Clark (12): coresight: Fix issue where a source device's helpers aren't disabled coresight: Make language around "activated" sinks consistent coresight: Remove ops callback checks coresight: Move mode to struct coresight_device coresight: Remove the 'enable' field. coresight: Move all sysfs code to sysfs file coresight: Remove atomic type from refcnt coresight: Remove unused stubs coresight: Add explicit member initializers to coresight_dev_type coresight: Add helper for atomically taking the device coresight: Add a helper for getting csdev->mode coresight: Add helper for setting csdev->mode drivers/hwtracing/coresight/coresight-core.c | 494 +----------------- drivers/hwtracing/coresight/coresight-etb10.c | 29 +- .../hwtracing/coresight/coresight-etm-perf.c | 2 +- drivers/hwtracing/coresight/coresight-etm.h | 2 - .../coresight/coresight-etm3x-core.c | 23 +- .../coresight/coresight-etm3x-sysfs.c | 4 +- .../coresight/coresight-etm4x-core.c | 26 +- drivers/hwtracing/coresight/coresight-etm4x.h | 1 - drivers/hwtracing/coresight/coresight-priv.h | 9 +- drivers/hwtracing/coresight/coresight-stm.c | 30 +- drivers/hwtracing/coresight/coresight-sysfs.c | 391 ++++++++++++++ .../hwtracing/coresight/coresight-tmc-core.c | 2 +- .../hwtracing/coresight/coresight-tmc-etf.c | 46 +- .../hwtracing/coresight/coresight-tmc-etr.c | 33 +- drivers/hwtracing/coresight/coresight-tmc.h | 2 - drivers/hwtracing/coresight/coresight-tpda.c | 13 +- drivers/hwtracing/coresight/coresight-tpiu.c | 14 +- drivers/hwtracing/coresight/ultrasoc-smb.c | 22 +- drivers/hwtracing/coresight/ultrasoc-smb.h | 2 - include/linux/coresight.h | 146 ++---- 20 files changed, 606 insertions(+), 685 deletions(-) -- 2.34.1