From patchwork Mon May 9 21:01:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Teres Alexis, Alan Previn" X-Patchwork-Id: 12844063 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6AC06C433F5 for ; Mon, 9 May 2022 21:01:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5944B10F1EF; Mon, 9 May 2022 21:01:48 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 625E910F1EA for ; Mon, 9 May 2022 21:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652130106; x=1683666106; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=twZSMi3yviI4f0odHrBgbM8gDhqsymy4UmR9Z9/zuWo=; b=MYMkkRFuSZcAG+pGFZ+r+DBmJQ69u+5MACCLOJTVd4pEyUaO3zZyDuyC cSFL+PFMK43fAdwmPGn8jlT5hpFux1z3LOBWh2lD+ChbkD6wjlXAxytZt oHK+9t5q5ExgjjIXv9QU2vJJujY+RKTapW3EIwVv6CQul/3AT8OZ1GMeb nVv4wf5/YAVGTY81N0LjfKAmwiI09bqUOGEYbRfo2/hCuIyzmAVKleewr dx0SgGqpetQ5o7hSG8FKHxSZ2P0uvMLq3Zen/kxJn6h9CZOHwnvSC3znr hTUtGGvNWt6Da8mqq5P8DUJ70ubbELS4EqBNlil93XOI17FNWms690qgK Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10342"; a="249703592" X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="249703592" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2022 14:01:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="519410905" Received: from aalteres-desk.fm.intel.com ([10.80.57.53]) by orsmga003.jf.intel.com with ESMTP; 09 May 2022 14:01:45 -0700 From: Alan Previn To: intel-gfx@lists.freedesktop.org Date: Mon, 9 May 2022 14:01:46 -0700 Message-Id: <20220509210151.1843173-2-alan.previn.teres.alexis@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509210151.1843173-1-alan.previn.teres.alexis@intel.com> References: <20220509210151.1843173-1-alan.previn.teres.alexis@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [Intel-gfx 1/6] drm/i915/guc: Fix GuC relay log debugfs failing open X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" When GuC-Error-Capture was introduced, we created buf_in_use as a way to identify if relay logging had started. It is meant to replace the previous method where a mmap of the GuC log buffer was the indicator but not since GuC Error Capture shares that mapping throughout operation. However, that method of checking was not updated when the debugfs guc_log_relay_ctl_open was called. Fix that check. Fixes: drm/i915/guc: Add capture region into intel_guc_log (daff407a083d). Signed-off-by: Alan Previn Link: https://patchwork.freedesktop.org/patch/479021/?series=101603&rev=1 Reviewed-by: Ashutosh Dixit --- drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c index 78d2989fe917..09f4d5fbca82 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c @@ -568,7 +568,7 @@ int intel_guc_log_set_level(struct intel_guc_log *log, u32 level) bool intel_guc_log_relay_created(const struct intel_guc_log *log) { - return log->buf_addr; + return log->relay.buf_in_use; } int intel_guc_log_relay_open(struct intel_guc_log *log) From patchwork Mon May 9 21:01:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Teres Alexis, Alan Previn" X-Patchwork-Id: 12844060 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9FDEC433F5 for ; Mon, 9 May 2022 21:01:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E35AD10F1E6; Mon, 9 May 2022 21:01:47 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7DC4110F1EF for ; Mon, 9 May 2022 21:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652130106; x=1683666106; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=dYnUTteFcMP5sRyGAIb7K2FM5v4FyAFpRxWKAHfDUuo=; b=D/QUxOa+OuTUUjejzTd15QY+dypiHIFjWTlA0xVgI2KjpRXJemlV3IYl fRxu1f1oQU4gM8Dfz178JOhf65eAp8Dzl1SD/KpM9wlp2f+Q9uGCUSyNs qq7UgGv5ESDt7YDTtZj7guOgPdhU9abqhknLz8GvxCPukpngb5GBuj8xT fw8Tcj+yM/kbPSHNTt5tJwJiNcAOiB648XsXWlU52PaOw8jrgTO7OFpLp /znKuvOBfzQV8gN3vnGe59/VzgrSkVHNsRwiSGyHK3UFoTQ8A8IBXy8H5 Ji0T8h/jBuJmX16O2vQW/IMKa44ZNtiWjN3u2/ukbLSV+xjDAw58Esauc w==; X-IronPort-AV: E=McAfee;i="6400,9594,10342"; a="249703593" X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="249703593" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2022 14:01:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="519410906" Received: from aalteres-desk.fm.intel.com ([10.80.57.53]) by orsmga003.jf.intel.com with ESMTP; 09 May 2022 14:01:45 -0700 From: Alan Previn To: intel-gfx@lists.freedesktop.org Date: Mon, 9 May 2022 14:01:47 -0700 Message-Id: <20220509210151.1843173-3-alan.previn.teres.alexis@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509210151.1843173-1-alan.previn.teres.alexis@intel.com> References: <20220509210151.1843173-1-alan.previn.teres.alexis@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [Intel-gfx 2/6] drm/i915/guc: Add unaligned wc memcpy for copying GuC Log X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Add usage of unaligned wc mempy in read_update_log_buffer as newer formats of GuC debug-log-events are no longer guaranteed to be exactly 4-dwords long per event. Signed-off-by: Alan Previn Reviewed-by: Ashutosh Dixit --- drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c index 09f4d5fbca82..d902b40ded0e 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c @@ -301,13 +301,16 @@ static void _guc_log_copy_debuglogs_for_relay(struct intel_guc_log *log) /* Just copy the newly written data */ if (read_offset > write_offset) { - i915_memcpy_from_wc(dst_data, src_data, write_offset); + if (!i915_memcpy_from_wc(dst_data, src_data, write_offset)) + i915_unaligned_memcpy_from_wc(dst_data, src_data, write_offset); bytes_to_copy = buffer_size - read_offset; } else { bytes_to_copy = write_offset - read_offset; } - i915_memcpy_from_wc(dst_data + read_offset, - src_data + read_offset, bytes_to_copy); + if (!i915_memcpy_from_wc(dst_data + read_offset, + src_data + read_offset, bytes_to_copy)) + i915_unaligned_memcpy_from_wc(dst_data + read_offset, + src_data + read_offset, bytes_to_copy); src_data += buffer_size; dst_data += buffer_size; From patchwork Mon May 9 21:01:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Teres Alexis, Alan Previn" X-Patchwork-Id: 12844062 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5A20C433FE for ; Mon, 9 May 2022 21:01:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE2BD10F20C; Mon, 9 May 2022 21:01:48 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id A150810F1E6 for ; Mon, 9 May 2022 21:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652130106; x=1683666106; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=EmyH7zUpNBcLRtu1eBPomsIAxrsy9jJDCH/e9KxcUZ8=; b=MseqYcIxpOf2GV2s3azaUobLVOgCZ7KHqgdi9DX0xYJ2KFdDBlLFWDA+ zDBqaB5118x75D/a8V8eIt0mXk6QPbcNThRcuAc0Ave4KIWmBpGfCs3rP l4t5ot4dl2UAsl3m8xqsjJY5/6qOiJOIjhxt7AtPaK7Ged3yCNTF0AFll UgH3l484mJssG1VYaqDKsawQx+qrzXCJyNbArah6k5di8ZJe129JQ6XXk nP33i473b+EiQyF2LpqVrQfUXWVmM0gJsi9x5mET81jTs+7obKajenakN HXMCniFxyNiMZSuRcyVUq3dRuikGay0r6z05zI0SIR1JrkasS35meKEeX w==; X-IronPort-AV: E=McAfee;i="6400,9594,10342"; a="249703596" X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="249703596" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2022 14:01:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="519410907" Received: from aalteres-desk.fm.intel.com ([10.80.57.53]) by orsmga003.jf.intel.com with ESMTP; 09 May 2022 14:01:45 -0700 From: Alan Previn To: intel-gfx@lists.freedesktop.org Date: Mon, 9 May 2022 14:01:48 -0700 Message-Id: <20220509210151.1843173-4-alan.previn.teres.alexis@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509210151.1843173-1-alan.previn.teres.alexis@intel.com> References: <20220509210151.1843173-1-alan.previn.teres.alexis@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [Intel-gfx 3/6] drm/i915/guc: Add a helper for log buffer size X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Add a helper to get GuC log buffer size. Signed-off-by: Alan Previn Reviewed-by: Ashutosh Dixit --- drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 49 ++++++++++++---------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c index d902b40ded0e..f454d53a8bca 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c @@ -15,6 +15,32 @@ static void guc_log_copy_debuglogs_for_relay(struct intel_guc_log *log); +static u32 intel_guc_log_size(struct intel_guc_log *log) +{ + /* + * GuC Log buffer Layout: + * + * NB: Ordering must follow "enum guc_log_buffer_type". + * + * +===============================+ 00B + * | Debug state header | + * +-------------------------------+ 32B + * | Crash dump state header | + * +-------------------------------+ 64B + * | Capture state header | + * +-------------------------------+ 96B + * | | + * +===============================+ PAGE_SIZE (4KB) + * | Debug logs | + * +===============================+ + DEBUG_SIZE + * | Crash Dump logs | + * +===============================+ + CRASH_SIZE + * | Capture logs | + * +===============================+ + CAPTURE_SIZE + */ + return PAGE_SIZE + CRASH_BUFFER_SIZE + DEBUG_BUFFER_SIZE + CAPTURE_BUFFER_SIZE; +} + /** * DOC: GuC firmware log * @@ -464,32 +490,11 @@ int intel_guc_log_create(struct intel_guc_log *log) GEM_BUG_ON(log->vma); - /* - * GuC Log buffer Layout - * (this ordering must follow "enum guc_log_buffer_type" definition) - * - * +===============================+ 00B - * | Debug state header | - * +-------------------------------+ 32B - * | Crash dump state header | - * +-------------------------------+ 64B - * | Capture state header | - * +-------------------------------+ 96B - * | | - * +===============================+ PAGE_SIZE (4KB) - * | Debug logs | - * +===============================+ + DEBUG_SIZE - * | Crash Dump logs | - * +===============================+ + CRASH_SIZE - * | Capture logs | - * +===============================+ + CAPTURE_SIZE - */ if (intel_guc_capture_output_min_size_est(guc) > CAPTURE_BUFFER_SIZE) DRM_WARN("GuC log buffer for state_capture maybe too small. %d < %d\n", CAPTURE_BUFFER_SIZE, intel_guc_capture_output_min_size_est(guc)); - guc_log_size = PAGE_SIZE + CRASH_BUFFER_SIZE + DEBUG_BUFFER_SIZE + - CAPTURE_BUFFER_SIZE; + guc_log_size = intel_guc_log_size(log); vma = intel_guc_allocate_vma(guc, guc_log_size); if (IS_ERR(vma)) { From patchwork Mon May 9 21:01:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Teres Alexis, Alan Previn" X-Patchwork-Id: 12844064 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0F53C433EF for ; Mon, 9 May 2022 21:01:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 08B2910F213; Mon, 9 May 2022 21:01:48 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC88710F1E8 for ; Mon, 9 May 2022 21:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652130106; x=1683666106; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=DSXv4TlS1/w3TOCdOPWdFKohSS5jC8rytmLvNgXjXC0=; b=LeXzjsvb+mJXT7UWIvs2YqsEUWUXGPLj9TdPGft2yIcaHSERDDriFUlH 0GzJujnGPv/pxZhrFhf3crB0iCNXacBS233XHYgxLEI/BpDebnHIgQVwO Kb8lmMdtrLNMQCBIVykDPXjwrrm7l+x6mchRtqX54TX+HzshyKb218Upe XZuYe62l4zh7/IyX+OnJYGOii0N5ipkQTgkoXfgZhGMVivYa+yrVaA5Gy L2GSHMUGcx2S7UjKBHCgYNlcKKzacYoPmEeeMJh7BICh+uRCYGWVnUVrV +5wqDiSy82fPkOYCGQH7mMzR97ZyGo5uB7dV5aUQO+ZX1keZQx0ob8pVX w==; X-IronPort-AV: E=McAfee;i="6400,9594,10342"; a="249703599" X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="249703599" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2022 14:01:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="519410909" Received: from aalteres-desk.fm.intel.com ([10.80.57.53]) by orsmga003.jf.intel.com with ESMTP; 09 May 2022 14:01:46 -0700 From: Alan Previn To: intel-gfx@lists.freedesktop.org Date: Mon, 9 May 2022 14:01:49 -0700 Message-Id: <20220509210151.1843173-5-alan.previn.teres.alexis@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509210151.1843173-1-alan.previn.teres.alexis@intel.com> References: <20220509210151.1843173-1-alan.previn.teres.alexis@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [Intel-gfx 4/6] drm/i915/guc: Provide debugfs for log relay sub-buf info X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" In order to provide alignment between IGT intel_guc_logger tool and i915 kernel's guc log relay channels without requiring updating both repositories everytime a sizing change is made, provide that info via debugfs files. Signed-off-by: Alan Previn --- drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 10 ++++- drivers/gpu/drm/i915/gt/uc/intel_guc_log.h | 2 + .../drm/i915/gt/uc/intel_guc_log_debugfs.c | 41 +++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c index f454d53a8bca..35709202b09c 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c @@ -15,7 +15,7 @@ static void guc_log_copy_debuglogs_for_relay(struct intel_guc_log *log); -static u32 intel_guc_log_size(struct intel_guc_log *log) +u32 intel_guc_log_size(struct intel_guc_log *log) { /* * GuC Log buffer Layout: @@ -41,6 +41,12 @@ static u32 intel_guc_log_size(struct intel_guc_log *log) return PAGE_SIZE + CRASH_BUFFER_SIZE + DEBUG_BUFFER_SIZE + CAPTURE_BUFFER_SIZE; } +#define GUC_LOG_RELAY_SUBBUF_COUNT 8 +u32 intel_guc_log_relay_subbuf_count(struct intel_guc_log *log) +{ + return GUC_LOG_RELAY_SUBBUF_COUNT; +} + /** * DOC: GuC firmware log * @@ -411,7 +417,7 @@ static int guc_log_relay_create(struct intel_guc_log *log) * latency, for consuming the logs from relay. Also doesn't take * up too much memory. */ - n_subbufs = 8; + n_subbufs = intel_guc_log_relay_subbuf_count(log); guc_log_relay_chan = relay_open("guc_log", dev_priv->drm.primary->debugfs_root, diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.h b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.h index 18007e639be9..9e55bd7d2051 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.h +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.h @@ -73,6 +73,8 @@ unsigned int intel_guc_get_log_buffer_size(enum guc_log_buffer_type type); size_t intel_guc_get_log_buffer_offset(enum guc_log_buffer_type type); int intel_guc_log_create(struct intel_guc_log *log); void intel_guc_log_destroy(struct intel_guc_log *log); +u32 intel_guc_log_size(struct intel_guc_log *log); +u32 intel_guc_log_relay_subbuf_count(struct intel_guc_log *log); int intel_guc_log_set_level(struct intel_guc_log *log, u32 level); bool intel_guc_log_relay_created(const struct intel_guc_log *log); diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c index ddfbe334689f..983afc89b17e 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c @@ -105,10 +105,49 @@ DEFINE_SIMPLE_ATTRIBUTE(guc_log_level_fops, guc_log_level_get, guc_log_level_set, "%lld\n"); +static int guc_log_relay_buf_size_get(void *data, u64 *val) +{ + struct intel_guc_log *log = data; + + if (!log) + return -ENODEV; + if (!log->vma) + return -ENODEV; + + *val = (u64)intel_guc_log_size(log); + + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(guc_log_relay_buf_size_fops, + guc_log_relay_buf_size_get, NULL, + "%lld\n"); + +static int guc_log_relay_subbuf_count_get(void *data, u64 *val) +{ + struct intel_guc_log *log = data; + + if (!log) + return -ENODEV; + if (!log->vma) + return -ENODEV; + + *val = intel_guc_log_relay_subbuf_count(log); + + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(guc_log_relay_subbuf_count_fops, + guc_log_relay_subbuf_count_get, NULL, + "%lld\n"); + static int guc_log_relay_open(struct inode *inode, struct file *file) { struct intel_guc_log *log = inode->i_private; + if (!log) + return -ENODEV; + if (!intel_guc_is_ready(log_to_guc(log))) return -ENODEV; @@ -166,6 +205,8 @@ void intel_guc_log_debugfs_register(struct intel_guc_log *log, { "guc_load_err_log_dump", &guc_load_err_log_dump_fops, NULL }, { "guc_log_level", &guc_log_level_fops, NULL }, { "guc_log_relay", &guc_log_relay_fops, NULL }, + { "guc_log_relay_buf_size", &guc_log_relay_buf_size_fops, NULL }, + { "guc_log_relay_subbuf_count", &guc_log_relay_subbuf_count_fops, NULL }, }; if (!intel_guc_is_supported(log_to_guc(log))) From patchwork Mon May 9 21:01:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Teres Alexis, Alan Previn" X-Patchwork-Id: 12844065 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA86FC433FE for ; Mon, 9 May 2022 21:01:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B1CE10F1E8; Mon, 9 May 2022 21:01:48 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id D759510F1E6 for ; Mon, 9 May 2022 21:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652130106; x=1683666106; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=dDrr5+x9niz0KWg1/5Ev6pFrGYsz0CK+D+s+cM8PSQQ=; b=ZH5MqCPX37kt1ONAtwvlphy/syFsFaTMRS0wXOqyk8pemj+SOt6RIqEa PqPwbVI2hQYYRF6OgXv+g+Ij4oBH8Cweq/2hX3UZTlmoF2I8UX83mNb9L qkmmpwnzy/JclvT5RW6t0Wmh5aWDs1K7n3laO1vhk//sf3hrkqCStRo4n CqjZaNp3pZmONGBWuTK6Vgbs0tfEg/bHmd2SprPTvtT2u793SDpVpj9sQ jMmma5fjAqaddXD71XbymsPxBDGjKKDmxY9WzqF6qLJu58EtEvCeBpCgn EjLWVh/NaXaWKtHPnN2YJ95aaHpkBEUNbqLz6wQEJDRxp4YE4isbQhXzx Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10342"; a="249703600" X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="249703600" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2022 14:01:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="519410910" Received: from aalteres-desk.fm.intel.com ([10.80.57.53]) by orsmga003.jf.intel.com with ESMTP; 09 May 2022 14:01:46 -0700 From: Alan Previn To: intel-gfx@lists.freedesktop.org Date: Mon, 9 May 2022 14:01:50 -0700 Message-Id: <20220509210151.1843173-6-alan.previn.teres.alexis@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509210151.1843173-1-alan.previn.teres.alexis@intel.com> References: <20220509210151.1843173-1-alan.previn.teres.alexis@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [Intel-gfx 5/6] drm/i915/guc: Rename GuC log relay debugfs descriptively X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" GuC log relay debugfs name for the control handle vs the actual relay channel are vague. Fix them so it's obvious from the name. Signed-off-by: Alan Previn --- drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 2 +- .../drm/i915/gt/uc/intel_guc_log_debugfs.c | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c index 35709202b09c..793a06a16874 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c @@ -419,7 +419,7 @@ static int guc_log_relay_create(struct intel_guc_log *log) */ n_subbufs = intel_guc_log_relay_subbuf_count(log); - guc_log_relay_chan = relay_open("guc_log", + guc_log_relay_chan = relay_open("guc_log_relay_chan", dev_priv->drm.primary->debugfs_root, subbuf_size, n_subbufs, &relay_callbacks, dev_priv); diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c index 983afc89b17e..6c5e900c4906 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log_debugfs.c @@ -141,7 +141,7 @@ DEFINE_SIMPLE_ATTRIBUTE(guc_log_relay_subbuf_count_fops, guc_log_relay_subbuf_count_get, NULL, "%lld\n"); -static int guc_log_relay_open(struct inode *inode, struct file *file) +static int guc_log_relay_ctl_open(struct inode *inode, struct file *file) { struct intel_guc_log *log = inode->i_private; @@ -157,10 +157,10 @@ static int guc_log_relay_open(struct inode *inode, struct file *file) } static ssize_t -guc_log_relay_write(struct file *filp, - const char __user *ubuf, - size_t cnt, - loff_t *ppos) +guc_log_relay_ctl_write(struct file *filp, + const char __user *ubuf, + size_t cnt, + loff_t *ppos) { struct intel_guc_log *log = filp->private_data; int val; @@ -182,7 +182,7 @@ guc_log_relay_write(struct file *filp, return ret ?: cnt; } -static int guc_log_relay_release(struct inode *inode, struct file *file) +static int guc_log_relay_ctl_release(struct inode *inode, struct file *file) { struct intel_guc_log *log = inode->i_private; @@ -190,11 +190,11 @@ static int guc_log_relay_release(struct inode *inode, struct file *file) return 0; } -static const struct file_operations guc_log_relay_fops = { +static const struct file_operations guc_log_relay_ctl_fops = { .owner = THIS_MODULE, - .open = guc_log_relay_open, - .write = guc_log_relay_write, - .release = guc_log_relay_release, + .open = guc_log_relay_ctl_open, + .write = guc_log_relay_ctl_write, + .release = guc_log_relay_ctl_release, }; void intel_guc_log_debugfs_register(struct intel_guc_log *log, @@ -204,7 +204,7 @@ void intel_guc_log_debugfs_register(struct intel_guc_log *log, { "guc_log_dump", &guc_log_dump_fops, NULL }, { "guc_load_err_log_dump", &guc_load_err_log_dump_fops, NULL }, { "guc_log_level", &guc_log_level_fops, NULL }, - { "guc_log_relay", &guc_log_relay_fops, NULL }, + { "guc_log_relay_ctl", &guc_log_relay_ctl_fops, NULL }, { "guc_log_relay_buf_size", &guc_log_relay_buf_size_fops, NULL }, { "guc_log_relay_subbuf_count", &guc_log_relay_subbuf_count_fops, NULL }, }; From patchwork Mon May 9 21:01:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Teres Alexis, Alan Previn" X-Patchwork-Id: 12844066 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 857F0C433EF for ; Mon, 9 May 2022 21:01:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BCB2510F216; Mon, 9 May 2022 21:01:55 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 090A010F1E8 for ; Mon, 9 May 2022 21:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652130107; x=1683666107; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=oXqVSDFtTFpVi3nh+tT1OXOPyGtiL/IQ59QXqyuPKq4=; b=aWH9VUB4FDy0MRHtXosOYXa9m+H5IoALj/LD6eyGIeA8nj4JNACoLKo8 6eLy2EP+U9PmKLDJnOxZOgOohPNsPXkQnk5bv6pP1p4fmZ+o1iwBfsdkl QNNFIZGvSJ9a0KoQb6a/HoNGflZqOQicCzGqrOFCqMFpMABwqgjEVcgf+ Jmvm+hWgqz3qXeEqqqGC9KrKUVlYa/TnaU8T2QthKln0qnZ4kTistcUg0 7mrHVC3HI0Ot4ersaIYEaVO6Uoys8bTDTnHqxwyG0LuLBMXRlq6ep7SJQ hqd2Cnzyco8zPsfba+U70NJVrlkz3eQgZfGUoOObknavKpCILzi6AbwPZ Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10342"; a="249703601" X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="249703601" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2022 14:01:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,212,1647327600"; d="scan'208";a="519410913" Received: from aalteres-desk.fm.intel.com ([10.80.57.53]) by orsmga003.jf.intel.com with ESMTP; 09 May 2022 14:01:46 -0700 From: Alan Previn To: intel-gfx@lists.freedesktop.org Date: Mon, 9 May 2022 14:01:51 -0700 Message-Id: <20220509210151.1843173-7-alan.previn.teres.alexis@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509210151.1843173-1-alan.previn.teres.alexis@intel.com> References: <20220509210151.1843173-1-alan.previn.teres.alexis@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [Intel-gfx 6/6] drm/i915/guc: Move guc_log_relay_chan debugfs path to uc X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" All other GuC Relay Logging debugfs handles including recent additions are under the 'i915/gt/uc/path' so let's also move 'guc_log_relay_chan' to its proper home. Signed-off-by: Alan Previn --- drivers/gpu/drm/i915/gt/uc/intel_guc.h | 2 ++ drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 5 ++++- drivers/gpu/drm/i915/gt/uc/intel_uc_debugfs.c | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.h b/drivers/gpu/drm/i915/gt/uc/intel_guc.h index 3f3373f68123..72deac11df8a 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc.h +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.h @@ -41,6 +41,8 @@ struct intel_guc { struct intel_guc_slpc slpc; /** @capture: the error-state-capture module's data and objects */ struct intel_guc_state_capture *capture; + /** @dbgfs_node: the debugfs path for guc file handles */ + struct dentry *dbgfs_node; /** @sched_engine: Global engine used to submit requests to GuC */ struct i915_sched_engine *sched_engine; diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c index 793a06a16874..f6578565fed6 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c @@ -419,8 +419,11 @@ static int guc_log_relay_create(struct intel_guc_log *log) */ n_subbufs = intel_guc_log_relay_subbuf_count(log); + if (!guc->dbgfs_node) + return -ENOENT; + guc_log_relay_chan = relay_open("guc_log_relay_chan", - dev_priv->drm.primary->debugfs_root, + guc->dbgfs_node, subbuf_size, n_subbufs, &relay_callbacks, dev_priv); if (!guc_log_relay_chan) { diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_debugfs.c b/drivers/gpu/drm/i915/gt/uc/intel_uc_debugfs.c index 284d6fbc2d08..2f93cc4e408a 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_debugfs.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_debugfs.c @@ -54,6 +54,8 @@ void intel_uc_debugfs_register(struct intel_uc *uc, struct dentry *gt_root) if (IS_ERR(root)) return; + uc->guc.dbgfs_node = root; + intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), uc); intel_guc_debugfs_register(&uc->guc, root);