From patchwork Fri Oct 30 17:56:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 11870453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C698CC00A89 for ; Fri, 30 Oct 2020 17:58:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A85020724 for ; Fri, 30 Oct 2020 17:58:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PRXq7Yfl"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="W/8qUFtb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A85020724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=aetVl8PRGZRTYibHrBEkUyMljEVvea5QfGZLtADjlks=; b=PRXq7Yfl69CwXhbRuqxo2N2cBC rLcVl/UCcnPy/nJ++3ExTFhB0gTwSGG2SKmFvmwCrupaWqL2cXK0/UgpEOd6cOX0puu/qLIEMrH/L N66cu4MFS2hiLQCs3qeuO+eKEtBsMSiS/wFPsunYqCI4ZtSc+5sM7ZOWZyzNfpfG0MF5lxKJIuyGc m/UKkaKKz4Ktyl+JrW4HkVRpg4U7MiMzdOkQs1Px3tozlB+G423b/zMNhIYNN9pSU5sXQGuT6JKfv fe7rEyTrVoZLScazdbel1v8gf97kuVYyESeyXxBy4TvG7bcFvqUc3YaPkJ0UEHycRbxd0Hgdptx5Y drXSAH1A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYYe9-0003m1-DH; Fri, 30 Oct 2020 17:57:05 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYYe5-0003k9-AX for linux-arm-kernel@lists.infradead.org; Fri, 30 Oct 2020 17:57:02 +0000 Received: by mail-wr1-x42b.google.com with SMTP id n15so7441147wrq.2 for ; Fri, 30 Oct 2020 10:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=lG3nYIpIL+sZJ0CxLbAY5VXYVbVboIjxAV2XOk7ZIOU=; b=W/8qUFtbNnRtRgGsiEeQsc0HCUwIWvpeuDRaQ2IxrJexyHf4LrIcFi10sQW16mEpgk 2dEP3PdNWCINtCoN8Tcu27XE5qjar3+6PAUT8KkXrdd4tKRXtfPa7ztC6LoO5LXT9Lgm 8PA9ujY0yXQOjs7uXdVpTO+aXtjMGnQpp8kJrPO2bZiN5FbFBexpiH1yl9/56t2iKRWi S5DXIB+sHYKO8RGUaS0L6BDlOlnZW51lnqulvnhndMMhmM8l908ynidCNwUywVc7eCuf BDVelI15aO3fU0hU1pK34iv8aK8/GzVgvB3c+OnWH5uaHPa5nGP/+w2vHj00VwCKz6iX 1blA== 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; bh=lG3nYIpIL+sZJ0CxLbAY5VXYVbVboIjxAV2XOk7ZIOU=; b=LL1TUJJGjSQDwH7IEeE17qsv7wx2zcVEPb7CGFgx0WZkAW/nBSG5HGgBt51JqI7awj n7nWu7phs9TiIxIJs8dCeHIB7kytDCT4evcItCEkEgw5djllLlp8sdUblrew+2jmSk12 y1ldew8pZtIoz4Q5w2sACNPXz7pwSQ5zeTyl2y9/ZqSy86QdvTjc/Rrqh2Lk/CeyUIfW R5khdogjBWVMHK1MT9qV0LfiKCgusU3G5xA+cFwnkBqlyvcopoCxsrLISFARLBm+TC70 6PNFUdB41hPVKRNaXYQNrCjkGCH985qoGk3Y/6S4b9kUn2RbU7w8HdGj0xn/O2p9LK8s dyIA== X-Gm-Message-State: AOAM5313ph9UvSCRFrWRt8XUOjx0d7RXNiHeGAQgmkCgsBNjq+e0SLn9 b4qKCAZsAx8+1VLO/V9+dQJrH+X5hmMjpQ== X-Google-Smtp-Source: ABdhPJzVW57gjTvFDKAvqcXA/d/nTISae7KSmnCPf4JV+YjIq8FslHnmmHEGzpNRsVfnJchSWOp7Kw== X-Received: by 2002:adf:f2c9:: with SMTP id d9mr4610472wrp.319.1604080618180; Fri, 30 Oct 2020 10:56:58 -0700 (PDT) Received: from linaro.org ([2a00:23c5:6801:1801:4964:83f8:d2e7:f2c9]) by smtp.gmail.com with ESMTPSA id o129sm5615563wmb.25.2020.10.30.10.56.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 10:56:57 -0700 (PDT) From: Mike Leach To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, mathieu.poirier@linaro.org Subject: [RFC PATCH v3 0/9] CoreSight complex config support; ETM strobing Date: Fri, 30 Oct 2020 17:56:46 +0000 Message-Id: <20201030175655.30126-1-mike.leach@linaro.org> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201030_135701_469870_B96E102C X-CRM114-Status: GOOD ( 19.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yabinc@google.com, Mike Leach , suzuki.poulose@arm.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patchset introduces initial concepts in CoreSight complex system configuration support. Configurations consist of 2 elements:- 1) Features - programming combinations for devices, applied to a class of device on the system (all ETMv4), or individual devices. 2) Configurations - a set of programmed features used when the named configuration is selected. Features and configurations are declared as a data table, a set of register, resource and parameter requirements. Features and configurations are loaded into the system by the virtual cs_syscfg device. This then matches features to any registered devices and loads the feature into them. Individual device classes that support feature and configuration register with cs_syscfg. Once loaded a configuration can be enabled for a specific trace run. Configurations are registered with the perf cs_etm event as entries in cs_etm/cs_config. These can be selected on the perf command line as follows:- perf record -e cs_etm// ... This patch set has one pre-loaded configuration and feature. A named "strobing" feature is provided for ETMv4. A named "autofdo" configuration is provided. This configuration enables strobing on any ETM in used. Thus the command: perf record -e cs_etm/autofdo/ ... will trace the supplied application while enabling the "autofdo" configuation on each ETM as it is enabled by perf. This in turn will enable strobing for the ETM - with default parameters. Parameters can be adjusted using configfs. The sink used in the trace run will be automatically selected. A configuation can supply up to 15 of preset parameter values, which will subsitute in parameter values for any feature used in the configuration. Selection of preset values as follows perf record -e cs_etm/autofdo,preset=1/ ... (valid presets 1-N, where N is the number supplied in the configuration, not exceeding 15. preset=0 is the same as not selecting a preset.) Applies to coresight/next (5.10-rc1 base) Changes since v2: 1) Added documentation file. 2) Altered cs_syscfg driver to no longer be coresight_device based, and moved to its own custom bus to remove it from the main coresight bus. (Mathieu) 3) Added configfs support to inspect and control loaded configurations and features. Allows listing of preset values (Yabin Cui) 4) Dropped sysfs support for adjusting feature parameters on the per device basis, in favour of a single point adjustment in configfs that is pushed to all device instances. 5) Altered how the config and preset command line options are handled in perf and the drivers. (Mathieu and Suzuki). 6) Fixes for various issues and technical points (Mathieu, Yabin) Changes since v1: 1) Moved preloaded configurations and features out of individual drivers. 2) Added cs_syscfg driver to manage configurations and features. Individual drivers register with cs_syscfg indicating support for config, and provide matching information that the system uses to load features into the drivers. This allows individual drivers to be updated on an as needed basis - and removes the need to consider devices that cannot benefit from configuration - static replicators, funnels, tpiu. 3) Added perf selection of configuarations. 4) Rebased onto the coresight module loading set. To follow in future revisions / sets:- a) load of additional config and features by loadable module. b) load of additional config and features by configfs c) enhanced resource management for ETMv4 and checking features have sufficient resources to be enabled. d) ECT and CTI support for configuration and features. Mike Leach (9): coresight: syscfg: Initial coresight system configuration coresight: syscfg: Add registration and feature loading for cs devices coresight: config: Add configuration and feature generic functions coresight: etm-perf: update to handle configuration selection coresight: etm4x: Add complex configuration handlers to etmv4 coresight: config: Add preloaded configurations coresight: syscfg: Add initial configfs support. coresight: syscfg: Allow update of feature params from configfs coresight: docs: Add documentation for CoreSight config. .../trace/coresight/coresight-config.rst | 230 ++++++ Documentation/trace/coresight/coresight.rst | 16 + drivers/hwtracing/coresight/Makefile | 6 +- .../coresight/coresight-cfg-preload.c | 160 +++++ .../hwtracing/coresight/coresight-config.c | 392 +++++++++++ .../hwtracing/coresight/coresight-config.h | 311 +++++++++ drivers/hwtracing/coresight/coresight-core.c | 18 +- .../hwtracing/coresight/coresight-etm-perf.c | 166 ++++- .../hwtracing/coresight/coresight-etm-perf.h | 10 +- .../hwtracing/coresight/coresight-etm4x-cfg.c | 181 +++++ .../hwtracing/coresight/coresight-etm4x-cfg.h | 29 + .../coresight/coresight-etm4x-core.c | 36 +- .../coresight/coresight-etm4x-sysfs.c | 3 + .../coresight/coresight-syscfg-configfs.c | 421 +++++++++++ .../coresight/coresight-syscfg-configfs.h | 47 ++ .../hwtracing/coresight/coresight-syscfg.c | 656 ++++++++++++++++++ .../hwtracing/coresight/coresight-syscfg.h | 83 +++ include/linux/coresight.h | 7 + 18 files changed, 2743 insertions(+), 29 deletions(-) create mode 100644 Documentation/trace/coresight/coresight-config.rst create mode 100644 drivers/hwtracing/coresight/coresight-cfg-preload.c create mode 100644 drivers/hwtracing/coresight/coresight-config.c create mode 100644 drivers/hwtracing/coresight/coresight-config.h create mode 100644 drivers/hwtracing/coresight/coresight-etm4x-cfg.c create mode 100644 drivers/hwtracing/coresight/coresight-etm4x-cfg.h create mode 100644 drivers/hwtracing/coresight/coresight-syscfg-configfs.c create mode 100644 drivers/hwtracing/coresight/coresight-syscfg-configfs.h create mode 100644 drivers/hwtracing/coresight/coresight-syscfg.c create mode 100644 drivers/hwtracing/coresight/coresight-syscfg.h