Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4732970rdb; Tue, 12 Dec 2023 07:56:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGUPnOGG0Su6vdya5uOI4jnEQub608V4WkGxeDU+no/XR8lbjg2CngT0qp06UMLL9qIEC6d X-Received: by 2002:a17:90a:6f05:b0:286:a4fc:9f51 with SMTP id d5-20020a17090a6f0500b00286a4fc9f51mr7248679pjk.29.1702396577722; Tue, 12 Dec 2023 07:56:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702396577; cv=none; d=google.com; s=arc-20160816; b=FpBWDyaQ58HzicEZCdgQ/Wa54KHN2DSjNasdC339pdxC5vSWZ5NZ9mIoZyyh9nOqOu YDZoWbIqWZf6GPoAjsBzC54sf7BI2sF/4ki0Fbhj9wpNvYCM8866WR9xU2HQYhRQh0hz +dSbry66eyqKcQ+IHYTNKkT+jyAQ4dexW3lxIJs6+ZVB9/W/rsd5/GJN/R4UirUp5fJV KTtet9/ny2ZEh7FuKK2GEdJpCMYV4ec2KYz9VVp040crUCEf8PJQADkU97NH0849/goq rghq/LSk1MxSH34iQ3nF1px+jmKwbVHqNoX2ZNIcLAjx5DVJwzH2kpSnm4cBLRtjTU7M F6Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=CtDQjchULgItmwITOzjEBOVCDA/QgEBiUo7t3liDH7Y=; fh=L0mtDxzbexvY93/TXVDPqRiMSUezBOF86XyL0RxKhcM=; b=jFwasNoDKx/lxl0uNHQsxMK183ySuLzFH9Fc0YscTjyB90ySmiZsl5u8QaLlwLQXVj JRbX2ZyP6luZwr3KIPlkyaecJ7QAhnmBHHsJjzq+4Q7wVkF2Fdcf95rtBI45LdzqlZTI nO8gvD0A2WE7bkagSWt+5sivhQW+7DZL32ULO4hIly7faUm9cOmgR6DCFnLRx0SKHOp8 AAyyLami9Hvzp6VmS0tarDupt+0rJgjFa+3b24LLwUGZiLJFSo1ClYLkC6t5fJn219SM Wj4iNyHNsXpBagIo/AcKnQvxleNUn6EzCSiZwyONAJC6CWcpFnSpJsH3qvcXenzMhUAS PyHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id bi11-20020a170902bf0b00b001d08f1a597asi7764446plb.285.2023.12.12.07.56.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 07:56:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id DE4C1808496C; Tue, 12 Dec 2023 07:55:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376562AbjLLPzE (ORCPT + 99 others); Tue, 12 Dec 2023 10:55:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235049AbjLLPzC (ORCPT ); Tue, 12 Dec 2023 10:55:02 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6BF59109 for ; Tue, 12 Dec 2023 07:55:05 -0800 (PST) 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 81E8F143D; Tue, 12 Dec 2023 07:55:51 -0800 (PST) Received: from e127643.broadband (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AB1173F738; Tue, 12 Dec 2023 07:55:03 -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 0/8] coresight: Separate sysfs and Perf usage and some other cleanups Date: Tue, 12 Dec 2023 15:53:57 +0000 Message-Id: <20231212155407.1429121-1-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 12 Dec 2023 07:55:47 -0800 (PST) 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 (8): 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 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 | 17 +- .../coresight/coresight-etm3x-sysfs.c | 4 +- .../coresight/coresight-etm4x-core.c | 4 +- drivers/hwtracing/coresight/coresight-priv.h | 9 +- drivers/hwtracing/coresight/coresight-stm.c | 24 +- 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 | 114 +--- 19 files changed, 561 insertions(+), 663 deletions(-) -- 2.34.1