From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 69EB610E1BF for ; Mon, 7 Aug 2023 03:56:27 +0000 (UTC) From: janga.rahul.kumar@intel.com To: igt-dev@lists.freedesktop.org, ramadevi.gandi@intel.com, janga.rahul.kumar@intel.com Date: Mon, 7 Aug 2023 09:28:05 +0530 Message-Id: <20230807035805.1054349-4-janga.rahul.kumar@intel.com> In-Reply-To: <20230807035805.1054349-1-janga.rahul.kumar@intel.com> References: <20230807035805.1054349-1-janga.rahul.kumar@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH i-g-t 3/3] lib/igt_gt: Extend hang library support to XE List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sai.gowtham.ch@intel.com, kunal1.joshi@intel.com Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: From: Janga Rahul Kumar Extend hang library support to XE driver and update the documentation. Cc: Sai Gowtham Ch Cc: Kunal Joshi Cc: Kamil Konieczny Cc: Anna Karas Signed-off-by: Janga Rahul Kumar Tested-by: Kunal Joshi --- lib/igt_gt.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/igt_gt.c b/lib/igt_gt.c index d4a825e66..245984f7f 100644 --- a/lib/igt_gt.c +++ b/lib/igt_gt.c @@ -44,6 +44,7 @@ #include "intel_reg.h" #include "intel_chipset.h" #include "igt_dummyload.h" +#include "xe/xe_gt.h" /** * SECTION:igt_gt @@ -179,6 +180,12 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags) */ if (!igt_check_boolean_env_var("IGT_HANG", true)) igt_skip("hang injection disabled by user [IGT_HANG=0]\n"); + + if (is_xe_device(fd)) { + igt_require(has_gpu_reset(fd)); + return (struct igt_hang){ 0, ctx, 0, flags }; + } + gem_context_require_bannable(fd); if (flags & HANG_WANT_ENGINE_RESET) @@ -215,6 +222,9 @@ igt_hang_t igt_allow_hang(int fd, unsigned ctx, unsigned flags) void igt_disallow_hang(int fd, igt_hang_t arg) { + if (is_xe_device(fd)) + return; + context_set_ban(fd, arg.ctx, arg.ban); if ((arg.flags & HANG_ALLOW_CAPTURE) == 0) { @@ -269,8 +279,8 @@ static bool has_ctx_exec(int fd, unsigned ring, uint32_t ctx) /** * igt_hang_ring_ctx: - * @fd: open i915 drm file descriptor - * @ctx: the contxt specifier + * @fd: open i915/xe drm file descriptor + * @ctx: the context specifier * @ring: execbuf ring flag * @flags: set of flags to control execution * @offset: The resultant gtt offset of the exec obj @@ -290,6 +300,9 @@ static igt_hang_t __igt_hang_ctx(int fd, uint64_t ahnd, uint32_t ctx, int ring, igt_spin_t *spin; unsigned ban; + if (is_xe_device(fd)) + return xe_hang_ring(fd, ahnd, ctx, ring, flags); + igt_require_hang_ring(fd, ctx, ring); /* check if non-default ctx submission is allowed */ @@ -334,7 +347,7 @@ igt_hang_t igt_hang_ctx_with_ahnd(int fd, uint64_t ahnd, uint32_t ctx, int ring, /** * igt_hang_ring: - * @fd: open i915 drm file descriptor + * @fd: open i915/xe drm file descriptor * @ring: execbuf ring flag * * This helper function injects a hanging batch into @ring. It returns a @@ -357,7 +370,7 @@ igt_hang_t igt_hang_ring_with_ahnd(int fd, int ring, uint64_t ahnd) /** * igt_post_hang_ring: - * @fd: open i915 drm file descriptor + * @fd: open i915/xe drm file descriptor * @arg: hang state from igt_hang_ring() * * This function does the necessary post-processing after a gpu hang injected @@ -368,6 +381,11 @@ void igt_post_hang_ring(int fd, igt_hang_t arg) if (!arg.spin) return; + if (is_xe_device(fd)) { + igt_spin_free(fd, arg.spin); + xe_post_hang_ring(fd, arg); + } + gem_sync(fd, arg.spin->handle); /* Wait until it hangs */ igt_spin_free(fd, arg.spin); -- 2.25.1