From patchwork Tue Jul 7 10:10:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 50813 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7AAA322A03 for ; Tue, 7 Jul 2015 10:12:47 +0000 (UTC) Received: by wipp2 with SMTP id p2sf40752204wip.2 for ; Tue, 07 Jul 2015 03:12:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=YaQ71MprPXdc38AKO81/1upLmLrEW9ALOAhb2IgSAMc=; b=mYGIYyHoIbmyxII0p+iyhtDyZ7B0xth2T8zHmG9AkxMfjXDkgAzZVNkDsB0vvFs3vD flpXqaQCELW1tt+qGMXSedWX5hDltGw37fqirCarkJ4UFN2xO+rZiKVZnQ36U/xJYXih nQm8BncE4uf8mW9PSCYYIvSLIl6j6JLs9F5/H9fbe6M33GitD47h4FOtB7wfUCsB9/Cb iOD4Swh51OHP3PEmzdul15FDfPNqYOr4G///Cl9NWv9RbG0D+Hm0DBsCRZu9qZGtswi8 zkKVrjRzgZcPxXaAlYWUN0rsdqqIPJge6YYwaNsjQe4jmlhGC1/NbU6Sz06u9bWBY9du TvRw== X-Gm-Message-State: ALoCoQnvk5lg8oLmc4RslHyFqijd1EP4b24zGJ6qXBs/hpVPcnPn+080FOsRGycwarMA05Ghwr4p X-Received: by 10.112.85.69 with SMTP id f5mr1782031lbz.23.1436263966793; Tue, 07 Jul 2015 03:12:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.103 with SMTP id l7ls792103laf.35.gmail; Tue, 07 Jul 2015 03:12:46 -0700 (PDT) X-Received: by 10.152.36.161 with SMTP id r1mr3279680laj.88.1436263966606; Tue, 07 Jul 2015 03:12:46 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id pj6si17756601lbb.17.2015.07.07.03.12.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jul 2015 03:12:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by laar3 with SMTP id r3so189158463laa.0 for ; Tue, 07 Jul 2015 03:12:46 -0700 (PDT) X-Received: by 10.152.5.197 with SMTP id u5mr3031260lau.76.1436263966361; Tue, 07 Jul 2015 03:12:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2282841lbb; Tue, 7 Jul 2015 03:12:43 -0700 (PDT) X-Received: by 10.68.246.1 with SMTP id xs1mr7296933pbc.53.1436263963041; Tue, 07 Jul 2015 03:12:43 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si33970032pdb.7.2015.07.07.03.12.42; Tue, 07 Jul 2015 03:12:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756845AbbGGKM1 (ORCPT + 29 others); Tue, 7 Jul 2015 06:12:27 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:32834 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756459AbbGGKMH (ORCPT ); Tue, 7 Jul 2015 06:12:07 -0400 Received: by pacws9 with SMTP id ws9so112455636pac.0 for ; Tue, 07 Jul 2015 03:12:06 -0700 (PDT) X-Received: by 10.68.69.7 with SMTP id a7mr7365168pbu.93.1436263926723; Tue, 07 Jul 2015 03:12:06 -0700 (PDT) Received: from zcy-ubuntu.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id o7sm21361821pdi.16.2015.07.07.03.12.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Jul 2015 03:12:05 -0700 (PDT) From: Chunyan Zhang To: rostedt@goodmis.org, mingo@redhat.com Cc: mathieu.poirier@linaro.org, serge.broslavsky@linaro.org, broonie@kernel.org, alexander.shishkin@linux.intel.com, zhang.lyra@gmail.com, linux-kernel@vger.kernel.org Subject: [RFC PATCH v3 1/4] STM trace event: Adding generic buffer interface driver Date: Tue, 7 Jul 2015 18:10:40 +0800 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zhang.chunyan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mathieu Poirier This patch adds a driver that models itself as an stm_source and who's sole purpose is to export an interface to the rest of the kernel. Once the stm and stm_source have been linked via sysfs, everything that is passed to the interface will endup in the STM trace engine. Signed-off-by: Mathieu Poirier Signed-off-by: Chunyan Zhang --- drivers/stm/Kconfig | 11 +++++++++++ drivers/stm/Makefile | 2 ++ drivers/stm/stm_trace_event.c | 46 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 drivers/stm/stm_trace_event.c diff --git a/drivers/stm/Kconfig b/drivers/stm/Kconfig index 6f2db70..8ead418 100644 --- a/drivers/stm/Kconfig +++ b/drivers/stm/Kconfig @@ -25,3 +25,14 @@ config STM_SOURCE_CONSOLE If you want to send kernel console messages over STM devices, say Y. + +config STM_TRACE_EVENT + tristate "Redirect/copy the output from kernel trace event to STM engine" + depends on STM + help + This option can be used to redirect or copy the output from kernel trace + event to STM engine. Enabling this option will introduce a slight + timing effect. + + If you want to send kernel trace event messages over STM devices, + say Y. diff --git a/drivers/stm/Makefile b/drivers/stm/Makefile index 74baf59..55b152c 100644 --- a/drivers/stm/Makefile +++ b/drivers/stm/Makefile @@ -5,3 +5,5 @@ stm_core-y := core.o policy.o obj-$(CONFIG_STM_DUMMY) += dummy_stm.o obj-$(CONFIG_STM_SOURCE_CONSOLE) += console.o + +obj-$(CONFIG_STM_TRACE_EVENT) += stm_trace_event.o diff --git a/drivers/stm/stm_trace_event.c b/drivers/stm/stm_trace_event.c new file mode 100644 index 0000000..bc77dae --- /dev/null +++ b/drivers/stm/stm_trace_event.c @@ -0,0 +1,46 @@ +/* + * Simple kernel driver to link kernel trace event and an STM device + * Copyright (c) 2015, Linaro Ltd. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include +#include +#include +#include +#include + +static struct stm_source_data stm_trace_event_data = { + .name = "stm_trace_event", + .nr_chans = 1, +}; + +void stm_trace_event_write(const char *buf, unsigned len) +{ + stm_source_write(&stm_trace_event_data, 0, buf, len); +} + +static int __init stm_trace_event_init(void) +{ + return stm_source_register_device(NULL, &stm_trace_event_data); +} + +static void __exit stm_trace_event_exit(void) +{ + stm_source_unregister_device(&stm_trace_event_data); +} + +module_init(stm_trace_event_init); +module_exit(stm_trace_event_exit); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("stm_trace_event driver"); +MODULE_AUTHOR("Mathieu Poirier ");