All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tauro, Riana" <riana.tauro@intel.com>
To: "Anoop, Vijay" <anoop.c.vijay@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: <umesh.nerlige.ramappa@intel.com>, <badal.nilawar@intel.com>,
	<anshuman.gupta@intel.com>, <michael.j.ruhl@intel.com>,
	<mohamed.mansoor.v@intel.com>
Subject: Re: [PATCH v2] drm/xe/sysctrl: Add helper to query application status
Date: Tue, 21 Apr 2026 21:40:25 +0530	[thread overview]
Message-ID: <9465afa9-e007-4908-9108-bf4dda8e4de1@intel.com> (raw)
In-Reply-To: <20260421153832.3785987-2-anoop.c.vijay@intel.com>


On 4/21/2026 9:08 PM, Anoop, Vijay wrote:
> From: Anoop Vijay <anoop.c.vijay@intel.com>
>
> Introduce xe_sysctrl_check_app_status() to query whether a sysctrl
> application is loaded and booted, returning error codes for not loaded
> or not booted states.
>
> Signed-off-by: Anoop Vijay <anoop.c.vijay@intel.com>
> ---
> v2: (Badal)
> - Return SysCtrl firmware application states instead of errno for application lifecycle conditions
> ---
>   drivers/gpu/drm/xe/abi/xe_sysctrl_abi.h | 44 +++++++++++++++++
>   drivers/gpu/drm/xe/xe_sysctrl.c         | 65 +++++++++++++++++++++++++
>   drivers/gpu/drm/xe/xe_sysctrl.h         |  1 +
>   3 files changed, 110 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/abi/xe_sysctrl_abi.h b/drivers/gpu/drm/xe/abi/xe_sysctrl_abi.h
> index 4cbde267ac44..8ed9ba791f3f 100644
> --- a/drivers/gpu/drm/xe/abi/xe_sysctrl_abi.h
> +++ b/drivers/gpu/drm/xe/abi/xe_sysctrl_abi.h
> @@ -62,4 +62,48 @@ struct xe_sysctrl_app_msg_hdr {
>   #define APP_HDR_VERSION_MASK		GENMASK(23, 16)
>   #define APP_HDR_RESERVED_MASK		GENMASK(31, 24)
>   
> +/** System Controller Core command group */
> +#define XE_SYSCTRL_GROUP_CORE		0xFF
> +
> +/*
> + * XE_SYSCTRL_CMD_GET_APP_STATUS - Query application status
> + *
> + * Check if a System Controller application is loaded and its status.
> + *
> + * Group: XE_SYSCTRL_GROUP_CORE (0xFF)
> + * Command: 0x04
> + */
> +#define XE_SYSCTRL_CMD_GET_APP_STATUS	0x04
> +
> +/**
> + * struct xe_sysctrl_get_app_status_req - Get application status request
> + * @app_name: Application name (16 bytes, null-terminated)
> + */
> +struct xe_sysctrl_get_app_status_req {
> +	char app_name[16];
> +} __packed;
> +
> +/**
> + * struct xe_sysctrl_get_app_status_resp - Get application status response
> + * @handle: Identifier used to control the app
> + * @flags: Application status flags (see XE_SYSCTRL_APP_* definitions)
> + */
> +struct xe_sysctrl_get_app_status_resp {
> +	u16 handle;
> +	u16 flags;
> +} __packed;
> +
> +/**
> + * DOC: System Controller Application Status Flags
> + *
> + * Flags returned in xe_sysctrl_get_app_status_resp indicating the
> + * current state of a System Controller application.
> + */
> +
> +enum xe_sysctrl_fw_status {
> +	XE_SYSCTRL_FIRMWARE_APP_NOT_LOADED = 0, /* Firmware application not loaded */
> +	XE_SYSCTRL_FIRMWARE_APP_LOADED,		/* Firmware application loaded, but not booted */
> +	XE_SYSCTRL_FIRMWARE_APP_BOOTED,		/* Firmware application booted */
> +};
> +
Any reason for adding the enums and structs in abi.h and not 
mailbox_types.h?
>   #endif
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl.c b/drivers/gpu/drm/xe/xe_sysctrl.c
> index 2bcef304eb9a..8d51f8cdaaa4 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl.c
> +++ b/drivers/gpu/drm/xe/xe_sysctrl.c
> @@ -14,8 +14,11 @@
>   #include "xe_soc_remapper.h"
>   #include "xe_sysctrl.h"
>   #include "xe_sysctrl_mailbox.h"
> +#include "xe_sysctrl_mailbox_types.h"
>   #include "xe_sysctrl_types.h"
>   
> +#define XE_SYSCTRL_APP_BOOTED	BIT(2)
> +
>   /**
>    * DOC: System Controller (sysctrl)
>    *
> @@ -99,3 +102,65 @@ void xe_sysctrl_pm_resume(struct xe_device *xe)
>   
>   	xe_sysctrl_mailbox_init(sc);
>   }
> +
> +/**
> + * xe_sysctrl_check_app_status - Check if System Controller app is loaded
> + * @xe: xe device instance
> + * @app_name: Name of the application to check (max 15 chars + null terminator)
> + *
> + * Query System Controller firmware to verify if the specified application
> + * is loaded and booted. This is typically required before sending commands
> + * to application-specific command groups.
> + *
> + * Common application names:
> + * - "ocode"- oCode
> + * - "diag" - Dianostics
typo. Use enum instead of strings
> + *
> + * Return: XE_SYSCTRL_FIRMWARE_APP_BOOTED if app is loaded and booted, error code otherwise:
> + *		-EOPNOTSUPP if System Controller is not available
> + *		-EINVAL if app_name is invalid
> + *		-EIO if communication with firmware failed
> + *		XE_SYSCTRL_FIRMWARE_APP_NOT_LOADED if application is not loaded
> + *		XE_SYSCTRL_FIRMWARE_APP_LOADED if application is loaded but not booted yet
Please don't mix. Either use the enum as return or error codes
> + */
> +int xe_sysctrl_check_app_status(struct xe_device *xe, const char *app_name)

Who is the caller for this. Please add the caller along with the function.

Thanks
Riana

> +{
> +	struct xe_sysctrl_get_app_status_req req = {};
> +	struct xe_sysctrl_get_app_status_resp resp = {};
> +	struct xe_sysctrl_mailbox_command cmd = {};
> +	size_t out_len = 0;
> +	u16 flags;
> +	int ret;
> +
> +	if (!xe->info.has_sysctrl)
> +		return -EOPNOTSUPP;
> +
> +	if (!app_name || strlen(app_name) == 0 || strlen(app_name) >= sizeof(req.app_name))
> +		return -EINVAL;
> +
> +	strscpy(req.app_name, app_name, sizeof(req.app_name));
> +
> +	cmd.header.data =
> +		cpu_to_le32(FIELD_PREP(APP_HDR_GROUP_ID_MASK, XE_SYSCTRL_GROUP_CORE) |
> +			    FIELD_PREP(APP_HDR_COMMAND_MASK, XE_SYSCTRL_CMD_GET_APP_STATUS) |
> +			    FIELD_PREP(APP_HDR_VERSION_MASK, 0));
> +
> +	cmd.data_in = &req;
> +	cmd.data_in_len = sizeof(req);
> +	cmd.data_out = &resp;
> +	cmd.data_out_len = sizeof(resp);
> +
> +	ret = xe_sysctrl_send_command(&xe->sc, &cmd, &out_len);
> +	if (ret)
> +		return XE_SYSCTRL_FIRMWARE_APP_NOT_LOADED;
> +
> +	if (out_len != sizeof(resp))
> +		return -EIO;
> +
> +	flags = le16_to_cpu(resp.flags);
> +
> +	if (!(flags & XE_SYSCTRL_APP_BOOTED))
> +		return XE_SYSCTRL_FIRMWARE_APP_LOADED;
> +
> +	return XE_SYSCTRL_FIRMWARE_APP_BOOTED;
> +}
> diff --git a/drivers/gpu/drm/xe/xe_sysctrl.h b/drivers/gpu/drm/xe/xe_sysctrl.h
> index f3b0f3716b2f..db2743d54cea 100644
> --- a/drivers/gpu/drm/xe/xe_sysctrl.h
> +++ b/drivers/gpu/drm/xe/xe_sysctrl.h
> @@ -18,5 +18,6 @@ static inline struct xe_device *sc_to_xe(struct xe_sysctrl *sc)
>   
>   int xe_sysctrl_init(struct xe_device *xe);
>   void xe_sysctrl_pm_resume(struct xe_device *xe);
> +int xe_sysctrl_check_app_status(struct xe_device *xe, const char *app_name);
>   
>   #endif

  parent reply	other threads:[~2026-04-21 16:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 15:38 [PATCH v2] drm/xe/sysctrl: Add helper to query application status Anoop, Vijay
2026-04-21 15:47 ` ✓ CI.KUnit: success for drm/xe/sysctrl: Add helper to query application status (rev2) Patchwork
2026-04-21 16:10 ` Tauro, Riana [this message]
2026-04-21 17:36 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-21 20:17 ` [PATCH v2] drm/xe/sysctrl: Add helper to query application status Nilawar, Badal
2026-04-21 20:36 ` ✗ Xe.CI.FULL: failure for drm/xe/sysctrl: Add helper to query application status (rev2) 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=9465afa9-e007-4908-9108-bf4dda8e4de1@intel.com \
    --to=riana.tauro@intel.com \
    --cc=anoop.c.vijay@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michael.j.ruhl@intel.com \
    --cc=mohamed.mansoor.v@intel.com \
    --cc=umesh.nerlige.ramappa@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 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.