From patchwork Fri Jun 5 05:37:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 49553 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 07AB224612 for ; Fri, 5 Jun 2015 05:37:19 +0000 (UTC) Received: by labpg10 with SMTP id pg10sf16648457lab.2 for ; Thu, 04 Jun 2015 22:37:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:date:message-id :subject:from:to:cc:content-type:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=84brhw+S8m3oMo8w0FIL/GA3OjpqIZSsC4QCDFvZOuU=; b=RrBy/HpyLxKDhn5pWIXEWU1r4cjzAfNLmQc+gXtBnRUj+kU2dU/eTgHbxM/HMQxRIx f+FuanlrjsvafDpjl1DxkfS4qoeMQrn84QCbG2kA9yccqmTK9e7yT8hx6ARrCzFctLZ+ VXjbXLFoHvPwQNfBMogsO/SF0hTiHN7EQViZcfX4oyGV6jhGw8JAO5NQ1x+Eup7l41hI Reo5EZUSKhBKXIHic2E7h/xqyqZtYQJ3uFQwb35W1GZyklavtw6LvpFdUMbyUYpuQFK1 uBfNn2vEAujT3OSTjkmCjPJuEpx/uLs6ksP5dZvIIFAZ7tf8OKtYpQhW94cM8YgKtqHN Q/Vw== X-Gm-Message-State: ALoCoQl1UOq3hxgA63dHL0uro95sWqVDOebjQDAlMeMKuFHHyd4peTWNiruM8FAyDBIdamQAnxu9 X-Received: by 10.180.216.12 with SMTP id om12mr7075931wic.1.1433482638031; Thu, 04 Jun 2015 22:37:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.181.34 with SMTP id dt2ls288087lac.14.gmail; Thu, 04 Jun 2015 22:37:17 -0700 (PDT) X-Received: by 10.112.72.132 with SMTP id d4mr1589980lbv.1.1433482637843; Thu, 04 Jun 2015 22:37:17 -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 d1si3855994laf.93.2015.06.04.22.37.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jun 2015 22:37:17 -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 labko7 with SMTP id ko7so46726644lab.2 for ; Thu, 04 Jun 2015 22:37:17 -0700 (PDT) X-Received: by 10.112.155.197 with SMTP id vy5mr1567500lbb.29.1433482637685; Thu, 04 Jun 2015 22:37:17 -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 hn6csp1138303lbb; Thu, 4 Jun 2015 22:37:16 -0700 (PDT) X-Received: by 10.68.173.197 with SMTP id bm5mr3077834pbc.13.1433482635817; Thu, 04 Jun 2015 22:37:15 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qx6si9332877pab.13.2015.06.04.22.37.14; Thu, 04 Jun 2015 22:37:15 -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 S1753565AbbFEFhK (ORCPT + 28 others); Fri, 5 Jun 2015 01:37:10 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:36261 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751463AbbFEFhE (ORCPT ); Fri, 5 Jun 2015 01:37:04 -0400 Received: by wiam3 with SMTP id m3so7194677wia.1 for ; Thu, 04 Jun 2015 22:37:03 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.194.235.4 with SMTP id ui4mr3187994wjc.0.1433482623258; Thu, 04 Jun 2015 22:37:03 -0700 (PDT) Received: by 10.194.14.194 with HTTP; Thu, 4 Jun 2015 22:37:03 -0700 (PDT) Date: Fri, 5 Jun 2015 13:37:03 +0800 Message-ID: Subject: [RFC PATCH 1/3] STM trace event: Adding generic buffer interface driver From: Chunyan Zhang To: Steven Rostedt , mingo@redhat.com Cc: Mathieu Poirier , Kaixu Xia , Serge Broslavsky , Mark Brown , alexander.shishkin@linux.intel.com, "linux-kernel@vger.kernel.org" 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 -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ 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..0d787ce --- /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 stm_trace_event_init(void) +{ + return stm_source_register_device(NULL, &stm_trace_event_data); +} + +static void 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 ");