From patchwork Thu Jan 28 17:09:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Leach X-Patchwork-Id: 12054207 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.0 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=ham 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 706D4C433E0 for ; Thu, 28 Jan 2021 17:11:35 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 17C4F64DE2 for ; Thu, 28 Jan 2021 17:11:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 17C4F64DE2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MBPU0BkoYpTJzEZohpwvClfNShD/fAWIutSo3Aw/CEI=; b=CCDt7aPO7un1R1YjxSUj1TfYMi GfPV3S8UiHRlYjpOUSHYmFuLvMB1W0XA3Yay7eNw6/MCll3vA4HRxBTfvgCUKqybIo9kxXjp0V1X9 rgOXvJ3a30otcQWQ90JQB2cY0nvhMhFhUWugB32vEJbrqozrdKgZTnvG3dnUlklMI5IiYyPDKJNjO 7aoAljR7eouJ3apw4411iNO49FrGwoAUNud/+2vdJoBnVu22rGRejmnzWOZXk5tzgo+7eF9ifKH+9 6AKu8BIvOY/CNUg/YsIq1ZT4hR81tv5XX0GCBXfmxkjcr1WFM4TD4eM+T962oFyA/ayd14o43IRa9 6BCR8dXw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l5Ao3-0000EY-GJ; Thu, 28 Jan 2021 17:10:07 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l5Ann-0000A9-EQ for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2021 17:09:55 +0000 Received: by mail-wr1-x42c.google.com with SMTP id v15so6183639wrx.4 for ; Thu, 28 Jan 2021 09:09:51 -0800 (PST) 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=c+TM9hQ1DCJj1Sx/zagtZCNZZA06suw1HBUOznUqWnA=; b=xeH6+PqnSwdFzNGKTcQbFpzFKsvKrtJYhBbpBUoGwEoVk9Nu187EGduv0Val+EEydR FTbhLt+r55QSSFP3sBPaEooIRS66ZFU3ZCSi+KaKx3xQwNmZCAf/xOr9QPisBl+t7o51 ajxUggYGA/m+CcHHYfkbp8lljAGJXjNLOinVWRb5Lz5rQNxIYO/hrSIF9Y+X/AUQJoa5 sFVADuSotuGNMT3AAogpXpHEzT6Hi7kKIuymUyoYFUVWAZDmWIGvm8PXzyngPvw9+CbK JoshzZyyQjDgT83RoUhiFCEK0Jn0Cwoio2nRKezetqEaFBKDAC0ToGSZkdT7viGMeou7 WICg== 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=c+TM9hQ1DCJj1Sx/zagtZCNZZA06suw1HBUOznUqWnA=; b=oZbFpx4/YCurTMrakXJxJlZHS7AuQAxr9rhSuPVWBiF4HOs9e/QEg8Esii3/8S8fWC ZM/QCiRRCcstIvAn4YvBeGJG98B+e/rda566rDFV0cQZGhan1tMLIdLfHzwNWpE29xLn 0EseTliSMlA+ho3g5CYxTcm2eiGSys0B4oTPgMJcRjkbWANKwJ264uzfuH/NNzIqHk+e yoQGQbj3EfOMkS/FP5irpGfUBbJGqntO1Boa7WtOJ5QlIxl82ItkQsWNEUrofiaT9kVV kFXQe73RQ6NOXC4NvpzM6iYtbmBS1ebIK5IsNy5wXCgrQApdCVQmANH/wJmOe1Q9EATw WmIw== X-Gm-Message-State: AOAM530Ywk9nQ4uLYIj7qAxtnCNsFJVCDAXLoiSWLB0EmZvzXyQYcm4b BBNQEnwFdRfv/vKrMaukeJ+CXagRtuymCA== X-Google-Smtp-Source: ABdhPJx+v2AUO/iuiXfbbphnaUYMs9oQHxAlDN6mlYMQjMSSZnB+sJvQovAD9V+CE3S69fwEl2l9IQ== X-Received: by 2002:adf:e48b:: with SMTP id i11mr32322wrm.406.1611853790592; Thu, 28 Jan 2021 09:09:50 -0800 (PST) Received: from linaro.org ([2a00:23c5:6801:1801:40:2fca:953a:e6ba]) by smtp.gmail.com with ESMTPSA id p15sm7622355wrt.15.2021.01.28.09.09.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jan 2021 09:09:50 -0800 (PST) From: Mike Leach To: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org, mathieu.poirier@linaro.org, linux-doc@vger.kernel.org, suzuki.poulose@arm.com Subject: [PATCH v4 06/10] coresight: etm-perf: Update to activate selected configuration Date: Thu, 28 Jan 2021 17:09:32 +0000 Message-Id: <20210128170936.9222-7-mike.leach@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210128170936.9222-1-mike.leach@linaro.org> References: <20210128170936.9222-1-mike.leach@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210128_120951_634409_7B25FD22 X-CRM114-Status: GOOD ( 17.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gregkh@linuxfoundation.org, alexander.shishkin@linux.intel.com, yabinc@google.com, corbet@lwn.net, linux-kernel@vger.kernel.org, tingwei@codeaurora.org, leo.yan@linaro.org, Mike Leach MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 --- 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 e270bb1e0f7d..5c1aeddabc59 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -178,6 +178,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->config_id_hash) + cscfg_deactivate_config(event_data->config_id_hash); + for_each_cpu(cpu, mask) { struct list_head **ppath; @@ -236,7 +240,7 @@ static void etm_free_aux(void *data) static void *etm_setup_aux(struct perf_event *event, void **pages, int nr_pages, bool overwrite) { - u32 id; + u32 id, config_id; int cpu = event->cpu; cpumask_t *mask; struct coresight_device *sink = NULL; @@ -253,6 +257,14 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, sink = coresight_get_sink_by_id(id); } + /* check if user wants a coresight configuration selected */ + config_id = (u32)((event->attr.config2 & GENMASK_ULL(63, 32)) >> 32); + if (config_id) { + if (cscfg_activate_config(config_id)) + goto err; + event_data->config_id_hash = config_id; + } + mask = &event_data->mask; /* diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.h b/drivers/hwtracing/coresight/coresight-etm-perf.h index 3646a3837a0b..751d768939d8 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. + * @config_id_hash: The 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 config_id_hash; struct list_head * __percpu *path; };