All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anoop, Vijay" <anoop.c.vijay@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v6 2/3] drm/xe/sysctrl: Add RAS error injection debugfs interface
Date: Thu, 17 Sep 2026 19:39:42 +0000	[thread overview]
Message-ID: <20260917193942.8ED321F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260917193026.3234636-7-anoop.c.vijay@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] xe: missing little-endian conversion for RAS error injection payload
--

commit 7903eaec1791648b7046d617e95443efac765053
Author: Anoop Vijay <anoop.c.vijay@intel.com>

    drm/xe/sysctrl: Add RAS error injection debugfs interface
    
    Add debugfs interface for exercising System Controller's RAS error
    injection command, used to validate RAS error detection and recovery
    paths.

> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c b/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c
> index 6e96b1190e268..272e51f24f7bc 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_debugfs.c

[ ... ]

> +static int sysctrl_parse_ras_error_inject(struct xe_device *xe, char *tmp,
> +					  struct xe_sysctrl_diag_ras_err_inj_req *req)
> +{
> +	unsigned int nfields = 0;
> +	char *token;
> +	unsigned long val;
> +
> +	while ((token = strsep(&tmp, " \t\n")) != NULL) {
> +		if (*token == '\0')
> +			continue;
> +
> +		if (kstrtoul(token, 0, &val))
> +			goto inval;
> +
> +		switch (nfields) {
> +		case 0:
> +			if (val > U16_MAX)
> +				goto inval;
> +			req->ras_block_id = val;
> +			break;
> +		case 1:
> +			if (val > U16_MAX)
> +				goto inval;
> +			req->ras_sub_block_id = val;
> +			break;
> +		case 2:
> +			if (val > U16_MAX)
> +				goto inval;
> +			req->err_type = val;
> +			break;
> +		case 3:
> +			if (val > U32_MAX)
> +				goto inval;
> +			req->params = val;
> +			break;

[Severity: Medium]
Do these assignments need cpu_to_le16() and cpu_to_le32() conversions?

In sysctrl_parse_ras_error_inject(), host-native values are assigned
directly to the payload struct. When writing to the ras_error_inject
debugfs file on big-endian architectures, the RAS error injection payload
is sent to the firmware with swapped bytes. This would cause the firmware
to receive incorrect block IDs and parameters.

> +		default:
> +			xe_err(xe, "sysctrl: too many ras_error_inject arguments\n");
> +			return -EINVAL;
> +		}
> +		nfields++;
> +	}

[ ... ]

> diff --git a/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h b/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
> index 691a699667788..f658c9c54b49f 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h
> +++ b/drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h

[ ... ]

> +/**
> + * struct xe_sysctrl_diag_ras_err_inj_req - DIAG_RAS_ERR_INJECT request payload
> + *
> + * Request payload for XE_SYSCTRL_CMD_DIAG_RAS_ERR_INJECT. The mailbox layer
> + * prepends the application message header before sending.
> + *
> + * @ras_block_id: RAS block (subsystem) to inject the error into
> + * @ras_sub_block_id: RAS sub-block (IP) within @ras_block_id
> + * @err_type: Type of test error to inject
> + * @reserved: Must be zero
> + * @params: Optional injection parameters (default 0)
> + */
> +struct xe_sysctrl_diag_ras_err_inj_req {
> +	u16 ras_block_id;
> +	u16 ras_sub_block_id;
> +	u16 err_type;
> +	u16 reserved;
> +	u32 params;
> +} __packed;

[Severity: Medium]
Should these fields use __le16 and __le32 instead of u16 and u32?

The sysctrl mailbox interface expects little-endian data, but these hardware
payload fields are declared with host-native types in
struct xe_sysctrl_diag_ras_err_inj_req.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260917193026.3234636-5-anoop.c.vijay@intel.com?part=2

  reply	other threads:[~2026-09-17 19:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 19:30 [PATCH v6 0/3] drm/xe/sysctrl: Add System Controller debugfs Anoop, Vijay
2026-09-17 19:30 ` [PATCH v6 1/3] drm/xe/sysctrl: Add sysctrl debugfs infrastructure and loopback test interface Anoop, Vijay
2026-09-17 19:30 ` [PATCH v6 2/3] drm/xe/sysctrl: Add RAS error injection debugfs interface Anoop, Vijay
2026-09-17 19:39   ` sashiko-bot [this message]
2026-09-17 19:30 ` [PATCH v6 3/3] drm/xe/sysctrl: Add generic mailbox passthrough debugfs entry Anoop, Vijay
2026-09-17 19:59 ` ✗ CI.checkpatch: warning for drm/xe/sysctrl: Add System Controller debugfs (rev6) Patchwork
2026-09-17 20:01 ` ✓ CI.KUnit: success " Patchwork
2026-09-17 20:47 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-17 23:52 ` ✓ Xe.CI.FULL: " Patchwork

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=20260917193942.8ED321F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=anoop.c.vijay@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.