Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Mallesh, Koujalagi" <mallesh.koujalagi@intel.com>
To: Riana Tauro <riana.tauro@intel.com>
Cc: <anshuman.gupta@intel.com>, <rodrigo.vivi@intel.com>,
	<aravind.iddamsetty@linux.intel.com>, <badal.nilawar@intel.com>,
	<raag.jadav@intel.com>, <ravi.kishore.koppuravuri@intel.com>,
	<soham.purkait@intel.com>, <tejas.upadhyay@intel.com>,
	<himal.prasad.ghimiray@intel.com>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 3/5] drm/xe/xe_ras: Add support to query page offline queue and list
Date: Wed, 2 Sep 2026 15:26:06 +0530	[thread overview]
Message-ID: <39420eb0-d81b-441e-84db-d832d796e18c@intel.com> (raw)
In-Reply-To: <20260825063615.3697317-10-riana.tauro@intel.com>

[-- Attachment #1: Type: text/plain, Size: 8182 bytes --]


On 25-08-2026 12:06 pm, Riana Tauro wrote:
> Add support to query page offline list and queue from firmware
> during module load. The page offline list command retrieves pages that
> are already offlined by the firmware. The page offline queue command
> retrieves the pages pending to be offlined by the firmware.
>
> Cc: Tejas Upadhyay<tejas.upadhyay@intel.com>
> Cc: Himal Prasad Ghimiray<himal.prasad.ghimiray@intel.com>
> Signed-off-by: Riana Tauro<riana.tauro@intel.com>
> ---
>   drivers/gpu/drm/xe/xe_ras.c                   | 99 +++++++++++++++++++
>   drivers/gpu/drm/xe/xe_ras_types.h             | 43 ++++++++
>   drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h |  4 +
>   3 files changed, 146 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index c643c7137a42..441462a36dbc 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c
> @@ -328,6 +328,102 @@ static bool ras_counter_is_valid(struct xe_device *xe, struct xe_ras_error_class
>   	return true;
>   }
>   
> +static void get_queued_pages(struct xe_device *xe)
> +{
> +	struct xe_sysctrl_mailbox_command command = {0};
> +	struct xe_ras_page_offline_queue response = {0};
> +	u32 count = 0;
> +	size_t rlen;
> +	int ret, i;
> +
> +	/* Supported only on platforms with system controller */
> +	if (!xe->info.has_sysctrl)
> +		return;
> +
> +	xe_sysctrl_create_command(&command, XE_SYSCTRL_GROUP_GFSP,
> +				  XE_SYSCTRL_CMD_GET_OFFLINE_QUEUE, NULL, 0, &response,
> +				  sizeof(response));
> +
> +	do {
> +		memset(&response, 0, sizeof(response));
> +
> +		ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen);
> +		if (ret) {
> +			xe_log_err_fatal(xe, SYSCTRL, ret, "failed to get page offline queue\n");
> +			return;
> +		}
> +		if (rlen != sizeof(response)) {
> +			xe_log_err(xe, SYSCTRL, -EINVAL,
may be use errno -EPROTO?
> +				   "unexpected page offline queue response length %zu (expected %zu)\n",
> +				   rlen, sizeof(response));
> +			return;
> +		}
> +
> +		for (i = 0; i < response.pages_returned && i < XE_RAS_NUM_PAGES; i++)
> +			handle_page_offline(xe, response.page_addresses[i], true);
Silently dropping errors from handle_page_offline (). Should handle errors.
> +
> +		count += response.pages_returned;
> +		if (!response.pages_returned)
> +			break;
> +
To avoid infinite loop due to bad firmware use flood limit right?
> +		if (count > response.total_pages) {
> +			xe_log_err(xe, SYSCTRL, -EINVAL,
> +				   "Pages returned from queue exceed total pages %u, returned %u\n",
> +				   response.total_pages, count);
> +			return;
> +		}
> +	} while (response.additional_data);
> +}
> +
> +static void get_offlined_list(struct xe_device *xe)
> +{
> +	struct xe_sysctrl_mailbox_command command = {0};
> +	struct xe_ras_offline_list_response response = {0};
> +	struct xe_ras_offline_list_request request = {0};
> +	u32 count = 0;
> +	size_t rlen;
> +	int ret, i;
> +
> +	/* Supported only on platforms with system controller */
> +	if (!xe->info.has_sysctrl)
> +		return;
> +
> +	xe_sysctrl_create_command(&command, XE_SYSCTRL_GROUP_GFSP, XE_SYSCTRL_CMD_GET_OFFLINE_LIST,
> +				  &request, sizeof(request), &response, sizeof(response));
> +
> +	do {
> +		memset(&response, 0, sizeof(response));
> +		request.index = count;
> +
> +		ret = xe_sysctrl_send_command(&xe->sc, &command, &rlen);
> +		if (ret) {
> +			xe_log_err_fatal(xe, SYSCTRL, ret, "failed to get page offline list\n");
> +			return;
> +		}
> +
> +		if (rlen != sizeof(response)) {
> +			xe_log_err(xe, SYSCTRL, -EINVAL,
may be use errno -EPROTO?
> +				   "unexpected page offline list response length %zu (expected %zu)\n",
> +				   rlen, sizeof(response));
> +			return;
> +		}
> +
> +		for (i = 0; i < response.pages_returned && i < XE_RAS_NUM_PAGES; i++)
> +			handle_page_offline(xe, response.page_addresses[i], false);
> +
Silently dropping errors, need to handle?
> +		count += response.pages_returned;
> +		if (!response.pages_returned)
> +			break;
> +
To avoid infinite loop due to bad firmware use flood limit right?
> +		if (count > response.total_pages) {
> +			xe_log_err(xe, SYSCTRL, -EINVAL,
> +				   "Pages returned from list exceed total pages %u, returned %u\n",
> +				   response.total_pages, count);
> +			return;
> +		}
> +	} while (response.additional_data);
> +}
> +
>   static struct pci_dev *find_usp_dev(struct pci_dev *pdev)
>   {
>   	struct pci_dev *vsp;
> @@ -923,6 +1019,9 @@ void xe_ras_init(struct xe_device *xe)
>   	if (IS_ENABLED(CONFIG_PCIEAER))
>   		ras_usp_aer_init(xe);
>   
> +	get_queued_pages(xe);
Better to handle errors rigtht?
> +	get_offlined_list(xe);
ditto
> +
>   	ret = devm_device_add_group(xe->drm.dev, &gpu_health_group);
>   	if (ret)
>   		xe_err(xe, "Failed to create GPU health sysfs, err=%d\n", ret);
> diff --git a/drivers/gpu/drm/xe/xe_ras_types.h b/drivers/gpu/drm/xe/xe_ras_types.h
> index 2fac968879b6..cddcfa656d9f 100644
> --- a/drivers/gpu/drm/xe/xe_ras_types.h
> +++ b/drivers/gpu/drm/xe/xe_ras_types.h
> @@ -10,6 +10,7 @@
>   
>   #define XE_RAS_NUM_COUNTERS			16
>   #define XE_RAS_NUM_ERROR_ARR			3
> +#define XE_RAS_NUM_PAGES			25
>   /* Error bits in IEH global error status register */
>   #define XE_RAS_SOC_IEH_PUNIT			BIT(1)
>   /* Device memory error categories */
> @@ -280,6 +281,48 @@ struct xe_ras_page_offline_response {
>   	u32 reserved;
>   } __packed;
>   
> +/**
> + * struct xe_ras_offline_list_request - Request for get offline list command
> + */
> +struct xe_ras_offline_list_request {
> +	/** @index: Zero-based index into the offline page list */
> +	u32 index;
> +} __packed;
> +
> +/**
> + * struct xe_ras_offline_list_response - Response from get offline list command
> + */
> +struct xe_ras_offline_list_response {
> +	/** @max_entries: Total no of pages that can be stored in flash */
> +	u32 max_entries;
> +	/** @total_pages: Total number of permanently offlined pages */
> +	u32 total_pages;
> +	/** @pages_returned: Number of pages returned in this response */
> +	u32 pages_returned;
> +	/** @page_addresses: Array of permanently offlined page addresses (4KB aligned) */
> +	u64 page_addresses[XE_RAS_NUM_PAGES];
> +	/** @additional_data: Indicates if more data is available */
> +	u8 additional_data;
> +	/** @reserved: Reserved for future use */
> +	u8 reserved[3];
> +} __packed;
> +
> +/**
> + * struct xe_ras_page_offline_queue - Response from get offline queue command
> + */
> +struct xe_ras_page_offline_queue {
> +	/** @total_pages: Total number of queued pages */
> +	u32 total_pages;
> +	/** @pages_returned: Number of pages returned in this response */
> +	u32 pages_returned;
> +	/** @page_addresses: Array of page addresses (4KB aligned) */
> +	u64 page_addresses[XE_RAS_NUM_PAGES];
> +	/** @additional_data: Indicates if more data is available */
> +	u8 additional_data;
> +	/** @reserved: Reserved for future use */
> +	u8 reserved[3];
> +} __packed;
> +
>   /**
>    * struct xe_ras_get_health_request - Request structure for obtaining gpu health
>    */
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h b/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
> index 3363f48da2b7..194ad3ac3da2 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
> @@ -27,6 +27,8 @@ enum xe_sysctrl_group {
>    * @XE_SYSCTRL_CMD_CLEAR_COUNTER: Clear error counter value
>    * @XE_SYSCTRL_CMD_GET_PENDING_EVENT: Retrieve pending event
>    * @XE_SYSCTRL_CMD_PAGE_OFFLINE: Instruct firmware to offline/decline a page
> + * @XE_SYSCTRL_CMD_GET_OFFLINE_LIST: Retrieve list of all offlined pages from flash
> + * @XE_SYSCTRL_CMD_GET_OFFLINE_QUEUE: Retrieve list of offlined queued pages from firmware
>    * @XE_SYSCTRL_CMD_GET_HEALTH: Retrieve gpu health
>    * @XE_SYSCTRL_CMD_SET_HEALTH: Set gpu health
>    */
> @@ -36,6 +38,8 @@ enum xe_sysctrl_gfsp_cmd {
>   	XE_SYSCTRL_CMD_CLEAR_COUNTER		= 0x04,
>   	XE_SYSCTRL_CMD_GET_PENDING_EVENT	= 0x07,
>   	XE_SYSCTRL_CMD_PAGE_OFFLINE             = 0x08,
> +	XE_SYSCTRL_CMD_GET_OFFLINE_LIST		= 0x09,
> +	XE_SYSCTRL_CMD_GET_OFFLINE_QUEUE	= 0x0A,
>   	XE_SYSCTRL_CMD_GET_HEALTH		= 0x0B,
>   	XE_SYSCTRL_CMD_SET_HEALTH		= 0x0C,
>   };

[-- Attachment #2: Type: text/html, Size: 9822 bytes --]

  parent reply	other threads:[~2026-09-02  9:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  6:36 [PATCH 0/5] Add support to handle memory double-bit ecc errors Riana Tauro
2026-08-25  6:36 ` [PATCH 1/5] drm/xe/xe_drm_ras: Rename ras to drm_ras in xe_device Riana Tauro
2026-08-25  6:46   ` sashiko-bot
2026-08-28 15:13   ` Rodrigo Vivi
2026-09-04 10:31     ` Tauro, Riana
2026-08-25  6:36 ` [RFC PATCH 2/5] drm/xe/xe_ras: Handle page offline requests for device memory ecc errors Riana Tauro
2026-08-25  6:49   ` sashiko-bot
2026-09-02  6:30   ` Mallesh, Koujalagi
2026-09-04 10:40     ` Tauro, Riana
2026-09-04 12:55       ` Mallesh, Koujalagi
2026-09-02 16:11   ` Michal Wajdeczko
2026-08-25  6:36 ` [PATCH 3/5] drm/xe/xe_ras: Add support to query page offline queue and list Riana Tauro
2026-08-25  6:50   ` sashiko-bot
2026-09-02  9:56   ` Mallesh, Koujalagi [this message]
2026-09-04 10:49     ` Tauro, Riana
2026-08-25  6:36 ` [PATCH 4/5] drm/xe/xe_ras: Add function to get maximum pages firmware can store Riana Tauro
2026-08-25  6:36 ` [PATCH 5/5] drm/xe/xe_ras: Track offlined pages by firmware to avoid duplicates Riana Tauro
2026-08-25  6:52   ` sashiko-bot
2026-08-25  9:19 ` ✓ CI.KUnit: success for Add support to handle memory double-bit ecc errors Patchwork
2026-08-25  9:57 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-08-25 14:29 ` ✗ Xe.CI.FULL: " Patchwork
2026-08-28 15:15 ` [PATCH 0/5] " Rodrigo Vivi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39420eb0-d81b-441e-84db-d832d796e18c@intel.com \
    --to=mallesh.koujalagi@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=aravind.iddamsetty@linux.intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=raag.jadav@intel.com \
    --cc=ravi.kishore.koppuravuri@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=soham.purkait@intel.com \
    --cc=tejas.upadhyay@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox