From patchwork Wed Aug 18 19:40:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 12445187 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 D4B6FC4338F for ; Wed, 18 Aug 2021 19:44:54 +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 A4E9A610CD for ; Wed, 18 Aug 2021 19:44:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A4E9A610CD 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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=3iqWtUI5SpgT1vHOnrL1J5kErKoknFXEEYoMh40o2nI=; b=orVcQ31hvTGgyn gyXgQ8xYGoDNVW9owaZQzeCDh+B5Q9bK9XnRVhpmfJ2AnAFc+eZhA/IpDj0blgSR56xfDieCNV7nt lET9V+1aTX0M1GswR00E6CLZZMV5p/ahb+3dq0gc7UoPRT4a5LFrpbBw2vSVMonmgtBKLIuE3whUW qbbkgoHxWEdCRMPmKzbjf+WYJ3r7g6l90bbleDYgRkrxGLSxqEUrT+/yUQTN5nZWWkyviM60Ua3kg UtCRfCWoNg5AKAVBM0BOE55l42y7XebJAgfp9t1ZSfbc8gnC3u9U80ePWF8HVBa4PWDUK8XKHQ2TY KUoQneGXkqb35+eGIBTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mGRS6-006W4p-VF; Wed, 18 Aug 2021 19:42:19 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mGRQQ-006VUB-GS for linux-arm-kernel@lists.infradead.org; Wed, 18 Aug 2021 19:40:36 +0000 Received: by mail-pl1-x634.google.com with SMTP id f3so2496922plg.3 for ; Wed, 18 Aug 2021 12:40:34 -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 :mime-version:content-transfer-encoding; bh=A+QlnDDrnRdRrKZAGMdLO6WKB+rMMxSNRXmdszPCoIE=; b=dU4GAPUJOpLXrKMiaNhn9vplv92ORlF/7RIrHvm2DNUjSKWp+FxhQM8sVz9IZXfCxt QIBR9+wd1UhVIX32Plbi5rWZJKTPgJq3jmJWtJpnlVvEk3GRyYOpTjCwT8efcn3/Vlx0 deHL9wbqlxiAOuFzwuQvnGOYHiQPEfNPGHLRo9qG6d2H6DCx/mi2tvnW8thXPlgNtwz1 dp9KrvYjTHDG1fVZDhzKGP4ZBwHqbb60hL3nGWpvNZiq28UDSWSz0l+d6K7vQ61nrSKf HJkj23af/UA/Uc8MeEQ/j3xekmROQWJ7kvXrA6KDuEAil1h5oLMpna271QLCiE2JO0jb irqQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=A+QlnDDrnRdRrKZAGMdLO6WKB+rMMxSNRXmdszPCoIE=; b=tvQcdwe8i5YDPDKK4Z1rlKcBtomirbl9h2MlMyL7DkySXwOaLYCowNI01eE6HCA2Wi BI9l0xNazVBZ15vi0jrob0f9e5UKtpOmOysGbqXB1NI5r3b6LOpOae/WS3jmEWLE45cV 0+EH8OdfSZnpdTXn8bGAOYXJX9C5RNR2/ODVLeT/4pemOFRh0xNSp9BzONqhUAQ8emld w/mXl0c2376y9bWw6EKzwwbWbXvLiuwG++CRQcH5rna+9m6zdjE8u3let6O+ehNc/tto 6DjyvYJskMqYNbu+DsCdLHQ9DLLriZ0kcA6lNZfBm/i6ywrD5fv9h3bskiuAIwZFsQ3F mDxg== X-Gm-Message-State: AOAM530yLb/izK65IZGa8irDx14wq2m5aFzSgEBZM7sKivXdyxbjZXIm 7uGP15tO/glYv8XYu5VZRloNB1BP6yzvNw== X-Google-Smtp-Source: ABdhPJzSSWvJ/RzvV/sO08EXugFwMlNtHmSTPShBKCAqiafr17w1iRzvCZ/DiLRnY5OlDHOVV8JxCQ== X-Received: by 2002:a17:90a:4a88:: with SMTP id f8mr11118902pjh.226.1629315633797; Wed, 18 Aug 2021 12:40:33 -0700 (PDT) Received: from p14s.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id k12sm2960137pjg.6.2021.08.18.12.40.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 12:40:33 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/11] coresight: etm-perf: Update to activate selected configuration Date: Wed, 18 Aug 2021 13:40:17 -0600 Message-Id: <20210818194022.379573-7-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818194022.379573-1-mathieu.poirier@linaro.org> References: <20210818194022.379573-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210818_124034_595319_152EE447 X-CRM114-Status: GOOD ( 18.35 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Mike Leach Add calls to activate the selected configuration as perf starts and stops the tracing session. Signed-off-by: Mike Leach Reviewed-by: Suzuki K Poulose Link: https://lore.kernel.org/r/20210723165444.1048-7-mike.leach@linaro.org Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etm-perf.c | 14 +++++++++++++- drivers/hwtracing/coresight/coresight-etm-perf.h | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index e42ab919ddc3..8ebd728d3a80 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -215,6 +215,10 @@ static void free_event_data(struct work_struct *work) /* Free the sink buffers, if there are any */ free_sink_buffer(event_data); + /* clear any configuration we were using */ + if (event_data->cfg_hash) + cscfg_deactivate_config(event_data->cfg_hash); + for_each_cpu(cpu, mask) { struct list_head **ppath; @@ -292,7 +296,7 @@ static bool sinks_compatible(struct coresight_device *a, static void *etm_setup_aux(struct perf_event *event, void **pages, int nr_pages, bool overwrite) { - u32 id; + u32 id, cfg_hash; int cpu = event->cpu; cpumask_t *mask; struct coresight_device *sink = NULL; @@ -310,6 +314,14 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, sink = user_sink = coresight_get_sink_by_id(id); } + /* check if user wants a coresight configuration selected */ + cfg_hash = (u32)((event->attr.config2 & GENMASK_ULL(63, 32)) >> 32); + if (cfg_hash) { + if (cscfg_activate_config(cfg_hash)) + goto err; + event_data->cfg_hash = cfg_hash; + } + mask = &event_data->mask; /* diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwtracing/coresight/coresight-etm-perf.h index ba617fe2217e..468f7799ab4f 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.h +++ b/drivers/hwtracing/coresight/coresight-etm-perf.h @@ -49,12 +49,14 @@ struct etm_filters { * @work: Handle to free allocated memory outside IRQ context. * @mask: Hold the CPU(s) this event was set for. * @snk_config: The sink configuration. + * @cfg_hash: The hash id of any coresight config selected. * @path: An array of path, each slot for one CPU. */ struct etm_event_data { struct work_struct work; cpumask_t mask; void *snk_config; + u32 cfg_hash; struct list_head * __percpu *path; };