From patchwork Mon Dec 19 23:46:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 13077331 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 623A9C4332F for ; Tue, 20 Dec 2022 00:13:00 +0000 (UTC) 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: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:In-Reply-To:References: List-Owner; bh=CzzhRcBSiSUwgJN5c+T58NFGCp/jOjbmlN09fmCgnvg=; b=cCxaLT+qlO8oVG VqkOSdX9fTBO189+p+YCtxvd78/lv18mM3G4wwmvp0kAOHWe7she2KPu7/52w8Oai/qvfXq6Z/R1h gd2KvCiKgKNGjmGDwsmzeP1uMrfoIC1Y+VP8iMUHIubaeDmZnsDm0XqWBJZ9o1GIUelWguTlzD3Od 6fa5yldlOehQnvHP/DS6OY4ajiFg8tNg53GdpydY/VMm66p1zDVbJFcUR1d/zaATeGsAywn86ZyJH miSdk78n2BcU/SNlegY4d1612RXhhZqPXZq7KL1g28X/sSI/touk/rXzG973u+uQsXhxPfYZ76B41 wY79GmVBivDmNu5krttw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7QEV-005SAn-B6; Tue, 20 Dec 2022 00:11:47 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7PqJ-005Aiw-CI for linux-arm-kernel@lists.infradead.org; Mon, 19 Dec 2022 23:46:49 +0000 Received: by mail-wr1-x435.google.com with SMTP id h12so10200656wrv.10 for ; Mon, 19 Dec 2022 15:46:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Yr50kGZ2450z0JMZkOL/NEsv1hM43iRa7NeYnFZkjVI=; b=MOex3KLKCQYhUotZX7/B/KhZvxqwBh8UaequZfF08NeutFy0+idJ2u9TWqsXUPF+3k hWtj19GtCqptCf09wl2Aeze/S86gf8nKGZTZgQUKG4XHDnhnGLR+D7Is7TYspxEUf6Oo fsPggGo6M1QXdU/0oTJzRTXKVsJ3rClCQo3LxyjKy/xXfVGbLv9WtCYSBsZAuPfUESZb ydjq/8daeaZtPxg/dzzPi2OCj21UECHSw/CExtFLhnqQNp2JcmTyB2MfWh28cr1i+LTx 5Prtry+bkx6TVDwcx3D+iQMPl9xwnf/kaA+MXhw7TJil/biGReAAWGp/GDUTyFmGdgfn GGFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Yr50kGZ2450z0JMZkOL/NEsv1hM43iRa7NeYnFZkjVI=; b=PfuxnpVx/06oWb+Tjr2sIRjpHUp1aL1/6ROAjSde8H5jpWRAxdJuekKL9mZPYjKoWD L2IKlpU6mKWgxDzfDGlPBiweJibWrrp+Qe8ZDbB7v2LppwPwH9BMu0byxW4fzV1zZmUT gOXGKEAMUZV8kTmpyxoeOCt32bHWp7YryvbiXLF15FfbWeNrQVwL2cxf3E+pPllwsNMi q3ymowBom3t55ON0DVjRKbSaKeMv4stB+f0lnEyYiuo9N0pJtJGtEHJ2lyFUr4KQt4uX pkNGNns6I/hR8Qfr/I4fXCSNsTuubHAL5IoqshMugo9Qf9MwATcMNSIWSWelEq8sldy8 EQ5A== X-Gm-Message-State: ANoB5plElswLJEPhvnxWepcugK4Ps4q1T4PyUyM11nqS1yx2706jf35y FjNu1jGtBDw3Cz3BfTnKbl3i5ohySKo5bgVF X-Google-Smtp-Source: AA0mqf59lCchRdJOK5FjlgooiF0rQlDlNJpSe5xw2sAHTbylBfplcnKiqa/FuKNeBLgjBGbLPEsiCg== X-Received: by 2002:a05:6000:1201:b0:242:46cf:687c with SMTP id e1-20020a056000120100b0024246cf687cmr25600816wrx.32.1671493602427; Mon, 19 Dec 2022 15:46:42 -0800 (PST) Received: from linaro.org ([2a00:23c5:6809:2201:bce1:4a06:7ceb:6940]) by smtp.gmail.com with ESMTPSA id n2-20020a5d4c42000000b002383fc96509sm11165148wrt.47.2022.12.19.15.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 15:46:41 -0800 (PST) From: Mike Leach To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org Cc: mathieu.poirier@linaro.org, suzuki.poulose@arm.com, acme@kernel.org, james.clark@arm.com, Mike Leach Subject: [PATCH v5 0/6] coresight: syscfg: Extend configfs for config load Date: Mon, 19 Dec 2022 23:46:32 +0000 Message-Id: <20221219234638.3661-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-20221219_154647_566124_C993E3AF X-CRM114-Status: GOOD ( 14.48 ) 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 This set extends the configfs support to allow loading and unloading of configurations as binary files via configfs. Additional attributes - load and unload are provided to in the /config/cs-syscfg subsytem base group to implement the load functionality. Routines to generate binary configuration files are supplied in ./tools/coresight. Example generator and reader applications are provided. Tools may be cross compiled or built for use on host system. Documentation is updated to describe feature usage. Changes since v4: 1) Update coresight/next - 6.1-rc3 2) Update to lockdep fixes to avoid read lock race in configfs. Changes since v3: 1) Rebase & tested on coresight/next - 5.19-rc3 - which includes the fix patch for earlier configfs works. 2) Lockdep investigations resulted in re-design of some of the code accessing configfs. 3) moved load and unload attributes to root of cs-syscfg. (Mathieu) 4) Additional minor fixes suggested by Mathieu. 5) Memory for configfs loaded and unloaded configurations is now explicitly freed. 6) LOCKDEP nesting fix for configfs base code (fs/configfs/dir.c) Changes since v2: 1) Rebased & tested on coresight/next - 5.18-rc2 2) Moved coresight config generator and reader programs from samples to tools/coresight. Docs updated to match. (suggested by Mathieu) 3) userspace builds now use userspace headers from tools/... 4) Other minor fixes from Mathieu's review. Changes since v1: 1) Rebased to coresight/next - 5.16-rc1 with previous coresight config set applied. 2) Makefile.host fixed to default to all target. Mike Leach (6): coresight: configfs: Update memory allocation / free for configfs elements coresight: configfs: Add in functionality for load via configfs coresight: configfs: Add in binary attributes to load files coresight: configfs: Modify config files to allow userspace use coresight: tools: Add config file write and reader tools Documentation: coresight: docs for config load via configfs .../trace/coresight/coresight-config.rst | 202 +++++- MAINTAINERS | 1 + drivers/hwtracing/coresight/Makefile | 2 +- .../coresight/coresight-config-file.c | 583 ++++++++++++++++++ .../coresight/coresight-config-file.h | 139 +++++ .../hwtracing/coresight/coresight-config.h | 27 + .../coresight/coresight-syscfg-configfs.c | 361 +++++++++-- .../coresight/coresight-syscfg-configfs.h | 4 + .../hwtracing/coresight/coresight-syscfg.c | 137 +++- .../hwtracing/coresight/coresight-syscfg.h | 6 +- tools/coresight/Makefile | 52 ++ tools/coresight/coresight-cfg-bufw.c | 309 ++++++++++ tools/coresight/coresight-cfg-bufw.h | 26 + tools/coresight/coresight-cfg-example1.c | 62 ++ tools/coresight/coresight-cfg-example2.c | 95 +++ tools/coresight/coresight-cfg-examples.h | 22 + tools/coresight/coresight-cfg-file-gen.c | 61 ++ tools/coresight/coresight-cfg-file-read.c | 227 +++++++ tools/coresight/coresight-config-uapi.h | 76 +++ 19 files changed, 2339 insertions(+), 53 deletions(-) create mode 100644 drivers/hwtracing/coresight/coresight-config-file.c create mode 100644 drivers/hwtracing/coresight/coresight-config-file.h create mode 100644 tools/coresight/Makefile create mode 100644 tools/coresight/coresight-cfg-bufw.c create mode 100644 tools/coresight/coresight-cfg-bufw.h create mode 100644 tools/coresight/coresight-cfg-example1.c create mode 100644 tools/coresight/coresight-cfg-example2.c create mode 100644 tools/coresight/coresight-cfg-examples.h create mode 100644 tools/coresight/coresight-cfg-file-gen.c create mode 100644 tools/coresight/coresight-cfg-file-read.c create mode 100644 tools/coresight/coresight-config-uapi.h