From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D32B606A31C for ; Mon, 30 Nov 2026 16:30:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=AMz2A9VW Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 364B610F25D; Mon, 30 Nov 2026 16:30:33 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id DFDFD10F257; Mon, 30 Nov 2026 16:30:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796056227; x=1827592227; h=message-id:date:subject:from:to:cc:references: in-reply-to:content-transfer-encoding:mime-version; bh=pX+Qxn4+jTi283gV+hxVcs/lybZ0VIovMYMUIL21gQA=; b=AMz2A9VW36DeC3x6JQig7mPwAnbkJkgsz2kLtyY/P8BRi0Qe878jTCDS e6n0NGoc75mnGvZJI1du6G/5tv7mEkg1FfDyjCLIQdM4RCF05nhq0lNmV AoqVX4ZAMkusWu0Pp6aXhP0qr4A72vyKnJNBkvHFd1BRRHbrgqsQh1K0e QRxNjdVF0Hz5oGj8FCi7wkNmopexhAk/6Cy/sYsGPI994s95R+L4WF3vd Z/TYKofkxaK/PZcd/SqNBYms9rkyfB4jtX0yJ7v8F7u87by+7Lq/lDUNd ip1pOtkueKY4QES5t1Ql/XUnB0s5RisAhRU19O1MJEjczqQ1QKpw9t9KF Q==; X-CSE-ConnectionGUID: LwFqF8pdS0uM5k8sQ+bQIQ== X-CSE-MsgGUID: Zus4unkTQeuQFlLAd+AhnQ== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4801328" X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="4801328" Received: from fmviesa012.fm.intel.com ([10.60.135.152]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 08:30:26 -0800 X-CSE-ConnectionGUID: 86oHwgvLQRmC2NMBj/qaKg== X-CSE-MsgGUID: w/hJoNKdTLOFyiYSrnO/ng== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="14648950" Received: from fmsmsx903.amr.corp.intel.com ([10.18.126.92]) by fmviesa012.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 08:30:26 -0800 Received: from FMSMSX901.amr.corp.intel.com (10.18.126.90) by fmsmsx903.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 08:30:25 -0800 Received: from fmsedg902.ED.cps.intel.com (10.1.192.144) by FMSMSX901.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57 via Frontend Transport; Mon, 30 Nov 2026 08:30:25 -0800 Received: from SJ2PR03CU001.outbound.protection.outlook.com (52.101.43.71) by edgegateway.intel.com (192.55.55.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 08:30:25 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tiMa3TZ6Md9kZQhl1URp+tGGbn3aWorSEdcwY6MdNxIFNkdFuEueUcOnjObpdE8gBCgeIn57DlLU9IQFvdLN14QFvGCF+826/VnmcUyHwIEbsZCgQ8VW+gkOq90dHQaz7cuYv7ez5bI2hW5h3/B99C+LegsXXWGupnhy9zaLWHSe6M1zZJZgjGzpl0x0u6Sh0qOWNdMMhnO/4Qjt3AWfj2e/Vx1w9qkWPwizDK1h1Rvtu/93M9VTFD/cwHtNIhR0XIRZHN3P/kgaPZL2SKiKVfgrhyk42C//M3IZth3xctOqUN0jOhWgGwR0m0BcLS5sysTWNl9VJmRhNxPAlntHJA== 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=pX+Qxn4+jTi283gV+hxVcs/lybZ0VIovMYMUIL21gQA=; b=yb8WaDwBCqIGFXwyFQhsId5XNMHC7iCYRZO0/fma8IsSF/ID8/FOOeZ/mcOcjAznGj/2KMwohmsHaFORQiPoBclkFU/uYnxLHyyOw+d6UHQAMZ3B4CGHMoURkIZlk/YBmYM7H12H8y/leIv90A0RMNvxXxR2OQSrvw4ARpZwTV1BYMFPPGE8RUQNeXJKZJ46WHeKr3EC8VhZZxw2tkL/cMVZmDeRhTgKH/fJmeX3DDwphzdXTeypjeEYkVt/fD1QJbQTW0SfNggKDTnwN8iTx/HWkr6R/FurYBAP+vGlHQ/GIxqGJmAEmJcBMEU2NSePi7qVwdAZSqZsMsV/3rhLDQ== 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: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7958.namprd11.prod.outlook.com (2603:10b6:8:f9::19) by IA4PR11MB8943.namprd11.prod.outlook.com (2603:10b6:208:569::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.12; Mon, 30 Nov 2026 16:30:18 +0000 Received: from DS0PR11MB7958.namprd11.prod.outlook.com ([fe80::8cb2:cffc:b684:9a99]) by DS0PR11MB7958.namprd11.prod.outlook.com ([fe80::8cb2:cffc:b684:9a99%4]) with mapi id 15.21.0662.007; Mon, 30 Nov 2026 16:30:18 +0000 Message-ID: <1a4bf25b-08a0-41fb-82bf-039aabfd166f@intel.com> Date: Mon, 30 Nov 2026 22:00:08 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 2/3] drm/ras: Add retired-pages node type From: "Tauro, Riana" To: Rodrigo Vivi CC: , , Aravind Iddamsetty , Jakub Kicinski , Raag Jadav , Zack McKevitt , Jeff Hugo References: <20261127181750.806528-5-rodrigo.vivi@intel.com> <20261127181750.806528-7-rodrigo.vivi@intel.com> <15908e27-e48a-44b3-8dd6-ef2b1d84bca4@intel.com> <993edea8-76d7-4363-a3d6-eb6215c807b9@intel.com> Content-Language: en-US In-Reply-To: <993edea8-76d7-4363-a3d6-eb6215c807b9@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MA5P287CA0297.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:21e::12) To DS0PR11MB7958.namprd11.prod.outlook.com (2603:10b6:8:f9::19) X-Archived-By: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7958:EE_|IA4PR11MB8943:EE_ X-MS-Office365-Filtering-Correlation-Id: aed84ccc-6ac1-4b5d-dd51-08df4eff384c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|376014|1800799024|23010399003|4143699003|6133799003|22082099003|18002099003|11063799006|10067099003|56012099006|261026121527099003|261028144727099003|261026140227099003|261102123227099003|261021123027099003|261021121427099003|261009223327099003|261009223027099003|261009221727099003|261009221227099003|261009220027099003|261022105027099003|261022075727099003|261102130727099003; X-Microsoft-Antispam-Message-Info: xXHlvuC/OtNT/8e092h1r1ZqzJafewadX3SN/smK4/pTFpTRsOIAYVrld3BMg1wf+7mE9yRAQFK0fSZ7V4X5kJtMkD8vRUhY7JfOQ0XDEf3th78Rg+vZvLQpsOF+An0BNDKYIqabYduW1ym6szwdlzADvTA3A1wxvWmjYR7Bw5m7ZQwbj+24AmlEv0Cv/SNZvuilp6YNBXMrq/gQ/XVQiUNT16EVUw8IsBjnRju4kbsIGC4id5QH5r7bcj2KCAnm4J5UtPcp+PgDJhIQMfZvVl1tkcatyE5JQVubMqIfoL3dLrVzbr1z0JhLvWtL6LMpkA2eIUGUHRinONSBosu/+R6cak+FSzDJBW8pG+P9cxsMyfwVcr5bcO5EQI3vJO5HhLwjTENpxuMQuqbEwmoT2aMeEbbYc51MGtH5spKJm0rVMc9W84cHQcPWMLez4OuwPgbKxNrRmnjJGl/9k6X55O0Fye5o7sR57soEN4FAIKorX6jeDqCSYf4bmmsW2z06l9KRadcANiWK9vM5jdnSDtUUFiDx6TcP7YSIHk601p1eJps64gveR2ZRdffWfjges0Q/2O20K54ykV9p/Bvf5xWYK6u+TsLMCEXApVMCbxbAldKl4E8o72ShLpF6dTLF/bQwg/ukt3KHMKKILNBAqHl2vKR/i9Zv8gCJWlwlwWM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7958.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024)(23010399003)(4143699003)(6133799003)(22082099003)(18002099003)(11063799006)(10067099003)(56012099006)(261026121527099003)(261028144727099003)(261026140227099003)(261102123227099003)(261021123027099003)(261021121427099003)(261009223327099003)(261009223027099003)(261009221727099003)(261009221227099003)(261009220027099003)(261022105027099003)(261022075727099003)(261102130727099003); D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HjnDgTlt3LSdWyX+qLf/snssD15gyHkL5G3cu2w0Te0MnAigJ+w== X-MS-Exchange-CrossTenant-Network-Message-Id: aed84ccc-6ac1-4b5d-dd51-08df4eff384c X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7958.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 16:30:18.1551 (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: 0J3hK0scs/DfQhy60dsR5mUZzCPsovagt4bdUw0f2PxaOXe3f/TD57gBdW7htvMXmolL39+iw0O5pR1HQreDZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA4PR11MB8943 X-OriginatorOrg: intel.com X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 30-11-2026 21:57, Tauro, Riana wrote: > > On 30-11-2026 21:04, Rodrigo Vivi wrote: >> On Mon, Nov 30, 2026 at 10:31:50AM +0530, Tauro, Riana wrote: >>> On 27-11-2026 23:47, Rodrigo Vivi wrote: >>>> From: Aravind Iddamsetty >>>> >>>> Add a retired-pages node type to drm-ras so drivers can report the >>>> memory pages they have taken out of service, with two operations: >>>> >>>>    - get-retired-pages: dump one entry per page with its address, size >>>>      and status (retired, pending or failed). The list is read >>>> once, when >>>>      the dump starts. >>>>    - get-retired-pages-info: return the maximum number of pages >>>> that can >>>>      be retired. >>>> >>>> v3 (Rodrigo+LLM): >>>>    - Split the drm-ras core from the xe user. >>>>    - Flatten the page attributes and name the node type retired-pages >>>>      instead of retired-resources, avoiding the over-wrapping >>>>      anti-pattern pointed out by Jakub: the type-specific nest and the >>>>      resource-type enum are gone. >>>>    - Use uint for address, size and max-pages, no pad (Jakub). >>>>    - Start the status enum at 1. >>>>    - Move max-pages to its own do operation instead of a leading dump >>>>      entry. >>>>    - Set NLM_F_DUMP_INTR from a driver generation counter. >>>>    - Report unknown node IDs with NL_SET_BAD_ATTR. >>>>    - Removed deprecated Assisted-by tag. >>>> >>>> v4 (Rodrigo+LLM): >>>>    - Check the dump consistency once a page message is filled >>>> (Sashiko), >>>>      and on the final NLMSG_DONE (local Sashiko), so >>>> NLM_F_DUMP_INTR is >>>>      not lost. >>>>    - Make the error-counter operations reject other node types >>>> (Sashiko). >>>>    - Hold a node reference in the new handlers (local Sashiko). >>>>    - Rebase on the telemetry node type, moving the type check of its >>>>      handlers into drm_ras_node_get(). >>>> >>>> v5 (Rodrigo+LLM): >>>>    - Split the node and callback checks in the clear-error-counter >>>> doit, >>>>      and write the new handlers like the error-counter ones, with >>>>      put_node labels and an inline dump loop, for consistency (Riana). >>>>    - Drop node-id from the dump entries (Riana). >>>> >>>> v6 (Rodrigo+LLM): >>>>    - Take a snapshot of the retired pages when the dump starts, >>>> instead of >>>>      asking the driver for each page, so large lists are dumped in >>>> linear >>>>      time. The snapshot is consistent, so NLM_F_DUMP_INTR and the >>>>      generation counter are gone (Riana). >>>>    - Move the type check of drm_ras_node_get() to its own patch >>>> (Riana). >>>>    - Let drm-ras own the snapshot array, which drivers fill with >>>>      drm_ras_retired_pages_add(), and do not sort it (Riana). >>>>    - Pass the info to the driver in a struct, so it can grow, and drop >>>>      node-id from the get-retired-pages-info reply (Riana). >>>>    - Document each retired-page-status value, which also documents >>>> them >>>>      in the uAPI header, and reword the max-pages and info docs >>>> (Riana). >>>>    - Name the dump hooks pre/post like the other drm-ras ones, and use >>>>      struct nlattr for the message headers (Riana). >>>> >>>> Cc: Jakub Kicinski >>>> Cc: Riana Tauro >>>> Cc: Raag Jadav >>>> Cc: Zack McKevitt >>>> Cc: Jeff Hugo >>>> Signed-off-by: Aravind Iddamsetty >>>> Signed-off-by: Rodrigo Vivi >>>> --- >>>>    Documentation/netlink/specs/drm_ras.yaml |  78 ++++++- >>>>    drivers/gpu/drm/drm_ras.c                | 252 >>>> ++++++++++++++++++++++- >>>>    drivers/gpu/drm/drm_ras_nl.c             |  26 +++ >>>>    drivers/gpu/drm/drm_ras_nl.h             |   6 + >>>>    include/drm/drm_ras.h                    |  68 ++++++ >>>>    include/uapi/drm/drm_ras.h               |  34 ++- >>>>    6 files changed, 454 insertions(+), 10 deletions(-) >>>> >>>> diff --git a/Documentation/netlink/specs/drm_ras.yaml >>>> b/Documentation/netlink/specs/drm_ras.yaml >>>> index 0f1ceb705d3d..7cab42685568 100644 >>>> --- a/Documentation/netlink/specs/drm_ras.yaml >>>> +++ b/Documentation/netlink/specs/drm_ras.yaml >>>> @@ -16,16 +16,33 @@ definitions: >>>>        type: enum >>>>        name: node-type >>>>        value-start: 1 >>>> -    entries: [error-counter, telemetry] >>>> +    entries: [error-counter, telemetry, retired-pages] >>>>        doc: >- >>>>             Type of the node. The error-counter nodes expose >>>> reliability counters >>>> -         for a hardware/software component, and telemetry nodes >>>> expose an >>>> -         interface for reading and writing telemetry values to a >>>> device. >>>> +         for a hardware/software component, telemetry nodes expose an >>>> +         interface for reading and writing telemetry values to a >>>> device, and >>>> +         retired-pages nodes list the memory pages that have been >>>> taken out >>>> +         of service. >>>>      - >>>>        type: flags >>>>        name: telemetry-field-mode >>>>        entries: [read, write] >>>>        doc: Bitmask of access modes supported by a telemetry field. >>>> +  - >>>> +    type: enum >>>> +    name: retired-page-status >>>> +    value-start: 1 >>>> +    doc: Status of a retired page. >>>> +    entries: >>>> +      - >>>> +        name: retired >>>> +        doc: The page is reserved and out of service. >>>> +      - >>>> +        name: pending >>>> +        doc: The retirement is queued, but the reservation is not >>>> complete yet. >>>> +      - >>>> +        name: failed >>>> +        doc: The reservation failed, and the page may still be in >>>> use. >>>>    attribute-sets: >>>>      - >>>> @@ -140,6 +157,30 @@ attribute-sets: >>>>            doc: >- >>>>                 Bitmask of access modes (read/write) supported by the >>>>                 telemetry field. >>>> +  - >>>> +    name: retired-page-attrs >>>> +    attributes: >>>> +      - >>>> +        name: node-id >>>> +        type: u32 >>>> +        doc: Node ID targeted by this retired pages operation. >>>> +      - >>>> +        name: address >>>> +        type: uint >>>> +        doc: Device address of the retired page. >>>> +      - >>>> +        name: size >>>> +        type: uint >>>> +        doc: Size of the retired page in bytes. >>>> +      - >>>> +        name: status >>>> +        type: u32 >>>> +        doc: Retirement status of the page. >>>> +        enum: retired-page-status >>>> +      - >>>> +        name: max-pages >>>> +        type: uint >>>> +        doc: Maximum number of pages that can be retired. >>>>    operations: >>>>      list: >>>> @@ -287,6 +328,37 @@ operations: >>>>                - field >>>>                - field-name >>>>                - mode >>>> +    - >>>> +      name: get-retired-pages >>>> +      doc: >- >>>> +           Retrieve the pages retired on a retired-pages node, one >>>> entry per >>>> +           page. The list is read once, when the dump starts. >>>> +      attribute-set: retired-page-attrs >>>> +      flags: [admin-perm] >>>> +      dump: >>>> +        pre: drm-ras-nl-pre-retired-pages >>>> +        post: drm-ras-nl-post-retired-pages >>>> +        request: >>>> +          attributes: >>>> +            - node-id >>>> +        reply: >>>> +          attributes: >>>> +            - address >>>> +            - size >>>> +            - status >>>> +    - >>>> +      name: get-retired-pages-info >>>> +      doc: >- >>>> +           Retrieve the retired pages info of a retired-pages node. >>>> +      attribute-set: retired-page-attrs >>>> +      flags: [admin-perm] >>>> +      do: >>>> +        request: >>>> +          attributes: >>>> +            - node-id >>>> +        reply: >>>> +          attributes: >>>> +            - max-pages >>>>    mcast-groups: >>>>      list: >>>> diff --git a/drivers/gpu/drm/drm_ras.c b/drivers/gpu/drm/drm_ras.c >>>> index 5ae6d0a3b751..618b6a44c95b 100644 >>>> --- a/drivers/gpu/drm/drm_ras.c >>>> +++ b/drivers/gpu/drm/drm_ras.c >>>> @@ -69,6 +69,14 @@ >>>>     *     Each field contains the uAPI defined enum string, its >>>> numerical value, >>>>     *     and its mode bitmask, which encodes read/write capabilities. >>>>     * >>>> + * 11. GET_RETIRED_PAGES: Dump the retired pages of a given node. >>>> + *     Userspace must provide Node ID. >>>> + *     Returns one entry per page with its address, size and status. >>>> + * >>>> + * 12. GET_RETIRED_PAGES_INFO: Get the retired pages info of a >>>> given node. >>>> + *     Userspace must provide Node ID. >>>> + *     Returns the maximum number of pages that can be retired. >>>> + * >>>>     * Node registration: >>>>     * >>>>     * - drm_ras_node_register(): Registers a new node and assigns >>>> @@ -121,6 +129,13 @@ >>>>     *     + The driver can optionally provide a pre_doit callback, >>>> telemetry_pre(), >>>>     *       to enforce permissions checks on telemetry operations. >>>>     * >>>> + * - RETIRED_PAGES: >>>> + *     + The driver must implement the query_retired_pages() >>>> callback, adding >>>> + *       each retired page of the node to the snapshot of the dump >>>> with >>>> + *       drm_ras_retired_pages_add(). >>>> + *     + The driver can implement query_retired_pages_info() to >>>> report the >>>> + *       maximum number of pages that can be retired. >>>> + * >>>>     * Netlink handlers: >>>>     * >>>>     * - drm_ras_nl_list_nodes_dumpit(): Implements the LIST_NODES >>>> @@ -147,10 +162,26 @@ >>>>     * - drm_ras_nl_telemetry_list_fields_dumpit(): Implements the >>>> TELEMETRY_LIST_FIELDS >>>>     *   dumpit operation, enumerating all telemetry fields and >>>> their supported >>>>     *   access modes for a telemetry node. >>>> + * - drm_ras_nl_pre_retired_pages(): GET_RETIRED_PAGES dump start >>>> operation, >>>> + *   taking a snapshot of the retired pages of a specific node. >>>> + * - drm_ras_nl_get_retired_pages_dumpit(): Implements the >>>> GET_RETIRED_PAGES dumpit >>>> + *   operation, listing the retired pages of the snapshot. >>>> + * - drm_ras_nl_post_retired_pages(): GET_RETIRED_PAGES dump done >>>> operation, >>>> + *   freeing the snapshot. >>>> + * - drm_ras_nl_get_retired_pages_info_doit(): Implements the >>>> GET_RETIRED_PAGES_INFO >>>> + *   doit operation, fetching the retired pages info of a specific >>>> node. >>>>     */ >>>>    static DEFINE_XARRAY_ALLOC(drm_ras_xa); >>>> +/* State of a GET_RETIRED_PAGES dump */ >>>> +struct drm_ras_retired_pages_ctx { >>>> +    /* Snapshot of the retired pages, taken when the dump starts */ >>>> +    struct drm_ras_retired_pages snapshot; >>>> +    /* Index of the next page of @snapshot to dump */ >>>> +    u32 next; >>>> +}; >>>> + >>>>    /* >>>>     * Per-command netlink context. Overlaid on the callback storage >>>> (cb->ctx) for >>>>     * dumps and on genl_info (info->ctx) for doits. @node pins the >>>> node targeted by >>>> @@ -162,6 +193,8 @@ struct drm_ras_ctx { >>>>        unsigned long restart; >>>>        /* Node targeted by a telemetry get/set doit */ >>>>        struct drm_ras_node *node; >>>> +    /* State of a retired pages dump */ >>>> +    struct drm_ras_retired_pages_ctx retired; >>>>    }; >>>>    static_assert(sizeof(struct drm_ras_ctx) <= NETLINK_CTX_SIZE); >>>> @@ -704,19 +737,23 @@ int >>>> drm_ras_nl_clear_error_counter_doit(struct sk_buff *skb, >>>>        error_id = >>>> nla_get_u32(info->attrs[DRM_RAS_A_ERROR_COUNTER_ATTRS_ERROR_ID]); >>>>        node = drm_ras_node_get(node_id, >>>> DRM_RAS_NODE_TYPE_ERROR_COUNTER); >>>> -    if (!node || !node->clear_error_counter) { >>>> -        drm_ras_node_put(node); >>>> +    if (!node) >>>>            return -ENOENT; >>>> + >>>> +    if (!node->clear_error_counter) { >>>> +        ret = -ENOENT; >>>> +        goto put_node; >>>>        } >>>>        if (error_id < node->error_counter_range.first || >>>>            error_id > node->error_counter_range.last) { >>>> -        drm_ras_node_put(node); >>>> -        return -EINVAL; >>>> +        ret = -EINVAL; >>>> +        goto put_node; >>>>        } >>>>        ret = node->clear_error_counter(node, error_id); >>>> +put_node: >>>>        drm_ras_node_put(node); >>> This can be part of the first patch. unrelated to this patch >> Indeed, I'll move it to patch 1. >> >>>>        return ret; >>>> @@ -785,6 +822,208 @@ int >>>> drm_ras_nl_set_error_threshold_doit(struct sk_buff *skb, struct >>>> genl_info *i >>>>        return ret; >>>>    } >>>> +static struct drm_ras_node *get_retired_pages_node(const struct >>>> genl_info *info) >>>> +{ >>>> +    struct nlattr *attr = >>>> info->attrs[DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID]; >>>> +    struct drm_ras_node *node; >>>> + >>>> +    node = drm_ras_node_get(nla_get_u32(attr), >>>> DRM_RAS_NODE_TYPE_RETIRED_PAGES); >>>> +    if (!node) >>>> +        NL_SET_BAD_ATTR(info->extack, attr); >>>> + >>>> +    return node; >>>> +} >>>> + >>>> +static int msg_put_retired_page(struct sk_buff *msg, >>>> +                const struct drm_ras_retired_page *page) >>>> +{ >>>> +    int ret; >>>> + >>>> +    ret = nla_put_uint(msg, DRM_RAS_A_RETIRED_PAGE_ATTRS_ADDRESS, >>>> page->address); >>>> +    if (ret) >>>> +        return ret; >>>> + >>>> +    ret = nla_put_uint(msg, DRM_RAS_A_RETIRED_PAGE_ATTRS_SIZE, >>>> page->size); >>>> +    if (ret) >>>> +        return ret; >>>> + >>>> +    return nla_put_u32(msg, DRM_RAS_A_RETIRED_PAGE_ATTRS_STATUS, >>>> page->status); >>>> +} >>>> + >>>> +/** >>>> + * drm_ras_retired_pages_add() - Add a page to a retired pages >>>> snapshot >>>> + * @list: Snapshot passed to the query_retired_pages() callback >>>> + * @page: Retired page to add >>>> + * >>>> + * Return: 0 on success, or -ENOMEM if @list cannot grow. >>>> + */ >>>> +int drm_ras_retired_pages_add(struct drm_ras_retired_pages *list, >>>> +                  const struct drm_ras_retired_page *page) >>>> +{ >>>> +    struct drm_ras_retired_page *pages; >>>> +    u32 capacity; >>>> + >>>> +    if (list->count == list->capacity) { >>>> +        capacity = max(16U, 2 * list->capacity); >>>> +        pages = kvrealloc(list->pages, array_size(capacity, >>>> sizeof(*pages)), GFP_KERNEL); >>> Can't we allocate the list at one shot with the count and add the >>> pages at >>> once too? >> I'd prefer to keep it like this. drm-ras doesn't know how many pages >> there are, only the driver does, and it can change until the driver >> takes its lock. Other drivers might not even keep a count, and each >> one stores the pages in its own way, so there's no array to just copy. >> >> And since the array doubles each time, even 10000 pages only take >> about 10 reallocations. > > okay. Makes sense. with the clear counter changes moved to patch 1 > Reviewed-by: Riana Tauro > > > Sorry typo Reviewed-by: Riana Tauro >> >> Thanks, >> Rodrigo. >> >>> Rest of the review comments have been addressed and it looks good to >>> me. >>> >>> Thanks >>> Riana >>> >>>> +        if (!pages) >>>> +            return -ENOMEM; >>>> + >>>> +        list->pages = pages; >>>> +        list->capacity = capacity; >>>> +    } >>>> + >>>> +    list->pages[list->count++] = *page; >>>> + >>>> +    return 0; >>>> +} >>>> +EXPORT_SYMBOL(drm_ras_retired_pages_add); >>>> + >>>> +/** >>>> + * drm_ras_nl_pre_retired_pages() - Take a snapshot of the retired >>>> pages >>>> + * @cb: Callback context for multi-part dumps >>>> + * >>>> + * Return: 0 on success, or a negative error code on failure. >>>> + */ >>>> +int drm_ras_nl_pre_retired_pages(struct netlink_callback *cb) >>>> +{ >>>> +    const struct genl_info *info = genl_info_dump(cb); >>>> +    struct drm_ras_ctx *ctx = (void *)cb->ctx; >>>> +    struct drm_ras_node *node; >>>> +    int ret; >>>> + >>>> +    if (!info->attrs || GENL_REQ_ATTR_CHECK(info, >>>> DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID)) >>>> +        return -EINVAL; >>>> + >>>> +    node = get_retired_pages_node(info); >>>> +    if (!node) >>>> +        return -ENOENT; >>>> + >>>> +    ret = node->query_retired_pages(node, &ctx->retired.snapshot); >>>> +    drm_ras_node_put(node); >>>> +    if (ret) >>>> +        kvfree(ctx->retired.snapshot.pages); >>>> + >>>> +    return ret; >>>> +} >>>> + >>>> +/** >>>> + * drm_ras_nl_get_retired_pages_dumpit() - Dump the retired pages >>>> of a node >>>> + * @skb: Netlink message buffer >>>> + * @cb: Callback context for multi-part dumps >>>> + * >>>> + * Appends one message per retired page of the snapshot. The dump >>>> resumes from >>>> + * the next page after a buffer overflow. >>>> + * >>>> + * Return: 0 if all pages fit in @skb, -EMSGSIZE if the buffer >>>> filled up >>>> + *         (requires multi-part continuation), or a negative error >>>> code on >>>> + *         failure. >>>> + */ >>>> +int drm_ras_nl_get_retired_pages_dumpit(struct sk_buff *skb, >>>> +                    struct netlink_callback *cb) >>>> +{ >>>> +    const struct genl_info *info = genl_info_dump(cb); >>>> +    struct drm_ras_ctx *ctx = (void *)cb->ctx; >>>> +    struct nlattr *hdr; >>>> +    int ret = 0; >>>> + >>>> +    for (; ctx->retired.next < ctx->retired.snapshot.count; >>>> ctx->retired.next++) { >>>> +        hdr = genlmsg_iput(skb, info); >>>> +        if (!hdr) { >>>> +            ret = -EMSGSIZE; >>>> +            break; >>>> +        } >>>> + >>>> +        ret = msg_put_retired_page(skb, >>>> &ctx->retired.snapshot.pages[ctx->retired.next]); >>>> +        if (ret) { >>>> +            genlmsg_cancel(skb, hdr); >>>> +            break; >>>> +        } >>>> + >>>> +        genlmsg_end(skb, hdr); >>>> +    } >>>> + >>>> +    return ret; >>>> +} >>>> + >>>> +/** >>>> + * drm_ras_nl_post_retired_pages() - Free the retired pages snapshot >>>> + * @cb: Callback context for multi-part dumps >>>> + * >>>> + * Return: 0. >>>> + */ >>>> +int drm_ras_nl_post_retired_pages(struct netlink_callback *cb) >>>> +{ >>>> +    struct drm_ras_ctx *ctx = (void *)cb->ctx; >>>> + >>>> +    kvfree(ctx->retired.snapshot.pages); >>>> + >>>> +    return 0; >>>> +} >>>> + >>>> +/** >>>> + * drm_ras_nl_get_retired_pages_info_doit() - Query the retired >>>> pages info of a node >>>> + * @skb: Netlink message buffer >>>> + * @info: Generic Netlink info containing attributes of the request >>>> + * >>>> + * Return: 0 on success, or negative errno on failure. >>>> + */ >>>> +int drm_ras_nl_get_retired_pages_info_doit(struct sk_buff *skb, >>>> +                       struct genl_info *info) >>>> +{ >>>> +    struct drm_ras_retired_pages_info pages_info = {}; >>>> +    struct drm_ras_node *node; >>>> +    struct sk_buff *msg; >>>> +    struct nlattr *hdr; >>>> +    int ret; >>>> + >>>> +    if (!info->attrs || GENL_REQ_ATTR_CHECK(info, >>>> DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID)) >>>> +        return -EINVAL; >>>> + >>>> +    node = get_retired_pages_node(info); >>>> +    if (!node) >>>> +        return -ENOENT; >>>> + >>>> +    if (!node->query_retired_pages_info) { >>>> +        ret = -EOPNOTSUPP; >>>> +        goto put_node; >>>> +    } >>>> + >>>> +    ret = node->query_retired_pages_info(node, &pages_info); >>>> +    if (ret) >>>> +        goto put_node; >>>> + >>>> +    msg = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); >>>> +    if (!msg) { >>>> +        ret = -ENOMEM; >>>> +        goto put_node; >>>> +    } >>>> + >>>> +    hdr = genlmsg_iput(msg, info); >>>> +    if (!hdr) { >>>> +        ret = -EMSGSIZE; >>>> +        goto free_msg; >>>> +    } >>>> + >>>> +    ret = nla_put_uint(msg, >>>> DRM_RAS_A_RETIRED_PAGE_ATTRS_MAX_PAGES, pages_info.max_pages); >>>> +    if (ret) >>>> +        goto cancel_msg; >>>> + >>>> +    genlmsg_end(msg, hdr); >>>> + >>>> +    drm_ras_node_put(node); >>>> + >>>> +    return genlmsg_reply(msg, info); >>>> + >>>> +cancel_msg: >>>> +    genlmsg_cancel(msg, hdr); >>>> +free_msg: >>>> +    nlmsg_free(msg); >>>> +put_node: >>>> +    drm_ras_node_put(node); >>>> +    return ret; >>>> +} >>>> + >>>>    /** >>>>     * drm_ras_nl_pre_telemetry - Look up the telemetry node and >>>> enforce permissions >>>>     * @ops: Generic netlink operations >>>> @@ -1102,7 +1341,6 @@ int drm_ras_node_register(struct drm_ras_node >>>> *node) >>>>        if (!node->device_name || !node->node_name) >>>>            return -EINVAL; >>>> -    /* Currently, only Error Counter and Telemetry endpoints are >>>> supported */ >>>>        switch (node->type) { >>>>        case DRM_RAS_NODE_TYPE_ERROR_COUNTER: >>>>            /* Mandatory entries for Error Counter Node */ >>>> @@ -1114,6 +1352,10 @@ int drm_ras_node_register(struct >>>> drm_ras_node *node) >>>>            if (!node->telemetry_get || !node->telemetry_fields) >>>>                return -EINVAL; >>>>            break; >>>> +    case DRM_RAS_NODE_TYPE_RETIRED_PAGES: >>>> +        if (!node->query_retired_pages) >>>> +            return -EINVAL; >>>> +        break; >>>>        default: >>>>            return -EINVAL; >>>>        } >>>> diff --git a/drivers/gpu/drm/drm_ras_nl.c >>>> b/drivers/gpu/drm/drm_ras_nl.c >>>> index 589c6445eff7..3fadd8742760 100644 >>>> --- a/drivers/gpu/drm/drm_ras_nl.c >>>> +++ b/drivers/gpu/drm/drm_ras_nl.c >>>> @@ -59,6 +59,16 @@ static const struct nla_policy >>>> drm_ras_telemetry_list_fields_nl_policy[DRM_RAS_A >>>>        [DRM_RAS_A_TELEMETRY_ATTRS_NODE_ID] = { .type = NLA_U32, }, >>>>    }; >>>> +/* DRM_RAS_CMD_GET_RETIRED_PAGES - dump */ >>>> +static const struct nla_policy >>>> drm_ras_get_retired_pages_nl_policy[DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID >>>> + 1] = { >>>> +    [DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID] = { .type = NLA_U32, }, >>>> +}; >>>> + >>>> +/* DRM_RAS_CMD_GET_RETIRED_PAGES_INFO - do */ >>>> +static const struct nla_policy >>>> drm_ras_get_retired_pages_info_nl_policy[DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID >>>> + 1] = { >>>> +    [DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID] = { .type = NLA_U32, }, >>>> +}; >>>> + >>>>    /* Ops table for drm_ras */ >>>>    static const struct genl_split_ops drm_ras_nl_ops[] = { >>>>        { >>>> @@ -126,6 +136,22 @@ static const struct genl_split_ops >>>> drm_ras_nl_ops[] = { >>>>            .maxattr    = DRM_RAS_A_TELEMETRY_ATTRS_NODE_ID, >>>>            .flags        = GENL_CMD_CAP_DUMP, >>>>        }, >>>> +    { >>>> +        .cmd        = DRM_RAS_CMD_GET_RETIRED_PAGES, >>>> +        .start        = drm_ras_nl_pre_retired_pages, >>>> +        .dumpit        = drm_ras_nl_get_retired_pages_dumpit, >>>> +        .done        = drm_ras_nl_post_retired_pages, >>>> +        .policy        = drm_ras_get_retired_pages_nl_policy, >>>> +        .maxattr    = DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID, >>>> +        .flags        = GENL_ADMIN_PERM | GENL_CMD_CAP_DUMP, >>>> +    }, >>>> +    { >>>> +        .cmd        = DRM_RAS_CMD_GET_RETIRED_PAGES_INFO, >>>> +        .doit        = drm_ras_nl_get_retired_pages_info_doit, >>>> +        .policy        = drm_ras_get_retired_pages_info_nl_policy, >>>> +        .maxattr    = DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID, >>>> +        .flags        = GENL_ADMIN_PERM | GENL_CMD_CAP_DO, >>>> +    }, >>>>    }; >>>>    static const struct genl_multicast_group drm_ras_nl_mcgrps[] = { >>>> diff --git a/drivers/gpu/drm/drm_ras_nl.h >>>> b/drivers/gpu/drm/drm_ras_nl.h >>>> index 7a1cba70fd50..9d6c43279eb1 100644 >>>> --- a/drivers/gpu/drm/drm_ras_nl.h >>>> +++ b/drivers/gpu/drm/drm_ras_nl.h >>>> @@ -17,6 +17,8 @@ int drm_ras_nl_pre_telemetry(const struct >>>> genl_split_ops *ops, >>>>    void >>>>    drm_ras_nl_post_telemetry(const struct genl_split_ops *ops, >>>>                  struct sk_buff *skb, struct genl_info *info); >>>> +int drm_ras_nl_pre_retired_pages(struct netlink_callback *cb); >>>> +int drm_ras_nl_post_retired_pages(struct netlink_callback *cb); >>>>    int drm_ras_nl_list_nodes_dumpit(struct sk_buff *skb, >>>>                     struct netlink_callback *cb); >>>> @@ -34,6 +36,10 @@ int drm_ras_nl_telemetry_get_doit(struct sk_buff >>>> *skb, struct genl_info *info); >>>>    int drm_ras_nl_telemetry_set_doit(struct sk_buff *skb, struct >>>> genl_info *info); >>>>    int drm_ras_nl_telemetry_list_fields_dumpit(struct sk_buff *skb, >>>>                            struct netlink_callback *cb); >>>> +int drm_ras_nl_get_retired_pages_dumpit(struct sk_buff *skb, >>>> +                    struct netlink_callback *cb); >>>> +int drm_ras_nl_get_retired_pages_info_doit(struct sk_buff *skb, >>>> +                       struct genl_info *info); >>>>    enum { >>>>        DRM_RAS_NLGRP_ERROR_REPORT, >>>> diff --git a/include/drm/drm_ras.h b/include/drm/drm_ras.h >>>> index 76bdcc6f96a5..26bc9006f0d7 100644 >>>> --- a/include/drm/drm_ras.h >>>> +++ b/include/drm/drm_ras.h >>>> @@ -28,6 +28,41 @@ struct drm_ras_telemetry_field { >>>>        u32 mode; >>>>    }; >>>> +/** >>>> + * struct drm_ras_retired_page - A retired page reported by a driver >>>> + */ >>>> +struct drm_ras_retired_page { >>>> +    /** @address: Device address of the page. */ >>>> +    u64 address; >>>> +    /** @size: Size of the page in bytes. */ >>>> +    u64 size; >>>> +    /** @status: Retirement status (enum >>>> drm_ras_retired_page_status). */ >>>> +    enum drm_ras_retired_page_status status; >>>> +}; >>>> + >>>> +/** >>>> + * struct drm_ras_retired_pages - A snapshot of the retired pages >>>> of a node >>>> + * >>>> + * Owned by drm-ras. Drivers only add pages to it with >>>> + * drm_ras_retired_pages_add(). >>>> + */ >>>> +struct drm_ras_retired_pages { >>>> +    /** @pages: Array of the retired pages. */ >>>> +    struct drm_ras_retired_page *pages; >>>> +    /** @count: Number of pages in @pages. */ >>>> +    u32 count; >>>> +    /** @capacity: Number of pages @pages can hold. */ >>>> +    u32 capacity; >>>> +}; >>>> + >>>> +/** >>>> + * struct drm_ras_retired_pages_info - Retired pages info of a node >>>> + */ >>>> +struct drm_ras_retired_pages_info { >>>> +    /** @max_pages: Maximum number of pages that can be retired. */ >>>> +    u64 max_pages; >>>> +}; >>>> + >>>>    /** >>>>     * struct drm_ras_node - A DRM RAS Node >>>>     */ >>>> @@ -184,6 +219,34 @@ struct drm_ras_node { >>>>        int (*telemetry_set)(struct drm_ras_node *ep, u64 *field, >>>> s64 *value, >>>>                     s64 *status); >>>> +    /* Retired-Pages Related Callbacks */ >>>> + >>>> +    /** >>>> +     * @query_retired_pages: >>>> +     * >>>> +     * This callback is used by drm-ras to take a snapshot of the >>>> retired >>>> +     * pages of a node. It must add each retired page of the node >>>> to @list >>>> +     * with drm_ras_retired_pages_add(). >>>> +     * >>>> +     * The @query_retired_pages is a mandatory callback for >>>> +     * retired_pages_node. >>>> +     * >>>> +     * Returns: 0 on success, negative error code on failure. >>>> +     */ >>>> +    int (*query_retired_pages)(struct drm_ras_node *node, >>>> +                   struct drm_ras_retired_pages *list); >>>> + >>>> +    /** >>>> +     * @query_retired_pages_info: >>>> +     * >>>> +     * This callback is used by drm-ras to query the retired pages >>>> info of a >>>> +     * node. >>>> +     * >>>> +     * Returns: 0 on success, negative error code on failure. >>>> +     */ >>>> +    int (*query_retired_pages_info)(struct drm_ras_node *node, >>>> +                    struct drm_ras_retired_pages_info *info); >>>> + >>>>        /** @priv: Driver private data */ >>>>        void *priv; >>>> @@ -209,12 +272,17 @@ int drm_ras_node_register(struct drm_ras_node >>>> *node); >>>>    void drm_ras_node_unregister(struct drm_ras_node *node); >>>>    int drm_ras_nl_error_event(struct drm_ras_node *node, u32 >>>> error_id, const char *error_name, >>>>                   u32 value); >>>> +int drm_ras_retired_pages_add(struct drm_ras_retired_pages *list, >>>> +                  const struct drm_ras_retired_page *page); >>>>    #else >>>>    static inline int drm_ras_node_register(struct drm_ras_node >>>> *node) { return 0; } >>>>    static inline void drm_ras_node_unregister(struct drm_ras_node >>>> *node) { } >>>>    static inline int drm_ras_nl_error_event(struct drm_ras_node >>>> *node, u32 error_id, >>>>                         const char *error_name, u32 value) >>>>    { return 0; } >>>> +static inline int drm_ras_retired_pages_add(struct >>>> drm_ras_retired_pages *list, >>>> +                        const struct drm_ras_retired_page *page) >>>> +{ return 0; } >>>>    #endif >>>>    #endif >>>> diff --git a/include/uapi/drm/drm_ras.h b/include/uapi/drm/drm_ras.h >>>> index 56e0588af5d5..834741da2459 100644 >>>> --- a/include/uapi/drm/drm_ras.h >>>> +++ b/include/uapi/drm/drm_ras.h >>>> @@ -12,12 +12,14 @@ >>>>    /* >>>>     * Type of the node. The error-counter nodes expose reliability >>>> counters for a >>>> - * hardware/software component, and telemetry nodes expose an >>>> interface for >>>> - * reading and writing telemetry values to a device. >>>> + * hardware/software component, telemetry nodes expose an >>>> interface for reading >>>> + * and writing telemetry values to a device, and retired-pages >>>> nodes list the >>>> + * memory pages that have been taken out of service. >>>>     */ >>>>    enum drm_ras_node_type { >>>>        DRM_RAS_NODE_TYPE_ERROR_COUNTER = 1, >>>>        DRM_RAS_NODE_TYPE_TELEMETRY, >>>> +    DRM_RAS_NODE_TYPE_RETIRED_PAGES, >>>>    }; >>>>    /* >>>> @@ -28,6 +30,21 @@ enum drm_ras_telemetry_field_mode { >>>>        DRM_RAS_TELEMETRY_FIELD_MODE_WRITE = 2, >>>>    }; >>>> +/** >>>> + * enum drm_ras_retired_page_status - Status of a retired page. >>>> + * @DRM_RAS_RETIRED_PAGE_STATUS_RETIRED: The page is reserved and >>>> out of >>>> + *   service. >>>> + * @DRM_RAS_RETIRED_PAGE_STATUS_PENDING: The retirement is queued, >>>> but the >>>> + *   reservation is not complete yet. >>>> + * @DRM_RAS_RETIRED_PAGE_STATUS_FAILED: The reservation failed, >>>> and the page >>>> + *   may still be in use. >>>> + */ >>>> +enum drm_ras_retired_page_status { >>>> +    DRM_RAS_RETIRED_PAGE_STATUS_RETIRED = 1, >>>> +    DRM_RAS_RETIRED_PAGE_STATUS_PENDING, >>>> +    DRM_RAS_RETIRED_PAGE_STATUS_FAILED, >>>> +}; >>>> + >>>>    enum { >>>>        DRM_RAS_A_NODE_ATTRS_NODE_ID = 1, >>>>        DRM_RAS_A_NODE_ATTRS_DEVICE_NAME, >>>> @@ -73,6 +90,17 @@ enum { >>>>        DRM_RAS_A_TELEMETRY_ATTRS_MAX = >>>> (__DRM_RAS_A_TELEMETRY_ATTRS_MAX - 1) >>>>    }; >>>> +enum { >>>> +    DRM_RAS_A_RETIRED_PAGE_ATTRS_NODE_ID = 1, >>>> +    DRM_RAS_A_RETIRED_PAGE_ATTRS_ADDRESS, >>>> +    DRM_RAS_A_RETIRED_PAGE_ATTRS_SIZE, >>>> +    DRM_RAS_A_RETIRED_PAGE_ATTRS_STATUS, >>>> +    DRM_RAS_A_RETIRED_PAGE_ATTRS_MAX_PAGES, >>>> + >>>> +    __DRM_RAS_A_RETIRED_PAGE_ATTRS_MAX, >>>> +    DRM_RAS_A_RETIRED_PAGE_ATTRS_MAX = >>>> (__DRM_RAS_A_RETIRED_PAGE_ATTRS_MAX - 1) >>>> +}; >>>> + >>>>    enum { >>>>        DRM_RAS_CMD_LIST_NODES = 1, >>>>        DRM_RAS_CMD_GET_ERROR_COUNTER, >>>> @@ -83,6 +111,8 @@ enum { >>>>        DRM_RAS_CMD_TELEMETRY_GET, >>>>        DRM_RAS_CMD_TELEMETRY_SET, >>>>        DRM_RAS_CMD_TELEMETRY_LIST_FIELDS, >>>> +    DRM_RAS_CMD_GET_RETIRED_PAGES, >>>> +    DRM_RAS_CMD_GET_RETIRED_PAGES_INFO, >>>>        __DRM_RAS_CMD_MAX, >>>>        DRM_RAS_CMD_MAX = (__DRM_RAS_CMD_MAX - 1)