From: "Tauro, Riana" <riana.tauro@intel.com>
To: Raag Jadav <raag.jadav@intel.com>,
<intel-xe@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>, <netdev@vger.kernel.org>
Cc: <simona.vetter@ffwll.ch>, <airlied@gmail.com>, <kuba@kernel.org>,
<lijo.lazar@amd.com>, <Hawking.Zhang@amd.com>,
<davem@davemloft.net>, <pabeni@redhat.com>, <edumazet@google.com>,
<maarten@lankhorst.se>, <zachary.mckevitt@oss.qualcomm.com>,
<rodrigo.vivi@intel.com>, <michal.wajdeczko@intel.com>,
<matthew.d.roper@intel.com>, <umesh.nerlige.ramappa@intel.com>,
<mallesh.koujalagi@intel.com>, <soham.purkait@intel.com>,
<anoop.c.vijay@intel.com>, <aravind.iddamsetty@linux.intel.com>
Subject: Re: [PATCH v1 09/11] drm/xe/ras: Set error threshold support
Date: Mon, 11 May 2026 22:51:38 +0530 [thread overview]
Message-ID: <5e90b9aa-9432-43b5-ae40-1fce383bb043@intel.com> (raw)
In-Reply-To: <20260417211730.837345-10-raag.jadav@intel.com>
On 4/18/2026 2:46 AM, Raag Jadav wrote:
> System controller allows programming per error threshold value, which
> it uses to raise error events to the driver. Set it using mailbox
> command so that it can be programmed by the user.
>
> Signed-off-by: Raag Jadav <raag.jadav@intel.com>
> ---
> drivers/gpu/drm/xe/xe_ras.c | 42 +++++++++++++++++++
> drivers/gpu/drm/xe/xe_ras.h | 1 +
> drivers/gpu/drm/xe/xe_ras_types.h | 28 +++++++++++++
> drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h | 2 +
> 4 files changed, 73 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index 3e93f838aa4a..26e063166c5f 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c
> @@ -163,3 +163,45 @@ int xe_ras_get_threshold(struct xe_device *xe, u32 severity, u32 component, u32
> comp_to_str(counter.common.component), sev_to_str(counter.common.severity));
> return 0;
> }
> +
> +int xe_ras_set_threshold(struct xe_device *xe, u32 severity, u32 component, u32 threshold)
> +{
> + struct xe_ras_set_threshold_response response = {};
> + struct xe_ras_set_threshold_request request = {};
> + struct xe_sysctrl_mailbox_command command = {};
> + struct xe_ras_error_class counter = {};
> + size_t len;
> + int ret;
> +
> + counter.common.severity = drm_to_xe_ras_severities[severity];
> + counter.common.component = drm_to_xe_ras_components[component];
> + request.counter = counter;
> + request.threshold = threshold;
We might need a max check here to avoid unnecessary values from user.
> +
> + ras_command_prepare(&command, &request, sizeof(request), &response,
> + sizeof(response), XE_SYSCTRL_CMD_SET_THRESHOLD);
Nit: command, request, response seems to be a better format
> +
> + guard(xe_pm_runtime)(xe);
> + ret = xe_sysctrl_send_command(&xe->sc, &command, &len);
> + if (ret) {
> + xe_err(xe, "sysctrl: failed to set threshold %d\n", ret);
> + return ret;
> + }
> +
> + if (len != sizeof(response)) {
> + xe_err(xe, "sysctrl: unexpected set threshold response length %zu (expected %zu)\n",
> + len, sizeof(response));
> + return -EIO;
> + }
> +
> + if (response.status) {
> + xe_err(xe, "sysctrl: set threshold operation failed %#x\n", response.status);
Status should be converted to visible error codes. check [PATCH v5 3/6]
drm/xe/xe_ras: Add helper to clear error counter - Riana Tauro
<https://lore.kernel.org/intel-xe/20260504065614.3832331-11-riana.tauro@intel.com/>
> + return -EIO;
> + }
> +
> + counter = response.counter;
> +
> + xe_dbg(xe, "[RAS]: Set threshold %u for %s %s\n", response.threshold,
> + comp_to_str(counter.common.component), sev_to_str(counter.common.severity));
Again not required. Value should be visible to user
> + return 0;
> +}
> diff --git a/drivers/gpu/drm/xe/xe_ras.h b/drivers/gpu/drm/xe/xe_ras.h
> index 982bbe61461e..d1f71b1de723 100644
> --- a/drivers/gpu/drm/xe/xe_ras.h
> +++ b/drivers/gpu/drm/xe/xe_ras.h
> @@ -14,5 +14,6 @@ struct xe_sysctrl_event_response;
> void xe_ras_counter_threshold_crossed(struct xe_device *xe,
> struct xe_sysctrl_event_response *response);
> int xe_ras_get_threshold(struct xe_device *xe, u32 severity, u32 component, u32 *threshold);
> +int xe_ras_set_threshold(struct xe_device *xe, u32 severity, u32 component, u32 threshold);
>
> #endif
> diff --git a/drivers/gpu/drm/xe/xe_ras_types.h b/drivers/gpu/drm/xe/xe_ras_types.h
> index d5da93d65cf5..d7e4a02a661d 100644
> --- a/drivers/gpu/drm/xe/xe_ras_types.h
> +++ b/drivers/gpu/drm/xe/xe_ras_types.h
> @@ -92,4 +92,32 @@ struct xe_ras_get_threshold_response {
> u32 reserved[4];
> } __packed;
>
> +/**
> + * struct xe_ras_set_threshold_request - Request structure for set threshold
> + */
> +struct xe_ras_set_threshold_request {
> + /** @counter: Counter to set threshold for */
> + struct xe_ras_error_class counter;
> + /** @threshold: Threshold value to set */
> + u32 threshold;
> + /** @reserved: Reserved for future use */
> + u32 reserved;
> +} __packed;
> +
> +/**
> + * struct xe_ras_set_threshold_response - Response structure for set threshold
> + */
> +struct xe_ras_set_threshold_response {
> + /** @counter: Counter id */
Nit: ID
> + struct xe_ras_error_class counter;
> + /** @threshold_old: Old threshold value */
Nit: prev
Thanks
Riana
> + u32 threshold_old;
> + /** @threshold: New threshold value */
> + u32 threshold;
> + /** @status: Set threshold operation status */
> + u32 status;
> + /** @reserved: Reserved for future use */
> + u32 reserved[2];
> +} __packed;
> +
> #endif
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h b/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
> index a1b71218deca..b865768e903b 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
> @@ -23,10 +23,12 @@ enum xe_sysctrl_group {
> * enum xe_sysctrl_gfsp_cmd - Commands supported by GFSP group
> *
> * @XE_SYSCTRL_CMD_GET_THRESHOLD: Retrieve error threshold
> + * @XE_SYSCTRL_CMD_SET_THRESHOLD: Set error threshold
> * @XE_SYSCTRL_CMD_GET_PENDING_EVENT: Retrieve pending event
> */
> enum xe_sysctrl_gfsp_cmd {
> XE_SYSCTRL_CMD_GET_THRESHOLD = 0x05,
> + XE_SYSCTRL_CMD_SET_THRESHOLD = 0x06,
> XE_SYSCTRL_CMD_GET_PENDING_EVENT = 0x07,
> };
>
next prev parent reply other threads:[~2026-05-11 17:21 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-17 21:16 [PATCH v1 00/11] Introduce error threshold to drm_ras Raag Jadav
2026-04-17 21:16 ` [PATCH v1 01/11] drm/ras: Update counter helpers with counter naming Raag Jadav
2026-04-17 21:16 ` [PATCH v1 02/11] drm/ras: Introduce get-error-threshold Raag Jadav
2026-04-22 5:49 ` Tauro, Riana
2026-04-22 6:21 ` Raag Jadav
2026-04-17 21:16 ` [PATCH v1 03/11] drm/ras: Introduce set-error-threshold Raag Jadav
2026-04-22 6:12 ` Tauro, Riana
2026-04-17 21:16 ` [PATCH v1 04/11] drm/xe/uapi: Add additional error components to XE drm_ras Raag Jadav
2026-04-17 21:16 ` [PATCH v1 05/11] drm/xe/sysctrl: Add system controller interrupt handler Raag Jadav
2026-04-22 5:55 ` Tauro, Riana
2026-04-22 6:25 ` Raag Jadav
2026-04-17 21:16 ` [PATCH v1 06/11] drm/xe/sysctrl: Add system controller event support Raag Jadav
2026-04-17 21:16 ` [PATCH v1 07/11] drm/xe/ras: Introduce correctable error handling Raag Jadav
2026-04-17 21:16 ` [PATCH v1 08/11] drm/xe/ras: Get error threshold support Raag Jadav
2026-05-11 17:10 ` Tauro, Riana
2026-04-17 21:16 ` [PATCH v1 09/11] drm/xe/ras: Set " Raag Jadav
2026-05-11 17:21 ` Tauro, Riana [this message]
2026-04-17 21:16 ` [PATCH v1 10/11] drm/xe/drm_ras: Wire up error threshold callbacks Raag Jadav
2026-05-11 17:30 ` Tauro, Riana
2026-04-17 21:16 ` [PATCH v1 11/11] drm/xe/ras: Add flag for Xe RAS Raag Jadav
2026-04-30 14:24 ` Tauro, Riana
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=5e90b9aa-9432-43b5-ae40-1fce383bb043@intel.com \
--to=riana.tauro@intel.com \
--cc=Hawking.Zhang@amd.com \
--cc=airlied@gmail.com \
--cc=anoop.c.vijay@intel.com \
--cc=aravind.iddamsetty@linux.intel.com \
--cc=davem@davemloft.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=edumazet@google.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=kuba@kernel.org \
--cc=lijo.lazar@amd.com \
--cc=maarten@lankhorst.se \
--cc=mallesh.koujalagi@intel.com \
--cc=matthew.d.roper@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=raag.jadav@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=simona.vetter@ffwll.ch \
--cc=soham.purkait@intel.com \
--cc=umesh.nerlige.ramappa@intel.com \
--cc=zachary.mckevitt@oss.qualcomm.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