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 9745B606A330 for ; Mon, 30 Nov 2026 16:04:34 +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=iMdAqKRD Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 04BAC10F21C; Mon, 30 Nov 2026 16:04:29 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by gabe.freedesktop.org (Postfix) with ESMTPS id AE5F510F21B; Mon, 30 Nov 2026 16:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796054657; x=1827590657; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=WMp1DtU2Zxxr169AEyuWenoiTUvRxy7AYLXw9COLEII=; b=iMdAqKRDs6lwGX+P3z/LMxjcVnKexQOMH4ocna6Zt37T4aexoMII/TDt zZc4LTbXDtP4pq9dAk9JfZgRNkTp48Hfgwq3ip8bovZ8c09JRIIhIgCyQ 3Ax9h6thqzYxs2FLNLW+6wD80LydsKW3fBDSvzseec4/pnTluwSre6PgT 1HJsrkxByATGY+QpYBUPiCGtPnWUKTrOulw5u0WqolFsShNXnJTA5ITVa dAJrneEmISkRenSAnK/sQYrtVLZuMKIUCsJxdZk1Tu4h6CghSbHiJEJW/ 4yDDSW7suEaoTnUO/zixa5w5K80kBH1WnWCgOuFD9ubG0g6GDU9cYeiEW A==; X-CSE-ConnectionGUID: nJuozHrHQOeYgELFVSwfbg== X-CSE-MsgGUID: P9gn5LkzTe2CdOVbLCJ4lQ== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4913126" X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="4913126" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 08:04:11 -0800 X-CSE-ConnectionGUID: SGDyL3K7SCakV+KYzCyb8g== X-CSE-MsgGUID: w5YlGpLtQlu92kEajU34aA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="13347242" Received: from fmsmsx902.amr.corp.intel.com ([10.18.126.91]) by orviesa009.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 08:04:11 -0800 Received: from FMSMSX901.amr.corp.intel.com (10.18.126.90) by fmsmsx902.amr.corp.intel.com (10.18.126.91) 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:04:10 -0800 Received: from fmsedg901.ED.cps.intel.com (10.1.192.143) 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:04:10 -0800 Received: from SJ2PR03CU001.outbound.protection.outlook.com (52.101.43.21) by edgegateway.intel.com (192.55.55.81) 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:04:10 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SRBPrRCKoLTr34M1ftqf4yXIR9DixwmXmH6G+RE5SRxaYkm7b45Perw3axYVbmkcQz5NHHU13HxVUySUclyI8SWGiwO0d9pliWHcPz2z7/sUQzE83OB1rl6A/p1JerkXp1Wk9jUxNPwJCjlF8Whx67JnOfaCZrrb8Zs2Si89oDix4McTaSJ90EI7Cvc/K5PvyXrsHcq6Q72F0+i1bO2cRRztf9VAQuUSjDKCMziqt8y+e4xDd/hqWRH4JPZqDGHK6DLEx9Rme3mqepfT40faZq+WQp4BB08ijQJYfDC6bRT+D84gjIHKeBYrUytRlm193/25Nz0UDOeHSJ6G3tl56w== 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=WMp1DtU2Zxxr169AEyuWenoiTUvRxy7AYLXw9COLEII=; b=GekJqZ1dJE/p7kQ5aPLyo05T+2FyGtOggEtdRqtROyGyKxMUOojctKVFN9k3yccn6zGnZC5JCjdDYi/Bx9MK9b7Nk7FnJf43z+xf2PIvsn4CYUuCoo9bQlwYNHtajQVBd5Z4pcE/acDKrw8MHqbVMl5l5ijhKehFAHWLy95AAJumx4U+jV/I1pz6CjtxM6BtaF9nuNb2Diyaqb1QdZvLFdrmr/8O7DhKaxZ0uFqlcMvJHmEYiiaQU5Gfq3RUk26BTWUTgg3z8imwXQwoWT/uLVMNkvEuHkm5oAQseNNwbTDxgwDF/OwqKjteWYefeZrlSlRPpZmc3tFIvdX25GqDpQ== 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 DS7PR11MB5990.namprd11.prod.outlook.com (2603:10b6:8:71::5) by MW3PR11MB4538.namprd11.prod.outlook.com (2603:10b6:303:57::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Mon, 30 Nov 2026 16:04:08 +0000 Received: from DS7PR11MB5990.namprd11.prod.outlook.com ([fe80::133c:5eed:3aec:b899]) by DS7PR11MB5990.namprd11.prod.outlook.com ([fe80::133c:5eed:3aec:b899%3]) with mapi id 15.21.0662.007; Mon, 30 Nov 2026 16:04:07 +0000 Date: Mon, 30 Nov 2026 11:04:04 -0500 From: Rodrigo Vivi To: "Upadhyay, Tejas" CC: "dri-devel@lists.freedesktop.org" , "intel-xe@lists.freedesktop.org" , "Aravind Iddamsetty" , "Ghimiray, Himal Prasad" , "Tauro, Riana" Subject: Re: [PATCH v6 3/3] drm/xe: Expose retired VRAM pages via drm-ras Message-ID: References: <20261127181750.806528-5-rodrigo.vivi@intel.com> <20261127181750.806528-8-rodrigo.vivi@intel.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: SJ0PR03CA0251.namprd03.prod.outlook.com (2603:10b6:a03:3a0::16) To DS7PR11MB5990.namprd11.prod.outlook.com (2603:10b6:8:71::5) X-Archived-By: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR11MB5990:EE_|MW3PR11MB4538:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a2a1232-bf41-4db2-9110-08df4efb9058 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|23010399003|1800799024|366016|376014|4143699003|6133799003|261009223327099003|261009223027099003|261009221227099003|261009220027099003|261009221727099003|22082099003|18002099003|10067099003|260925022911599003|260925021911599003|260925021311599003|56012099006|11063799006|261102123227099003|261026121527099003|261026140227099003|261022075727099003|261022105027099003|261021121427099003|261028144727099003; X-Microsoft-Antispam-Message-Info: 6R0voh7Q1FfyVxbsvD1CJDEoVscvIdZSFxr9HLW91FTRtLdia2969bVtuQA5klW6G2TODpc475nObdMg/VRXi0Bl+d5tt4OXjX2UBWnoo6M6/KaqlJbvg8W4de4FX8h+ZD6ye5FZ6gJmIEuTsdfu8565Csf/p49f/ll/4iEzLrovBYxKTuSCzC709WjXVdB55ZaOsf9Fe4UCxOWjcm/2vrjcNn3z1arKpRPrURcGl5uDjuXTHSZlZ+vh2kEI3p4wQanpDKcz+OFG8B/1G/UEkj3FamfxBAWU/BA7d9V3ZcthrC7KCaW5v5a7SOS7kukNpPzxIm93vLw+DpmvHDEav4pHMtun09dsps2C/LpmfY7Lia8nujG4B7zjidpb/C6bzdGkM60wZv7YWFOelN97BmeUrVXFQdaASpstlOC0PVr2ilcUSdM1eWfvfSBm+w4OorLyRpFMD/hmLDd2QMWRzotqJ8SEBwJaYzhgHG4dveD0pkVz/nNpufmIZfOJXBiDXSZpfUbJ8P+TjAPum7yyN8ygvhhZ2z3O3YzZ2ge29MluC3eDFmGT3oMc7RT+DKUBJIPaA43QJWlS7mmjC0AoIglRQ/pAPs+iEFl1L8htiLLEKsozwtUudSLbN+TXIDH6LnXv9T0E0eoptdxox15jiBA+hBrfwFopHUZxqRF+CoI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS7PR11MB5990.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(23010399003)(1800799024)(366016)(376014)(4143699003)(6133799003)(261009223327099003)(261009223027099003)(261009221227099003)(261009220027099003)(261009221727099003)(22082099003)(18002099003)(10067099003)(260925022911599003)(260925021911599003)(260925021311599003)(56012099006)(11063799006)(261102123227099003)(261026121527099003)(261026140227099003)(261022075727099003)(261022105027099003)(261021121427099003)(261028144727099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?AJ7K5zqJ1nQltRlizIG5pWp+Fwa+6L82Xeo33nDRcIMkU0ddm1IvwYRPqIUc?= =?us-ascii?Q?v6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hcFubmiTye7223jrp2AWwPm9bNaVdrzG786nmXrAto4E7XobxQ0MrC0Mplh3BXJRnLPDBCbZNJpNIsXM4dRZXWZ1sqlOUhUnCA8ogxhlWp0gFyoogApXkv+2K3busqpPFetrdYdrx1tlz8+fTr2jBDqFTPdQLb9t22ZmyWtpCupZKWJIXEba8etOyFI0TcwMl0/1nZnZ+laOMh6npQ34ZBToWaLHC0YsGYpXVuRGLolycItYJ46eNVa+c5SehMVI3Dx2FgIZnTjwlgAeHxhj1I2WA== X-MS-Exchange-CrossTenant-Network-Message-Id: 7a2a1232-bf41-4db2-9110-08df4efb9058 X-MS-Exchange-CrossTenant-AuthSource: DS7PR11MB5990.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 16:04:07.7795 (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: anZCkODS7Cq6AAqcCVUvHp2Rd5oZ71b7EIiZ8N1hULRZdR81WhNqEg7U+UVdSjAvQucOp4Th3aHXFMHPpWk+Ug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4538 X-OriginatorOrg: intel.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "dri-devel" X-Spam-Status: No, score=-15.8 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 autolearn=unavailable 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 Sun, Nov 29, 2026 at 12:31:04PM -0500, Upadhyay, Tejas wrote: > > > > -----Original Message----- > > From: Vivi, Rodrigo > > Sent: 27 November 2026 23:48 > > To: dri-devel@lists.freedesktop.org > > Cc: intel-xe@lists.freedesktop.org; Aravind Iddamsetty > > ; Upadhyay, Tejas > > ; Ghimiray, Himal Prasad > > ; Tauro, Riana ; > > Vivi, Rodrigo > > Subject: [PATCH v6 3/3] drm/xe: Expose retired VRAM pages via drm-ras > > > > From: Aravind Iddamsetty > > > > Retired VRAM pages are only visible through the vram_bad_pages debugfs file > > today. Register a drm-ras retired-pages node so userspace gets them, and the > > maximum number of pages that can be retired, through a stable interface. > > > > The snapshot of the dump is taken in one pass over the page lists of each > > VRAM manager, under its lock. > > > > v3 (Rodrigo+LLM): > > - Use the drm-ras retired-pages node type, which replaces the nested > > retired-resources layout (Jakub). > > - Walk the lists under mgr->lock instead of RCU, which they are not > > protected by, and stop reading the buddy blocks (Sashiko). > > - Add a generation counter for interrupted dumps. > > - Keep the vram_bad_pages debugfs file for now. > > - Remove deprecated Assisted-by tag. > > > > v4 (Rodrigo+LLM): > > - Register the node at the end of xe_ras_init(), once the retired page > > lists are fetched. That point is only reached with a system > > controller, which replaces the XE_CRESCENTISLAND check and keeps the > > node off VFs (local Sashiko). > > - Report the list generation also when no page is left (local Sashiko). > > > > v6 (Rodrigo+LLM): > > - Add the pages to the drm-ras snapshot in one pass over the page > > lists, instead of a walk per page, and drop the generation counter > > (Riana). > > - Do not read the pages of an unplugged device (Riana). > > - Return -EINVAL when firmware reports no max pages (Riana). > > - Do not register the node when page offlining is disabled, and do not > > fail probe if the registration fails (Riana). > > > > Cc: Tejas Upadhyay > > Cc: Himal Prasad Ghimiray > > Cc: Riana Tauro > > Signed-off-by: Aravind Iddamsetty > > Signed-off-by: Rodrigo Vivi > > --- > > drivers/gpu/drm/xe/xe_drm_ras.c | 78 > > ++++++++++++++++++++++++++++ > > drivers/gpu/drm/xe/xe_drm_ras.h | 1 + > > drivers/gpu/drm/xe/xe_ras.c | 2 + > > drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 58 +++++++++++++++++++++ > > drivers/gpu/drm/xe/xe_ttm_vram_mgr.h | 2 + > > 5 files changed, 141 insertions(+) > > > > diff --git a/drivers/gpu/drm/xe/xe_drm_ras.c > > b/drivers/gpu/drm/xe/xe_drm_ras.c index 86c589437a9f..7490281095ae > > 100644 > > --- a/drivers/gpu/drm/xe/xe_drm_ras.c > > +++ b/drivers/gpu/drm/xe/xe_drm_ras.c > > @@ -13,6 +13,7 @@ > > #include "xe_device_types.h" > > #include "xe_drm_ras.h" > > #include "xe_ras.h" > > +#include "xe_ttm_vram_mgr.h" > > #include "xe_wedge.h" > > > > static const char * const error_components[] = > > DRM_XE_RAS_ERROR_COMPONENT_NAMES; @@ -272,6 +273,83 @@ static > > int register_nodes(struct xe_device *xe) > > return ret; > > } > > > > +static int query_retired_pages(struct drm_ras_node *node, struct > > +drm_ras_retired_pages *list) { > > + struct xe_device *xe = node->priv; > > + int idx, ret; > > + > > + if (!drm_dev_enter(&xe->drm, &idx)) > > + return -ENODEV; > > + > > + ret = xe_ttm_vram_get_retired_pages(xe, list); > > + > > + drm_dev_exit(idx); > > + > > + return ret; > > +} > > + > > +static int query_retired_pages_info(struct drm_ras_node *node, > > + struct drm_ras_retired_pages_info *info) { > > + struct xe_device *xe = node->priv; > > + int idx, ret = 0; > > + > > + if (!drm_dev_enter(&xe->drm, &idx)) > > + return -ENODEV; > > + > > + info->max_pages = xe_ras_get_max_pages(xe); > > + if (!info->max_pages) > > + ret = -EINVAL; > > + > > + drm_dev_exit(idx); > > + > > + return ret; > > +} > > + > > +/** > > + * xe_drm_ras_register_retired_pages() - Register the retired VRAM > > +pages node > > + * @xe: xe device instance > > + * > > + * Called once the retired page lists are populated. > > + * > > + * Return: 0 on success, negative error code otherwise. > > + */ > > +int xe_drm_ras_register_retired_pages(struct xe_device *xe) { > > + struct pci_dev *pdev = to_pci_dev(xe->drm.dev); > > + struct drm_ras_node *node; > > + int ret; > > + > > + if (!xe->info.has_drm_ras || > > xe_ras_get_disable_vram_page_offline(xe)) > > + return 0; > > + > > + node = drmm_kzalloc(&xe->drm, sizeof(*node), GFP_KERNEL); > > + if (!node) > > + return -ENOMEM; > > + > > + node->device_name = kasprintf(GFP_KERNEL, > > "%04x:%02x:%02x.%d", > > + pci_domain_nr(pdev->bus), pdev->bus- > > >number, > > + PCI_SLOT(pdev->devfn), PCI_FUNC(pdev- > > >devfn)); > > + if (!node->device_name) > > + return -ENOMEM; > > + > > + node->node_name = "vram-retired-pages"; > > + node->type = DRM_RAS_NODE_TYPE_RETIRED_PAGES; > > + node->query_retired_pages = query_retired_pages; > > + node->query_retired_pages_info = query_retired_pages_info; > > + node->priv = xe; > > + > > + ret = drm_ras_node_register(node); > > + if (ret) { > > + drm_err(&xe->drm, "Failed to register DRM RAS retired pages > > node (%pe)\n", > > + ERR_PTR(ret)); > > + cleanup_node_param(node); > > + return ret; > > + } > > + > > + return drmm_add_action_or_reset(&xe->drm, cleanup_node, node); } > > + > > /** > > * xe_drm_ras_event() - Report drm-ras error event to userspace > > * @xe: xe device structure > > diff --git a/drivers/gpu/drm/xe/xe_drm_ras.h > > b/drivers/gpu/drm/xe/xe_drm_ras.h index 723229b2cffb..a6fc2255986d > > 100644 > > --- a/drivers/gpu/drm/xe/xe_drm_ras.h > > +++ b/drivers/gpu/drm/xe/xe_drm_ras.h > > @@ -13,6 +13,7 @@ struct xe_device; > > for (i = 0; i < DRM_XE_RAS_ERR_SEV_MAX; i++) > > > > int xe_drm_ras_init(struct xe_device *xe); > > +int xe_drm_ras_register_retired_pages(struct xe_device *xe); > > void xe_drm_ras_event(struct xe_device *xe, u32 component, u32 severity, > > u32 value); > > > > #endif > > diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c index > > d14ee40d0440..39895f6a040c 100644 > > --- a/drivers/gpu/drm/xe/xe_ras.c > > +++ b/drivers/gpu/drm/xe/xe_ras.c > > @@ -1519,6 +1519,8 @@ int xe_ras_init(struct xe_device *xe) > > get_offline_list(xe); > > get_offline_queue(xe); > > > > + xe_drm_ras_register_retired_pages(xe); > > + > > /* > > * During probe, process and log any errors detected by firmware > > while the driver was not > > * loaded. Critical errors such as Punit and CSC are reported through > > Pcode init failure, diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c > > b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c > > index 36d47de8b11b..7658ce9f1bd9 100644 > > --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c > > +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c > > @@ -10,6 +10,7 @@ > > #include > > #include > > #include > > +#include > > #include > > > > #include > > @@ -625,6 +626,63 @@ u64 xe_ttm_vram_get_avail(struct > > ttm_resource_manager *man) > > return avail; > > } > > > > +/** > > + * xe_ttm_vram_get_retired_pages - Get a snapshot of the retired VRAM > > +pages > > + * @xe: xe device instance > > + * @list: drm-ras snapshot to add the retired pages to > > + * > > + * Return: 0 on success, negative error code otherwise. > > + */ > > +int xe_ttm_vram_get_retired_pages(struct xe_device *xe, struct > > +drm_ras_retired_pages *list) { > > + struct xe_ttm_vram_offline_resource *pos; > > + struct drm_ras_retired_page page; > > + struct xe_tile *tile; > > + u8 id; > > + int ret; > > + > > + for_each_tile(tile, xe, id) { > > + struct xe_vram_region *vr = tile->mem.vram; > > + struct ttm_resource_manager *man; > > + struct xe_ttm_vram_mgr *mgr; > > + > > + man = ttm_manager_type(&xe->ttm, XE_PL_VRAM0 + id); > > + if (!man || !vr) > > + continue; > > + mgr = to_xe_ttm_vram_mgr(man); > > + > > + guard(mutex)(&mgr->lock); > > + > > + list_for_each_entry(pos, &mgr->offlined_pages, offlined_link) > > { > > + page = (struct drm_ras_retired_page) { > > + .address = pos->addr + vr->dpa_base, > > As per design doc, we were supposed to expose PFN. Are we good with this change? Yes, this was on purpose. drm-ras is generic, and a PFN alone doesn't tell much without knowing the page size, which can be different on each device. So we give the address and the size of each page, and the PFN is easy to get from them if needed. > > Apart from above comment, fetching stats of offlined and queued pages info and their status seems fine, LGTM, > Reviewed-by: Tejas Upadhyay Thank you! Rodrigo. > > > + .size = PAGE_SIZE, > > + .status = > > DRM_RAS_RETIRED_PAGE_STATUS_RETIRED, > > + }; > > + > > + ret = drm_ras_retired_pages_add(list, &page); > > + if (ret) > > + return ret; > > + } > > + > > + list_for_each_entry(pos, &mgr->queued_pages, queued_link) > > { > > + page = (struct drm_ras_retired_page) { > > + .address = pos->addr + vr->dpa_base, > > + .size = PAGE_SIZE, > > + .status = pos->status == > > XE_PAGE_RESERVE_FAIL ? > > + > > DRM_RAS_RETIRED_PAGE_STATUS_FAILED : > > + > > DRM_RAS_RETIRED_PAGE_STATUS_PENDING, > > + }; > > + > > + ret = drm_ras_retired_pages_add(list, &page); > > + if (ret) > > + return ret; > > + } > > + } > > + > > + return 0; > > +} > > + > > static int xe_ttm_vram_purge_page(struct xe_device *xe, struct xe_bo *bo) { > > u32 q_flag = DRM_XE_EXEC_QUEUE_BAN_REASON_PAGE_OFFLINE; > > diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.h > > b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.h > > index d77f067d197b..7fdcd9836148 100644 > > --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.h > > +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.h > > @@ -9,6 +9,7 @@ > > #include "xe_ttm_vram_mgr_types.h" > > > > enum dma_data_direction; > > +struct drm_ras_retired_pages; > > struct xe_device; > > struct xe_tile; > > struct xe_vram_region; > > @@ -33,6 +34,7 @@ void xe_ttm_vram_get_used(struct > > ttm_resource_manager *man, > > u64 *used, u64 *used_visible); > > int xe_ttm_vram_handle_addr_fault(struct xe_device *xe, u64 addr); int > > xe_ttm_vram_inject_fault(struct xe_device *xe); > > +int xe_ttm_vram_get_retired_pages(struct xe_device *xe, struct > > +drm_ras_retired_pages *list); > > > > static inline struct xe_ttm_vram_mgr_resource * > > to_xe_ttm_vram_mgr_resource(struct ttm_resource *res) > > -- > > 2.56.0 >