From: "Mallesh, Koujalagi" <mallesh.koujalagi@intel.com>
To: Badal Nilawar <badal.nilawar@intel.com>,
<intel-xe@lists.freedesktop.org>
Cc: <anshuman.gupta@intel.com>, <rodrigo.vivi@intel.com>,
<daniele.ceraolospurio@intel.com>, <raag.jadav@intel.com>,
<riana.tauro@intel.com>, <aravind.iddamsetty@intel.com>
Subject: Re: [RFC PATCH 3/7] drm/xe/xe_ras: Refactor get_counter() to return response structure
Date: Tue, 7 Jul 2026 18:23:10 +0530 [thread overview]
Message-ID: <8f12c08f-d874-40e0-b831-482fa89dcdf8@intel.com> (raw)
In-Reply-To: <20260702111401.3680214-12-badal.nilawar@intel.com>
On 02-07-2026 04:44 pm, Badal Nilawar wrote:
> Return the complete response structure from get_counter() instead of
> only the counter value. This allows callers to access additional
> response fields, such as has_info_queue for CPER record building.
>
> Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
> Assisted-by: Copilot:claude-sonnet-4.6
> ---
> drivers/gpu/drm/xe/xe_ras.c | 23 +++++++++++++++--------
> drivers/gpu/drm/xe/xe_ras_types.h | 10 ++++++++--
> 2 files changed, 23 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index 85b0202467f6..e594d4d3a23f 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c
> @@ -157,12 +157,12 @@ void xe_ras_counter_threshold_crossed(struct xe_device *xe,
> }
> }
>
> -static int get_counter(struct xe_device *xe, struct xe_ras_error_class *counter, u32 *value)
> +static int get_counter(struct xe_device *xe, const struct xe_ras_error_class *counter,
> + struct xe_ras_get_counter_response *out)
> {
> struct xe_ras_get_counter_response response = {0};
response is not required, we can directly use "out".
> struct xe_ras_get_counter_request request = {0};
> struct xe_sysctrl_mailbox_command command = {0};
> - struct xe_ras_error_common *common;
> size_t rlen;
> int ret;
>
> @@ -183,12 +183,11 @@ static int get_counter(struct xe_device *xe, struct xe_ras_error_class *counter,
> return -EIO;
> }
>
> - common = &response.counter.common;
> - *value = response.value;
> -
> - xe_dbg(xe, "[RAS]: get counter %u for %s %s\n", *value, comp_to_str(common->component),
> - sev_to_str(common->severity));
> + xe_dbg(xe, "[RAS]: get counter value %u for %s %s\n", response.value,
> + comp_to_str(response.counter.common.component),
> + sev_to_str(response.counter.common.severity));
>
> + *out = response;
> return 0;
> }
>
> @@ -207,12 +206,20 @@ static int get_counter(struct xe_device *xe, struct xe_ras_error_class *counter,
> int xe_ras_get_counter(struct xe_device *xe, u8 severity, u8 component, u32 *value)
> {
> struct xe_ras_error_class counter = {0};
> + struct xe_ras_get_counter_response response;
Safe to initialized response = {0}.
> + int ret;
>
> counter.common.severity = drm_to_xe_ras_severity(severity);
> counter.common.component = drm_to_xe_ras_component(component);
>
> guard(xe_pm_runtime)(xe);
> - return get_counter(xe, &counter, value);
> +
> + ret = get_counter(xe, &counter, &response);
> + if (ret)
> + return ret;
> +
> + *value = response.counter_value;
counter_value is not member of response. should get compilation error.
Thanks,
-/Mallesh
> + return 0;
> }
>
> /**
> diff --git a/drivers/gpu/drm/xe/xe_ras_types.h b/drivers/gpu/drm/xe/xe_ras_types.h
> index fc496888b3f8..befdaf297103 100644
> --- a/drivers/gpu/drm/xe/xe_ras_types.h
> +++ b/drivers/gpu/drm/xe/xe_ras_types.h
> @@ -155,8 +155,14 @@ struct xe_ras_get_counter_response {
> u64 timestamp;
> /** @threshold: Threshold value for the counter */
> u32 threshold;
> - /** @reserved: Reserved */
> - u32 reserved[57];
> + /** @reserved: Reserved for future use */
> + u32 reserved:9;
> + /** @has_info_queue: Set if info queue is available */
> + u32 has_info_queue:1;
> + /** @reserved1: Reserved for future use */
> + u32 reserved1:22;
> + /** @info_queue: Initial info queue data (first chunk) if available */
> + struct xe_ras_info_queue_response info_queue;
> } __packed;
>
> /**
next prev parent reply other threads:[~2026-07-07 12:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 11:14 [RFC PATCH 0/7] Add CPER logging support for CRI Badal Nilawar
2026-07-02 11:14 ` [RFC PATCH 1/7] drm/xe: Add error Signature IDs for RAS logging Badal Nilawar
2026-07-02 11:14 ` [RFC PATCH 2/7] drm/xe/xe_ras: Add support to retrieve info queue data for CRI Badal Nilawar
2026-07-07 12:29 ` Mallesh, Koujalagi
2026-07-02 11:14 ` [RFC PATCH 3/7] drm/xe/xe_ras: Refactor get_counter() to return response structure Badal Nilawar
2026-07-03 7:41 ` Tauro, Riana
2026-07-07 12:53 ` Mallesh, Koujalagi [this message]
2026-07-02 11:14 ` [RFC PATCH 4/7] drm/xe/cper: Add CPER structures and trace event Badal Nilawar
2026-07-02 11:14 ` [RFC PATCH 5/7] drm/xe/cper: APIs to prepare and log CPER record Badal Nilawar
2026-07-02 11:14 ` [RFC PATCH 6/7] drm/xe/cper: Prepare Intel CPER error info from info queue Badal Nilawar
2026-07-02 11:14 ` [RFC PATCH 7/7] drm/xe/cper: Log CPER record for correctable errors Badal Nilawar
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=8f12c08f-d874-40e0-b831-482fa89dcdf8@intel.com \
--to=mallesh.koujalagi@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=aravind.iddamsetty@intel.com \
--cc=badal.nilawar@intel.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=raag.jadav@intel.com \
--cc=riana.tauro@intel.com \
--cc=rodrigo.vivi@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