From patchwork Wed Jan 31 11:34:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: sagar.a.kamble@intel.com X-Patchwork-Id: 10193929 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 924D760383 for ; Wed, 31 Jan 2018 11:30:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EFBB285FC for ; Wed, 31 Jan 2018 11:30:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 736FD28647; Wed, 31 Jan 2018 11:30:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C401D2861C for ; Wed, 31 Jan 2018 11:30:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E46C46E56A; Wed, 31 Jan 2018 11:30:52 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id B3F076E56A; Wed, 31 Jan 2018 11:30:51 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2018 03:30:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,439,1511856000"; d="scan'208";a="14419328" Received: from sakamble-desktop.iind.intel.com ([10.223.26.10]) by fmsmga008.fm.intel.com with ESMTP; 31 Jan 2018 03:30:49 -0800 From: Sagar Arun Kamble To: igt-dev@lists.freedesktop.org Date: Wed, 31 Jan 2018 17:04:25 +0530 Message-Id: <1517398465-13783-1-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH igt v2 1/1] tools/intel_guc_logger: Send GuC log level in new i915 expected format X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP i915 expects GuC log level to be specified as: 0: disabled 1: enabled (verbosity level 0 = min) 2: enabled (verbosity level 1) 3: enabled (verbosity level 2) 4: enabled (verbosity level 3 = max) Remove the earlier internal layout based logging control from guc_log_control and send new expected values. v2: log_level assert in guc_log_control, cleaner level setup (Michal) added missing copyright header. (Sagar) Signed-off-by: Sagar Arun Kamble Cc: Michal Wajdeczko Cc: Daniele Ceraolo Spurio Cc: Chris Wilson Cc: Michal Winiarski Reviewed-by: Michal Wajdeczko --- tools/intel_guc_logger.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/tools/intel_guc_logger.c b/tools/intel_guc_logger.c index 031fd84..5f1de8d 100644 --- a/tools/intel_guc_logger.c +++ b/tools/intel_guc_logger.c @@ -1,3 +1,26 @@ +/* + * Copyright © 2014-2018 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + */ #include #include @@ -51,17 +74,27 @@ uint32_t test_duration, max_filesize; pthread_cond_t underflow_cond, overflow_cond; bool stop_logging, discard_oldlogs, capturing_stopped; -static void guc_log_control(bool enable_logging) +static void guc_log_control(bool enable, uint32_t log_level) { int control_fd; char data[19]; uint64_t val; int ret; + igt_assert_lte(log_level, 3); + control_fd = igt_debugfs_open(-1, CONTROL_FILE_NAME, O_WRONLY); igt_assert_f(control_fd >= 0, "couldn't open the guc log control file\n"); - val = enable_logging ? ((verbosity_level << 4) | 0x1) : 0; + /* + * i915 expects GuC log level to be specified as: + * 0: disabled + * 1: enabled (verbosity level 0 = min) + * 2: enabled (verbosity level 1) + * 3: enabled (verbosity level 2) + * 4: enabled (verbosity level 3 = max) + */ + val = enable ? log_level + 1 : 0; ret = snprintf(data, sizeof(data), "0x%" PRIx64, val); igt_assert(ret > 2 && ret < sizeof(data)); @@ -288,7 +321,7 @@ static void init_main_thread(void) /* Enable the logging, it may not have been enabled from boot and so * the relay file also wouldn't have been created. */ - guc_log_control(true); + guc_log_control(true, verbosity_level); open_relay_file(); open_output_file(); @@ -420,7 +453,7 @@ int main(int argc, char **argv) } while (!stop_logging); /* Pause logging on the GuC side */ - guc_log_control(false); + guc_log_control(false, 0); /* Signal flusher thread to make an exit */ capturing_stopped = 1;