From mboxrd@z Thu Jan 1 00:00:00 1970 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 BAA0EC61DD3 for ; Tue, 1 Sep 2026 09:45:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E84510EC48; Tue, 1 Sep 2026 09:45:17 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="lura/KNf"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id D63D310E3C6 for ; Tue, 1 Sep 2026 09:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1788255876; x=1819791876; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=Gm02sB2visJDVcsoiGiECpir5N+6ZVirU2dhntImACM=; b=lura/KNfzKJviMMzLJlrqMiXQacWIzcrYUfrNQmOGnz9sxJJp41R+aSx 1tcd3W2gzTWMXMWvxAei9dWhPCgdouaIdK0YxkrLHsSiXbPrk6H+uPmap pocIAvl4EkNbSUQRS3HpTvz1kgqGeKopgLTLwovwBlMSm3LRu1mCen861 rDURUIoc2Ao416TWGa5senQX4Jtdhx5lTdA7Mfpe32OjfBhaD6pw5QUS6 TdN1LLea0jCNMS/o48RIM32wPzRzoCfsc1/pUy8lmeOPAFsvnw+O3u5v4 IoWTnPVATV4gKJqigwv3JHWfaRVIJ6YlrHxJXyuR09Gs1JfVsW2XyNN2n Q==; X-CSE-ConnectionGUID: lkuyLkrtTNy2V0Ytyoirnw== X-CSE-MsgGUID: G82SbPf1TceV0XamTeHXnA== X-IronPort-AV: E=McAfee;i="6800,10657,11892"; a="99840014" X-IronPort-AV: E=Sophos;i="6.25,255,1779174000"; d="scan'208";a="99840014" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2026 02:44:36 -0700 X-CSE-ConnectionGUID: DPDRO19aS/OruLTPabIQDA== X-CSE-MsgGUID: taVSnfH5SuOJDIn4Ic8LAg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,255,1779174000"; d="scan'208";a="270992372" Received: from orsmsx902.amr.corp.intel.com ([10.22.229.24]) by fmviesa004.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2026 02:44:35 -0700 Received: from ORSMSX901.amr.corp.intel.com (10.22.229.23) by ORSMSX902.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.46; Tue, 1 Sep 2026 02:44:34 -0700 Received: from ORSEDG901.ED.cps.intel.com (10.7.248.11) by ORSMSX901.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.46 via Frontend Transport; Tue, 1 Sep 2026 02:44:34 -0700 Received: from CH5PR02CU005.outbound.protection.outlook.com (40.107.200.37) by edgegateway.intel.com (134.134.137.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.46; Tue, 1 Sep 2026 02:44:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mtSNoUxGDA29gVKCjxPyqpt2uLaYKOHn8QLUVx+TB3p60JtGyjEFXAlqwSYpVHbDze/GVWatwkCmXmGQNpKkRqIchyLK/rpFCPH0vYewmJiaPQyY3vhgB76WhZ2vf8FODIk+Z3MEywBgkBzvtMlqsZUuMmOVPiH/4A1Q3CueJ22QDrUmvq92Au15fZ9LU3QfWZg4YutCvgP30heSOuxVGJ+4vOyypZfaWE8PkfnnhAmRBVySi0HbVOJ9dwG8E9ro985SR3+8BVLX0uxu0cBSMXj7octNknnjPnQQev+lXyuSWGIhI0txP3boVOqMoXPxnaoAcM+0MOPlRXKe94WDFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VytnSaoQMgYDT4nP0PeZt0q1dKb859OyQ4CdUXAhY9w=; b=jWRXUBOEmIvUohzRetwdvan8sEIldjbWAIDXWGMDPeWlHxJeezEcMhIRwGQhBoIUMNpW9QSrV3fshYon1PFZlv4CZTxRh4mIIjxJ4WHfUQDYeD5VoOGEPRq8lZuD6up/NGM8T+r4iHEGENVdmUSMC7ix4WiQqc0KTWbL9SxwDPWGJZekNxrEUZLn4WKApQeHAYoq7hzfWz1tpgMNnTD115aj7grqpt+2y+z1hSXLf/DpS8z4+/8py2zT9A4ej0R8OWfJrAoQdoEMzDAscr6hSsEUH1fbho9yu+CO+ZPeWOhSezcz0drNEPP6GGW+45iXS7v/3CrrKmeWsTOdAQvXBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7651.namprd11.prod.outlook.com (2603:10b6:8:149::8) by PH0PR11MB9703.namprd11.prod.outlook.com (2603:10b6:510:399::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.13; Tue, 1 Sep 2026 09:44:32 +0000 Received: from DS0PR11MB7651.namprd11.prod.outlook.com ([fe80::901e:b308:292b:1b2f]) by DS0PR11MB7651.namprd11.prod.outlook.com ([fe80::901e:b308:292b:1b2f%4]) with mapi id 15.21.0382.007; Tue, 1 Sep 2026 09:44:32 +0000 Message-ID: <538ef2f5-117a-40fa-973d-7309950f3a7f@intel.com> Date: Tue, 1 Sep 2026 15:14:24 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 07/10] tests/intel/xe_err_injection: Add GT UC Unicast GAM Walker Command Parity Error Injection To: "Purkait, Soham" , CC: , , , References: <20260824164133.129138-1-ravi.kishore.koppuravuri@intel.com> <20260824164133.129138-8-ravi.kishore.koppuravuri@intel.com> <8ac9fdd8-4bdf-446a-8ca4-f66bec6a6f7c@intel.com> Content-Language: en-US From: "Koppuravuri, Ravi Kishore" In-Reply-To: <8ac9fdd8-4bdf-446a-8ca4-f66bec6a6f7c@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MA0PR01CA0114.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:11d::12) To DS0PR11MB7651.namprd11.prod.outlook.com (2603:10b6:8:149::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7651:EE_|PH0PR11MB9703:EE_ X-MS-Office365-Filtering-Correlation-Id: d6f97e90-6af7-4d5d-f728-08df080da036 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|23010399003|376014|22082099003|18002099003|56012099006|4143699003|6133799003|10067099003|11063799006; X-Microsoft-Antispam-Message-Info: Ei5wzrI2dozNO4K1xVFy6YmNZkckknP7uR/38WKY+ju9YuMd58by4OFdg4qhkwaQSOAyjHKrnsHTXdpF9AxorVpGlGhpweFl48pbZkfG4EGLa+x/TKLJ2vVIUcqV+bDIyANZYNPKxftt81Qyg7ofhpyqXCt4WOO/mHQn7HcA9L5WO0f2MD1m0SgxmMRuYlL9Gm1zaF9hSPua7Yjiu+BvNa0rmjVqoG6yUiUdqpdQ9PlMsUTPhyRDzHi8Ari30Y3ewys0sWMFfHXlqQS3Hxgv30C5m0AW4trYvK7HywQr5CXHU9LgL/CIuC4oMIL+hYdG48zQAIqWs5qgKZI4/uW6tenWnkz8ob/x4eFDYJ2nOu88SGCIqtHa0MNMAZVnl/jDPQbIJMIxGI/ndHEFNnMAiuz5bFzekLGyuC79JDH3r7MECH0dh4iXusfJiTl9gTrYnPWlAfqlSVTwVBlhL5WkiHLRM5OfggNINbogAHrKVVAgKPRyQzUdJ8ETp15rVtTX00Oa3yG55bPPDeVo+N5eMF+a0vv6ivvS1fia57twIu3zdvvKYbxsvhyRBQr+sic0b7fbU/Xj52zdCkNVAdSQAyDSpBUYJE/YWcjgrL/f9qCRb6MiTSpu4RlIaLLw8S7P3M1fnZRhhAcJzRKf0d4l1aZWZSzmCon7WcG5qI/BiVs= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7651.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(23010399003)(376014)(22082099003)(18002099003)(56012099006)(4143699003)(6133799003)(10067099003)(11063799006); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N2pLNlJZRVl1Vjh2cmg4Yk9xK2JETHhEL0VYc1FqMUZ4RDZhQVhIdjhjR3dz?= =?utf-8?B?TWxOV2FLN2xWSXJ0d3VxU3BzZ3dHeVZ3SXNXMEQvZGg1R1N6QkZGak1zNFVh?= =?utf-8?B?VTZ2NG5GQlN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8?B?dXlUeUVPUkNhNUFFbVNUaTVua21uQ2c5WkNYdXhwVW1XVllVeVZOUjcxZzN1?= =?utf-8?B?RTlpV3VsTWo0MDBiRDM1V0V4SU92QWsvZDdKSUtNczk0aEpWYnZwMjBmTDJ4?= =?utf-8?B?RGZZekNGWUJLQzhTcC9aRWQ3L0ZtakYxcVBLdlpiMVMrR25pQzVoTFJaMHQz?= =?utf-8?B?d2pKWktqOXYrK2thRXMzUldBejBvYjlxYVdnM3hXdWpHcmdJU1hIOHNMbjFo?= =?utf-8?B?RTN0eUxaZUVUbkFlQVhaNjA2ZWFZczFoRjcwK0JOc1cvMlJQY25Ld0Vjbi96?= =?utf-8?B?UW1WSU5uT2I2cUYyaEpxbG12MGdTa1Fzb1VCTVIyWTVWT0srTEx2ekdNVE1t?= =?utf-8?B?RWVqNlY3YnFHMDdpQ1RlVWFwVlpwbUJUTVZtc29Ma25SR0I3dVJKK21pM202?= =?utf-8?Q?WanDVVJwQVrLWijKXBOv6Q7AKrFwqTR49g5VL?= X-Exchange-RoutingPolicyChecked: h3FD69htmUQZXQ2YdDLYN/PPlGegYKbSy32pQwhosgdAWmFhtTn5SS45xLrxSZJq/+Q3zhL2kE8l9kyWYVwneM56huz2T+uJ5QhVBE51yXmwKbhHAz6hkW1Qw4WJ+2nuW3rIpO52a3zj3S4QXy6znDkWp38Vh8xRG10K7Xju2PVu3XRcjeUSStXrA06DffkwBTmHa6m17OtpiWT0e7aR5WcjjhhBNP7JMWLoTCwIxuyE9d7y593IY1tXcKfm6+mdtbDwbOxN324vhFvERkm6vsrTDvEUipJpYVJGMBZG44WugspL+22F/JnMhnYJgkju+3jLa2IjJAf2hTmNYnhiOw== X-MS-Exchange-CrossTenant-Network-Message-Id: d6f97e90-6af7-4d5d-f728-08df080da036 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7651.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2026 09:44:32.6740 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JHl5NA1UQuJQZwULzjXiZcjokzyhAqyBvInsQPBNHRzT7xt9H9Ab6GLVkMy3373tGRKkqx0zEvR3WY6JGKW4R1YV+nhwyPwc9/ztH9t1vcsSMVc33y/jpuUN8v1YXhdS X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB9703 X-OriginatorOrg: intel.com X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" On 26-08-2026 14:48, Purkait, Soham wrote: > > On 24-08-2026 22:11, Ravi Kishore Koppuravuri wrote: >> MMIO based GT Uncorrectable Unicast GAM Walker command parity error >> injection to verify the Xe driver error handling and recovery flows with >> the help of DRM Netlink API suite >> >> Signed-off-by: Ravi Kishore Koppuravuri >> >> --- >>   tests/intel/xe_err_injection.c | 321 +++++++++++++++++++++++++++++++++ >>   tests/intel/xe_err_injection.h |  18 ++ >>   tests/meson.build              |   1 + >>   3 files changed, 340 insertions(+) >>   create mode 100644 tests/intel/xe_err_injection.c >>   create mode 100644 tests/intel/xe_err_injection.h >> >> diff --git a/tests/intel/xe_err_injection.c >> b/tests/intel/xe_err_injection.c >> new file mode 100644 >> index 000000000..ded5f558f >> --- /dev/null >> +++ b/tests/intel/xe_err_injection.c >> @@ -0,0 +1,321 @@ >> +// SPDX-License-Identifier: MIT >> +/* >> + * Copyright © 2026 Intel Corporation >> + */ >> + >> +/** >> + * TEST: MMIO based Error Injection >> + * Category: RAS >> + * Mega feature: Telemetry >> + * Sub-category: Driver >> + * Test category: Error Injection >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#include "igt.h" >> +#include "lib/igt_drm_netlink.h" >> +#include "lib/intel_reg.h" >> +#include "lib/intel_compute.h" >> + >> +#include "xe_drm.h" >> +#include "xe/xe_ioctl.h" >> +#include "xe/xe_mmio.h" >> +#include "xe/xe_query.h" >> +#include "xe_err_injection.h" >> + >> +enum { >> +    RECOVERY_SUCCESS = 1, >> +    RECOVERY_FAILED, >> +    RECOVERY_TIMEOUT, >> +}; >> + >> +static void run_xe_compute_on_all_engines(int fd, bool state) >> +{ >> +    struct drm_xe_engine_class_instance *hwe; >> + >> +    if (state == POST_ARMING_INJECTION_WL) >> +        igt_info("Running compute-square on all engines post >> injection\n"); >> +    else if (state == POST_RECOVERY_WL) >> +        igt_info("Running compute-square on all engines post >> recovery\n"); >> + >> +    xe_for_each_engine(fd, hwe) { >> +        if (hwe->engine_class != DRM_XE_ENGINE_CLASS_COMPUTE) >> +            continue; >> + >> +        igt_require_f(xe_run_intel_compute_kernel_on_engine(fd, hwe, >> NULL, >> +                                    EXECENV_PREF_SYSTEM), >> +                                    "GPU does not support " >> +                                    "compute on engine\n"); >> +    } >> +} >> + >> +static void write_reg(struct xe_mmio *mmio, uint32_t reg, uint32_t >> value) >> +{ >> +    xe_mmio_write32(mmio, reg, value); >> +} >> + >> +static void modify_reg_bit(struct xe_mmio *mmio, uint32_t reg_addr, >> +               uint32_t bit_mask, bool set) >> +{ >> +    uint32_t regval; >> + >> +    regval = xe_mmio_read32(mmio, reg_addr); >> +    if (set) >> +        regval |= bit_mask; >> +    else >> +        regval &= ~bit_mask; >> + >> +    xe_mmio_write32(mmio, reg_addr, regval); >> +} >> + >> +static int acquire_forcewake(int fd) >> +{ >> +    int fw_handle; >> + >> +    fw_handle = igt_debugfs_open(fd, "forcewake_all", O_RDONLY); >> +    igt_assert_lte(0, fw_handle); >> +    return fw_handle; >> +} >> + >> +static void release_forcewake(int fw_handle) >> +{ >> +    if (fw_handle >= 0) >> +        close(fw_handle); >> +} >> + >> +static uint32_t get_counter(uint32_t node_id, uint32_t error_id) >> +{ >> +    struct app_context ctx; >> +    int ret; >> +    uint32_t error_value = UINT32_MAX; >> + >> +    ret = igt_init_nl_socket(&ctx); >> +    if (ret < 0) { >> +        igt_warn("Failed to initialize netlink socket for error >> command (ret=%d)\n", ret); >> +        return error_value; >> +    } >> + >> +    ctx.node_id = node_id; >> +    ctx.error_id = error_id; >> + >> +    ret = igt_get_error_counter(&ctx); >> +    if (ret < 0) { >> +        igt_warn("get_error_counter failed from error command path >> (ret=%d)\n", ret); >> +    } else { >> +        error_value = ctx.error_value; >> +        igt_info("get_error_counter: node_id=%u error_id=%u >> value=%u\n", >> +             ctx.node_id, ctx.error_id, ctx.error_value); >> +    } >> + >> +    igt_cleanup_nl_socket(&ctx); >> + >> +    return error_value; >> +} >> + >> +static int check_dmesg_for_recovery(const char *marker, int >> elapsed_secs) >> +{ >> +    char *buff = NULL; >> +    size_t buff_size = 0; >> +    ssize_t line_len; >> +    FILE *fp; >> +    const char *success = "AER: device recovery successful"; >> +    const char *failed = "AER: device recovery failed"; >> +    bool marker_seen = false; >> + >> +    fp = popen("dmesg", "r"); >> +    if (!fp) { >> +        igt_warn("Unable to open dmesg to check recovery status\n"); >> +        return -1; >> +    } >> + >> +    while ((line_len = getline(&buff, &buff_size, fp)) != -1) { >> +        (void)line_len; >> +        if (!marker_seen) { >> +            if (strstr(buff, marker)) >> +                marker_seen = true; >> +            continue; >> +        } >> + >> +        if (strstr(buff, success)) { >> +            igt_info("Found \"%s\" in dmesg after %d secs\n", >> success, elapsed_secs); >> +            free(buff); >> +            pclose(fp); >> +            return RECOVERY_SUCCESS; >> +        } >> +        if (strstr(buff, failed)) { >> +            igt_info("Found \"%s\" in dmesg after %d secs\n", >> failed, elapsed_secs); >> +            free(buff); >> +            pclose(fp); >> +            return RECOVERY_FAILED; >> +        } >> +    } >> + >> +    free(buff); >> +    pclose(fp); >> +    return RECOVERY_TIMEOUT; >> +} >> + >> +static int check_err_recovery(void) >> +{ >> +    time_t start_time = time(NULL); >> +    time_t timeout = 5 * 60; >> +    int time_interval = 30; >> +    time_t elapsed_time; >> +    int status; >> +    char marker[128]; >> + >> +    snprintf(marker, sizeof(marker), >> +         "IGT xe_err_injection recovery marker pid=%d start=%lld", >> +         getpid(), (long long)start_time); >> +    igt_kmsg(KMSG_INFO "%s\n", marker); >> + >> +    while (1) { >> +        elapsed_time = time(NULL) - start_time; >> +        status = check_dmesg_for_recovery(marker, elapsed_time); >> +        if (status < 0) { >> +            igt_warn("Failed to query dmesg for recovery status\n"); >> +            return RECOVERY_FAILED; >> +        } >> +        if (status == RECOVERY_SUCCESS || status == RECOVERY_FAILED) >> +            return status; >> + >> +        if (elapsed_time >= timeout) { >> +            igt_warn("Timed out while waiting for error recovery\n"); >> +            return RECOVERY_TIMEOUT; >> +        } >> + >> +        sleep(time_interval); >> +    } >> +} >> + >> +static void print_aer_recovery_status(void) >> +{ >> +    int recovery_ret; >> + >> +    recovery_ret = check_err_recovery(); >> +    igt_assert_f(recovery_ret != RECOVERY_TIMEOUT, >> +             "AER error recovery timed out\n"); >> +    igt_assert_f(recovery_ret != RECOVERY_FAILED, >> +             "AER device recovery failed\n"); >> +    if (recovery_ret == RECOVERY_SUCCESS) >> +        igt_info("AER device recovery successful\n"); >> +} >> + >> +static void log_status(bool val, const char *err_name) >> +{ >> +    if (val) >> +        igt_info("Injection: %s Success\n", err_name); >> +    else >> +        igt_info("Injection: %s Failed\n", err_name); >> +} >> + >> +static bool gt_uc_wkr_parity_recovered; >> + >> +/** >> + * SUBTEST: test_GT-UC-unicast-wkr-cmd-parity-err >> + * Description: GT Uncorrectable Unicast Walker Command parity error >> injection >> + * Functionality: error injection >> + */ >> +static void wkr_cmd_parity_err_injection(struct xe_mmio *mmio, int fd) >> +{ >> +    int fw_handle; >> +    uint32_t error_counter_before_inj; >> +    uint32_t error_counter_after_inj; >> +    /** TODO >> +     *  Fetching node_id and error_id dynamically is pending to >> implement. >> +     *  For now, using >> +     *  node_id=1 (uncorrectable_errors) and >> +     *  error_id=1 (core_compute) >> +     */ >> +    uint32_t node_id = 1; >> +    uint32_t error_id = 1; >> + >> +    fw_handle = acquire_forcewake(fd); >> + >> +    error_counter_before_inj = get_counter(node_id, error_id); >> + >> +    /* Arm the injection sequence. */ >> +    write_reg(mmio, MC_PKT_CTRL_MGSR_3D_ADDRESS, 0x0); >> +    modify_reg_bit(mmio, >> +               WKR_FABRIC_ERR_INJ_GAMWALK_3D_ADDRESS, >> +               WKR_FABRIC_ERR_INJ_GAMWALK_3D_VALUE, >> +               true); >> +    modify_reg_bit(mmio, >> +               MC_PKT_CTRL_MGSR_3D_ADDRESS, >> +               MC_PKT_CTRL_MGSR_3D_VALUE, >> +               true); > > Is steering semaphore needed to be acquired before these operations? I will add it in the next revision. Thanks > > Thanks, > Soham > >> +    igt_info("Injected GT Uncorrectable Unicast Walker Cmd parity >> error\n"); >> + >> +    run_xe_compute_on_all_engines(fd, POST_ARMING_INJECTION_WL); >> + >> +    release_forcewake(fw_handle); >> +    print_aer_recovery_status(); >> +    error_counter_after_inj = get_counter(node_id, error_id); >> + >> +    igt_assert_f(error_counter_before_inj != UINT32_MAX && >> +             error_counter_after_inj != UINT32_MAX, >> +             "Failed to fetch valid error counters: before=%u >> after=%u\n", >> +             error_counter_before_inj, error_counter_after_inj); >> + >> +    igt_info("error counter: before injection=%u after injection=%u\n", >> +         error_counter_before_inj, error_counter_after_inj); >> + >> +    igt_assert_f(error_counter_after_inj > error_counter_before_inj, >> +             "GT Uncorrectable Unicast Walker Cmd parity error >> injection " >> +             "failed: before injection=%u after injection=%u\n", >> +             error_counter_before_inj, error_counter_after_inj); >> +    igt_info("GT Uncorrectable Unicast Walker Cmd parity error >> injection successful\n"); >> +    gt_uc_wkr_parity_recovered = true; >> +} >> + >> +static void inject_error(const char *injection, struct xe_mmio >> *mmio, int fd) >> +{ >> +    igt_info("Starting Error Injection test: %s\n", injection); >> +    if (strcmp(injection, "test_GT-UC-unicast-wkr-cmd-parity-err") >> == 0) >> +        wkr_cmd_parity_err_injection(mmio, fd); >> +    else if (strcmp(injection, >> "test_GT-UC-unicast-wkr-cmd-parity-err-post-recovery-wl") == 0) >> +        run_xe_compute_on_all_engines(fd, POST_RECOVERY_WL); >> +    else >> +        igt_info("Invalid Error Injection specified\n"); >> +} >> + >> +/** >> + * SUBTEST: test_GT-UC-unicast-wkr-cmd-parity-err-post-recovery-wl >> + * Description: Run a post-recovery Xe workload after parity error >> injection. >> + * Functionality: workload validation >> + */ >> + >> +int igt_main() >> +{ >> +    int fd; >> +    struct xe_mmio mmio; >> + >> +    igt_fixture() { >> +        fd = drm_open_driver(DRIVER_XE); >> +        igt_require(igt_debugfs_exists(fd, "forcewake_all", O_RDONLY)); >> +        xe_mmio_access_init(fd, &mmio); >> +        igt_require(xe_mmio_is_initialized(&mmio)); >> +    } >> + >> +    igt_describe("Inject GT uncorrectable unicast worker command >> parity error."); >> +    igt_subtest("test_GT-UC-unicast-wkr-cmd-parity-err") >> +        inject_error("test_GT-UC-unicast-wkr-cmd-parity-err", &mmio, >> fd); >> + >> +    igt_describe("Run post-recovery workload after GT parity error >> injection test."); >> + >> igt_subtest("test_GT-UC-unicast-wkr-cmd-parity-err-post-recovery-wl") { >> +        igt_require_f(gt_uc_wkr_parity_recovered, >> +                  "Run GT-UC-unicast-wkr-cmd-parity-err first\n"); >> + >> inject_error("test_GT-UC-unicast-wkr-cmd-parity-err-post-recovery-wl", >> &mmio, fd); >> +    } >> + >> +    igt_fixture() { >> +        xe_mmio_access_fini(&mmio); >> +        drm_close_driver(fd); >> +    } >> +} >> diff --git a/tests/intel/xe_err_injection.h >> b/tests/intel/xe_err_injection.h >> new file mode 100644 >> index 000000000..d7efc2fd2 >> --- /dev/null >> +++ b/tests/intel/xe_err_injection.h >> @@ -0,0 +1,18 @@ >> +/* SPDX-License-Identifier: MIT */ >> +/* >> + * Copyright © 2026 Intel Corporation >> + */ >> + >> +#ifndef XE_ERR_INJECTION_H >> +#define XE_ERR_INJECTION_H >> + >> +/* GT Uncorrectable unicast worker command parity error injection */ >> +#define MC_PKT_CTRL_MGSR_3D_ADDRESS 0x00FD4 >> +#define MC_PKT_CTRL_MGSR_3D_VALUE 0x80000000 >> +#define WKR_FABRIC_ERR_INJ_GAMWALK_3D_ADDRESS 0xF310 >> +#define WKR_FABRIC_ERR_INJ_GAMWALK_3D_VALUE 0x1 >> + >> +#define POST_RECOVERY_WL 1 >> +#define POST_ARMING_INJECTION_WL 0 >> + >> +#endif /* XE_ERR_INJECTION_H */ >> diff --git a/tests/meson.build b/tests/meson.build >> index a62f447df..0f090dcee 100644 >> --- a/tests/meson.build >> +++ b/tests/meson.build >> @@ -292,6 +292,7 @@ intel_xe_progs = [ >>       'xe_debugfs', >>       'xe_dma_buf_sync', >>       'xe_drm_fdinfo', >> +    'xe_err_injection', >>       'xe_eu_stall', >>       'xe_evict', >>       'xe_evict_ccs',