Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5555119pxv; Wed, 7 Jul 2021 06:32:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYAvvzbitI2RwTgstUeTfrrHkVN8LNYSNnkrr2bwCba3Sq+CdvusFTc67a7OTDIJ39AjhW X-Received: by 2002:a17:906:1dd2:: with SMTP id v18mr15399088ejh.322.1625664769172; Wed, 07 Jul 2021 06:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625664769; cv=none; d=google.com; s=arc-20160816; b=uLpVeWsB167lE9R3ljAwhO7QYhjCIna+EcPslzgg7se4kPsYD7t38HZjc/g6UYaJCh MU6jU4KhZbsvnTr7uusi6DocIxrt8O2qlVnXoE0rjhSmp1BeWk0NmpLYfi/JsYN59ilB 8yMn/NcoNxBaoHecH1h4YfW740iYZdlcQro7jteFtGOYeUpprKJWitylVBT4x2pmGHUq d9djAzC+NEj7Haz+cqHpIbANsSw3kHmxsnFEhcj3Mk/mKjbzK6Py0TC/8QU9KQIJ81oG Ts7ZrFQP/Y1ZtbI7alUDdHSWunoQ6JTdqPLdv9t6nRDUoTQ/jbsQVmC7sqUD8HVOgIK6 h56A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=ABwZIw+GuHuxpYSzBenQkHeYDXmCXaPxspUFiSW1wck=; b=dMMyv1KF/13HCizMVD4vi299kgvxFFYCjpUoGigDChsJkItXqHLrxQ/xSpzwBTeuwS zGkXfVpcn3hbrPl0EFzGpRzMT2IOE7t36LF+zC65IM2FKv6LsyVR4cW6MpSot1RBJkXa kDR4LWJ/DJUOYRQ2JxfAcyV0tykORnbA6D0XphA+iN6oJIZnP/t13V2j/y2GaLF0z1/6 F7h1zlsMeUvUaqssS/TgHaef9zuk/jInUVPGOdc2fe6v/v+Uu5/Z7Q9Umk0uJVQQ8qD0 7upRX4EOdNqf4LH3QFEcfdqdQyyXoQoHpbJNE6rm252gIIzjwWkvTwj25XRclhvvDgzi IwyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=baO9xBkf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l19si18225856eds.569.2021.07.07.06.32.26; Wed, 07 Jul 2021 06:32:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=baO9xBkf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231877AbhGGNdI (ORCPT + 99 others); Wed, 7 Jul 2021 09:33:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231829AbhGGNcy (ORCPT ); Wed, 7 Jul 2021 09:32:54 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEC17C061760 for ; Wed, 7 Jul 2021 06:30:10 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id u8so3054098wrq.8 for ; Wed, 07 Jul 2021 06:30:10 -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=ABwZIw+GuHuxpYSzBenQkHeYDXmCXaPxspUFiSW1wck=; b=baO9xBkf/3/zuaZch/wmriHOBT+x6aCt380iKirtgC0QxJk7tlBLFND/6+xC/fIPxl Q0K5S9Xua9ReDU8UUoXnUrxbjCrwGwVkBA0ZM3GFGxSPW36tdaqPZsTA/6czWTkaNAKH hbOV0XFTHNAviGtMTMD2BlPW09z5K+wLpsIeaXXSzKOb15tWqeLGG5Fk96Iaeax9WrNo HR7nqb7jxmHGbnSR6WPg8NKiPQRyz9RBF4NNW8dxopok3VSnlbi8LDZUxK/cjdDfHOhu Np1rbk7DaeQiLXIwd9Ub9NwOmVzKoM6SVYpP9yDpJ5oF9/zcVs2svwpMc2Ks+VwNc4+6 TbNw== 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; bh=ABwZIw+GuHuxpYSzBenQkHeYDXmCXaPxspUFiSW1wck=; b=ZpO5JB3s0fvawoAPsa75Gfh9ktpBf98NW0QTL0fnx+BL+xp/JzcDFavMQqg1nOMcWR MouWBpa0CQvD50muldw/r4VYZsm1Kr17T/kgYmCiCNWKHF84G5UdhVmtvRiuWakfWsqb bqNIptQE/4L/CdCbbHadt9VNoTMIb/FXuRpTn06rfGEgitG0T9CmdvCNUUx5XGoY1ixC M1vn9jvi/pTKeAJid17ur9dNTWiHTRthdKtPSqfwnEZUiNe6VMusONeQ/ljQeche5BGR Hvl1v10D46GiNk+wPNKRla0X4qEAEPqwdE8TYpj5gx4n5oI9GDWi1umdqRAKPsa56/BT DSZw== X-Gm-Message-State: AOAM530Amoo0e6R8H+8+vvrFWd8H9FeWWkHjHrz241bVHwF5Hl5o5JX0 jtrqSbLYquo93V8Ti72qqiUaeA== X-Received: by 2002:adf:d212:: with SMTP id j18mr28219934wrh.150.1625664609349; Wed, 07 Jul 2021 06:30:09 -0700 (PDT) Received: from linaro.org ([2a00:23c5:6809:2201:546d:7d59:1703:bf96]) by smtp.gmail.com with ESMTPSA id l16sm6632403wmj.47.2021.07.07.06.30.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 06:30:09 -0700 (PDT) From: Mike Leach To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, mathieu.poirier@linaro.org, suzuki.poulose@arm.com Cc: leo.yan@linaro.org, alexander.shishkin@linux.intel.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, Mike Leach Subject: [PATCH v8 06/10] coresight: etm-perf: Update to activate selected configuration Date: Wed, 7 Jul 2021 14:29:59 +0100 Message-Id: <20210707133003.5414-7-mike.leach@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210707133003.5414-1-mike.leach@linaro.org> References: <20210707133003.5414-1-mike.leach@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-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; }; -- 2.17.1