From patchwork Mon Nov 1 22:47:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 12597513 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80ABEC433F5 for ; Mon, 1 Nov 2021 22:49:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 4654B60F42 for ; Mon, 1 Nov 2021 22:49:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4654B60F42 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jnEmX4YgnVJoTzy4Olct3cfBmWBdp1wpdUcfYsPiGLM=; b=asU5+W1Bxeas0Q E18w9EYWIRsRDc3ErUfux9yHvw00uxXuu6uvMzedU5oRpzuaTDPOmC74UAjswUXf2slV4SsSr43d6 swQAZvyR3cfQPpXm/JPpN9hKyJ11f/M061yM0vzCmd5jBFgVFHfBTlPgyGD7a1FtY0H1vyJcx7Bwa 4ZIamxPpW/2diE+FqK8sAOMrmKFheT1vLaoeRDvg2mG6gDBmrdhLL8SP83VItdJOaUo61jC8CIgEm tJLhOBYUuTVv1h0tkGJ79+6hsecaQCz8p2hNd7250UCNdURAXRSXyuK4M/f25WyaS58H+K6gywQHg Knhb3ineK9PRZWB2IBQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhg69-00HRdT-ON; Mon, 01 Nov 2021 22:48:13 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhg5a-00HRWv-Ud for linux-arm-kernel@lists.infradead.org; Mon, 01 Nov 2021 22:47:41 +0000 Received: by mail-wr1-x42f.google.com with SMTP id d5so15104466wrc.1 for ; Mon, 01 Nov 2021 15:47:38 -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:in-reply-to:references; bh=hF66nuqLbg4fzI1VN/ff4Po+KDRcRXpEL2qgfiYf73M=; b=A5yzZyYC/caTx2PWybydLqXSGO5fj4GoTpF/64ZPibNUy8fBRhBGWHOltSFOxvj1oD peB2Iasqeg7oixSBXgCLM680Miqt0sHzxEqIjIdwad2wqswvUTXjML3wuT9Xg0psNzra Nky7oak8hwG9uyMVQ0D1cptn7Ez5w6GilzdnMJrwPouHYVKH4z3jjxkoSpkY88/VpnkF 8a6Am2k7VOHhuH3amNjHa29QSRuGVFA7I/imfprSA84uNTNPDKfycQUQzhJefTW2/0Sq 8aEZaB7rXrRaI/UcTNvKEen7hwfNuxjPFXxoRmcWSXeMgA4E2PXut09h0RYF5OHy5Iho X96Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hF66nuqLbg4fzI1VN/ff4Po+KDRcRXpEL2qgfiYf73M=; b=Pi5NB7oyYSRwABQ91XdGQxRM/boQGEWSe+cEjUAEaaWVzjKz8VNSblj8jmP+ZKkXSi /8RiMaUhUGsJDt120+kKo2K6nYR53Vle8Mdt/pDgYg224OiW5nZF5pJSk/NWE8celh6N BppjIFqfWuxS8kxT4yb9qHzyQZl19L3nisJ9si9ycOltAnNfRT0tWgtX4Goyy8M105Uj YvloAH9rbDOMgzKaoj17uGTm5ZS/2+58mRLD42EwJ7/RhRTiYK2TUEblYY4EJUeN3Um/ dugTrGZcosDxYLb1I7VOZfe94qDomjui103xleUMuYjxoxJG2EuP6PkLdYsJyyjLe+eV yDfA== X-Gm-Message-State: AOAM530t6Y1sq4zht1wJwMaBvSfF+2qusuNvqMkpwhW8kbrFZEe1Ii6Q ZYJSbu1tvStFICV1PbZrwlgexQ== X-Google-Smtp-Source: ABdhPJweerr/yqRhIMjoDTirICHrA2quBW9wjOF5NhGYbPZkahXaERNh2FtBEEmyrIUOTWMI+p9qcw== X-Received: by 2002:a05:6000:1842:: with SMTP id c2mr15229824wri.301.1635806857474; Mon, 01 Nov 2021 15:47:37 -0700 (PDT) Received: from linaro.org ([2a00:23c5:6809:2201:cd6d:75aa:3402:e4a]) by smtp.gmail.com with ESMTPSA id 10sm858647wme.27.2021.11.01.15.47.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 15:47:37 -0700 (PDT) From: Mike Leach To: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org, mathieu.poirier@linaro.org, suzuki.poulose@arm.com, leo.yan@linaro.org, Mike Leach Subject: [PATCH 6/6] Documentation: coresight: Update coresight configuration docs Date: Mon, 1 Nov 2021 22:47:31 +0000 Message-Id: <20211101224731.27870-7-mike.leach@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211101224731.27870-1-mike.leach@linaro.org> References: <20211101224731.27870-1-mike.leach@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211101_154739_031656_035AD886 X-CRM114-Status: GOOD ( 22.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add documentation covering the configfs updates that allow binary configuration files to be loaded and unloaded, along with the demonstration programs in samples. Signed-off-by: Mike Leach --- .../trace/coresight/coresight-config.rst | 65 +++++++++++++++++-- 1 file changed, 59 insertions(+), 6 deletions(-) diff --git a/Documentation/trace/coresight/coresight-config.rst b/Documentation/trace/coresight/coresight-config.rst index 911db4da7f99..8ea640b3f6f9 100644 --- a/Documentation/trace/coresight/coresight-config.rst +++ b/Documentation/trace/coresight/coresight-config.rst @@ -152,7 +152,7 @@ follows:: $ cd configurations/ $ ls - autofdo + autofdo last_load_status load unload $ cd autofdo/ $ ls description preset1 preset3 preset5 preset7 preset9 @@ -247,9 +247,19 @@ Creating and Loading Custom Configurations ========================================== Custom configurations and / or features can be dynamically loaded into the -system by using a loadable module. +system by using a loadable module, or by loading a binary configuration +file in configfs. + +Loaded configurations can use previously loaded features. The system will +ensure that it is not possible to unload a feature that is currently in +use, by enforcing the unload order as the strict reverse of the load order. + +An example of a custom configuration module, and generators for binary +configuration files are found in './samples/coresight'. + -An example of a custom configuration is found in ./samples/coresight. +Using a Loadable Module +----------------------- This creates a new configuration that uses the existing built in strobing feature, but provides a different set of presets. @@ -258,6 +268,49 @@ When the module is loaded, then the configuration appears in the configfs file system and is selectable in the same way as the built in configuration described above. -Configurations can use previously loaded features. The system will ensure -that it is not possible to unload a feature that is currently in use, by -enforcing the unload order as the strict reverse of the load order. +The file 'coresight-cfg-sample.c' contains the configuration and module +initialisation code needed to create the loadable module. + +This will be built alongside the kernel modules if select in KConfig. + + +Using a Binary Configuration File +--------------------------------- + +Building the samples creates the 'coresight-cfg-filegen' program that will +generate a configuration binary 'example1.cscfg' that can be loaded into the +system using configfs. The configuration declared in the source file +'coresight-cfg-filegen.c' is named 'autofdo3' - the name that will be used +once loaded. + +The source files 'coresight-cfg-bufw.h' and 'coresight-cfg-bufw.c' provide a +standard function to convert a configuration declared in 'C' into the correct +binary buffer format. These files can be re-used to create new custom +configurations. + +The program 'coresight-cfg-file-read' can read back and print a configuration +binary. This is built using the reader from the driver code. + +There are additional attributes in the configurations directory - load, unload +and last_load_status that can be used to load and unload configuration +binary files. To load, 'cat' the binary config into the load attribute:: + + $ ls /config/cs-syscfg/configurations/ + autofdo last_load_status load unload + $ cat example1.cscfg > /config/cs-syscfg/configurations/load + $ ls /config/cs-syscfg/configurations/ + autofdo autofdo3 last_load_status load unload + $ cat /config/cs-syscfg/configurations/last_load_status + OK: configuration file loaded (autofdo3). + +To unload, use the same file in the unload attribute:: + + $ cat example1.cscfg > /config/cs-syscfg/configurations/unload + $ cat /config/cs-syscfg/configurations/last_load_status + OK: configuration file unloaded (autofdo3). + ls /config/cs-syscfg/configurations/ + autofdo last_load_status load unload + +The generator and reader programs can also be built directly, separately from +the kernel build by using the 'Makefile.host' file. This allows binaries to be +created on the host machine when cross compiling.