From patchwork Mon Jul 4 15:42:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 12905528 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 565E8C433EF for ; Mon, 4 Jul 2022 15:44:08 +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=BBCEmlgect+4CHUxpulymX+V4v2F8MT+oQZkqLyzqUg=; b=ZvP7x0jCZcwBxn T/mUafmurwv0TY9d+C7iH7jtK+RyCZa1djdx8gTImANSL3GGCK1/r4PdwpwzDqafZO0RadvFenfWR q/crvamDAtFNhyZESeeYDs0g5YxcgJcMnVlLn60nsBTg4jvg1Uqfd1MRf9eauKR/w4e8Ynq/vHllt 1G0HH7Nk0icybPUNYkgThGoAb7cDOdB7ar6Xiauw4fHNmqlbnmq7v4z7HPIg9/mCJbfHlRehIjvj1 cGbvELdygzosgZbYmApycYOjgpC+ncPq6hbjpgmjuMsqzF2yIRodWXS9Y/Oy2eVlPnRPtdd/8QoNg 66XPi6PLGLlGuvfi5XWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8ODw-009lk9-D2; Mon, 04 Jul 2022 15:42:56 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8ODt-009li4-8W for linux-arm-kernel@lists.infradead.org; Mon, 04 Jul 2022 15:42:54 +0000 Received: by mail-wm1-x331.google.com with SMTP id bi22-20020a05600c3d9600b003a04de22ab6so5898841wmb.1 for ; Mon, 04 Jul 2022 08:42:52 -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=cBYKztTgLIZXtAHXN6ufusaGqO1+qT245DniRkr75B0=; b=hepq4twEffNi47SjGmYWEMPKiv48Idb7HIkctWFoQCcTYH+dJ2riBXTCfMc3lC7T/2 r5y+kCYWgBBMkrdlciqLySVUzVsfp2eo58FO56Ompno3USElgDd31cNkQtHc3ZZpip0C 6PUItynR1m2+n79fDN6oqvanY2rGiYUFf8FO5yx/B/hcypFf77WYDBm5VzeUjNYgLPeC tw5JDui+nMq2GrbHokx/eyU+kg6CLUynN8o72q67168rYFWqnbMYZDN/JDljkpQAemut o5gQmepoviq5a/EdV7i9kxOjHfzUHySiaj6SbjPXLa5j/zfy/sorMhqxBCih9D4N3h3j X57Q== 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; bh=cBYKztTgLIZXtAHXN6ufusaGqO1+qT245DniRkr75B0=; b=PVLU1Ynq7ipqelzSKeTdSgZL1S+1tEbAjDtEVizipUR4oGDAZ2b00D8UQhljGmakhD +fingbw0IywGoun9CodUgqSnzMkYiPsfsW4jI76iVGoXMFoTsQ8ADCUosjUYbU93Uozb bEMyZCxVwMiqcMjK5maN1MeUejAo6iuuUZdMmn98dlojbn++bVu7OTIMkB/n0STk6CJS fnsdZ12qMJg4CWsEueKGoRcoY61RJuBLKzBVZX55SN9Dl9GELiWDTp17KllCs0VGw5FG JamE3Aus/Du5CUCtRyk8N3IFxD2AMfz1Fj5zL8PHrA6nlYF9IcdFNUzDJPTfbx6R25/k OU0A== X-Gm-Message-State: AJIora/TFAnX8Uq3MMMIVZYJnV6PKug7YFVP3IIC0l8LG5RqvIEJkRPj K5CgaHmuUCDtLXOyOD/4Vb5NwrbKV+dwOQ== X-Google-Smtp-Source: AGRyM1vYDL+f/RomUEcTuT8P9geDQbjGZlU+LWFvGlWZLsEo+pEMXr0ylTGtIPWD28n5FzP9ycbjtg== X-Received: by 2002:a05:600c:a47:b0:39e:f953:84e2 with SMTP id c7-20020a05600c0a4700b0039ef95384e2mr33582967wmq.202.1656949371714; Mon, 04 Jul 2022 08:42:51 -0700 (PDT) Received: from linaro.org ([2a00:23c5:6809:2201:a9e8:9fdd:fa2d:1c72]) by smtp.gmail.com with ESMTPSA id j6-20020adfff86000000b0021d6b851ca1sm2763749wrr.111.2022.07.04.08.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 08:42:51 -0700 (PDT) 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, leo.yan@linaro.org, acme@kernel.org, james.clark@arm.com, Mike Leach Subject: [PATCH v4 0/7] coresight: syscfg: Extend configfs for config load Date: Mon, 4 Jul 2022 16:42:42 +0100 Message-Id: <20220704154249.11501-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-20220704_084253_341781_4C46EA37 X-CRM114-Status: GOOD ( 14.71 ) 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 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 (7): 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 configfs: Fix LOCKDEP nesting issues with fragment semaphores .../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 | 300 +++++++-- .../coresight/coresight-syscfg-configfs.h | 3 + .../hwtracing/coresight/coresight-syscfg.c | 107 ++++ .../hwtracing/coresight/coresight-syscfg.h | 2 + fs/configfs/configfs_internal.h | 3 + fs/configfs/dir.c | 45 ++ 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 +++ 21 files changed, 2298 insertions(+), 46 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