From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Stuart Summers <stuart.summers@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <matthew.brost@intel.com>,
<umesh.nerlige.ramappa@intel.com>, <gustavo.sousa@intel.com>,
<matthew.d.roper@intel.com>, <daniele.ceraolospurio@intel.com>,
<shuicheng.lin@intel.com>
Subject: Re: [PATCH 05/15] drm/xe: Make survivability_mode configfs attribute a bitmap
Date: Tue, 13 Oct 2026 15:14:45 -0400 [thread overview]
Message-ID: <as6DJeimtHriaWle@intel.com> (raw)
In-Reply-To: <20261005220636.602826-22-stuart.summers@intel.com>
On Mon, Oct 05, 2026 at 10:06:41PM +0000, Stuart Summers wrote:
> Survivability mode is likely to grow additional independently selectable
> behaviors, so store it as a u8 bitmap rather than a bool. Only bit 0 is
> defined, so the accepted values are unchanged.
>
> Signed-off-by: Stuart Summers <stuart.summers@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Assisted-by: LLM
> ---
> drivers/gpu/drm/xe/xe_configfs.c | 25 +++++++++++++---------
> drivers/gpu/drm/xe/xe_configfs.h | 16 ++++++++++++--
> drivers/gpu/drm/xe/xe_survivability_mode.c | 7 +++---
> 3 files changed, 33 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
> index 0ccf163306fc..a16e2f48b01a 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.c
> +++ b/drivers/gpu/drm/xe/xe_configfs.c
> @@ -78,8 +78,10 @@
> * Survivability mode:
> * -------------------
> *
> - * Enable survivability mode on supported cards. This setting only takes
> - * effect when probing the device. Example to enable it::
> + * Enable survivability mode on supported cards. This is a bitmap; bit 0
> + * enables survivability mode and is currently the only bit defined, so the
> + * only accepted values remain 0 and 1. This setting only takes effect when
> + * probing the device. Example to enable it::
> *
> * # echo 1 > /sys/kernel/config/xe/0000:03:00.0/survivability_mode
> *
> @@ -301,7 +303,7 @@ struct xe_config_group_device {
> u32 migrate_ulls_period_ms;
> struct wa_bb ctx_restore_post_bb[XE_ENGINE_CLASS_MAX];
> struct wa_bb ctx_restore_mid_bb[XE_ENGINE_CLASS_MAX];
> - bool survivability_mode;
> + u8 survivability_mode;
> bool enable_psmi;
> bool enable_multi_queue;
> bool enable_vram_page_offline;
> @@ -323,7 +325,7 @@ static const struct xe_config_device device_defaults = {
> .gt_types_allowed = U64_MAX,
> .engines_allowed = U64_MAX,
> .migrate_ulls_period_ms = 5,
> - .survivability_mode = false,
> + .survivability_mode = 0,
> .enable_psmi = false,
> .enable_multi_queue = true,
> .enable_vram_page_offline = true,
> @@ -407,19 +409,22 @@ static ssize_t survivability_mode_show(struct config_item *item, char *page)
> {
> struct xe_config_device *dev = to_xe_config_device(item);
>
> - return sprintf(page, "%d\n", dev->survivability_mode);
> + return sprintf(page, "%u\n", dev->survivability_mode);
> }
>
> static ssize_t survivability_mode_store(struct config_item *item, const char *page, size_t len)
> {
> struct xe_config_group_device *dev = to_xe_config_group_device(item);
> - bool survivability_mode;
> + u8 survivability_mode;
> int ret;
>
> - ret = kstrtobool(page, &survivability_mode);
> + ret = kstrtou8(page, 0, &survivability_mode);
> if (ret)
> return ret;
>
> + if (survivability_mode & ~XE_CONFIGFS_SURVIVABILITY_MASK)
> + return -EINVAL;
> +
> guard(mutex)(&dev->lock);
> if (is_bound(dev))
> return -EBUSY;
> @@ -1243,7 +1248,7 @@ static void dump_custom_dev_config(struct pci_dev *pdev,
> PRI_CUSTOM_ATTR("%d", enable_multi_queue);
> PRI_CUSTOM_ATTR("%d", enable_psmi);
> PRI_CUSTOM_ATTR("%d", enable_vram_page_offline);
> - PRI_CUSTOM_ATTR("%d", survivability_mode);
> + PRI_CUSTOM_ATTR("%u", survivability_mode);
> PRI_CUSTOM_ATTR("%u", sriov.admin_only_pf);
>
> #undef PRI_CUSTOM_ATTR
> @@ -1278,10 +1283,10 @@ void xe_configfs_check_device(struct pci_dev *pdev)
> *
> * Return: survivability_mode attribute in configfs
> */
> -bool xe_configfs_get_survivability_mode(struct pci_dev *pdev)
> +u8 xe_configfs_get_survivability_mode(struct pci_dev *pdev)
> {
> struct xe_config_group_device *dev = find_xe_config_group_device(pdev);
> - bool mode;
> + u8 mode;
>
> if (!dev)
> return device_defaults.survivability_mode;
> diff --git a/drivers/gpu/drm/xe/xe_configfs.h b/drivers/gpu/drm/xe/xe_configfs.h
> index 1d538ce0ed2c..a5c081fc1672 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.h
> +++ b/drivers/gpu/drm/xe/xe_configfs.h
> @@ -5,6 +5,7 @@
> #ifndef _XE_CONFIGFS_H_
> #define _XE_CONFIGFS_H_
>
> +#include <linux/bits.h>
> #include <linux/limits.h>
> #include <linux/types.h>
>
> @@ -14,11 +15,22 @@
>
> struct pci_dev;
>
> +/**
> + * DOC: survivability_mode configfs bits
> + *
> + * The survivability_mode attribute is a bitmap so that additional
> + * survivability behaviors can be requested independently in the future.
> + * %XE_CONFIGFS_SURVIVABILITY_ENABLE is currently the only defined bit, so
> + * the attribute still only accepts 0 and 1.
> + */
> +#define XE_CONFIGFS_SURVIVABILITY_ENABLE BIT(0)
> +#define XE_CONFIGFS_SURVIVABILITY_MASK XE_CONFIGFS_SURVIVABILITY_ENABLE
> +
> #if IS_ENABLED(CONFIG_CONFIGFS_FS)
> int xe_configfs_init(void);
> void xe_configfs_exit(void);
> void xe_configfs_check_device(struct pci_dev *pdev);
> -bool xe_configfs_get_survivability_mode(struct pci_dev *pdev);
> +u8 xe_configfs_get_survivability_mode(struct pci_dev *pdev);
> bool xe_configfs_primary_gt_allowed(struct pci_dev *pdev);
> bool xe_configfs_media_gt_allowed(struct pci_dev *pdev);
> u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev);
> @@ -40,7 +52,7 @@ bool xe_configfs_admin_only_pf(struct pci_dev *pdev);
> static inline int xe_configfs_init(void) { return 0; }
> static inline void xe_configfs_exit(void) { }
> static inline void xe_configfs_check_device(struct pci_dev *pdev) { }
> -static inline bool xe_configfs_get_survivability_mode(struct pci_dev *pdev) { return false; }
> +static inline u8 xe_configfs_get_survivability_mode(struct pci_dev *pdev) { return 0; }
> static inline bool xe_configfs_primary_gt_allowed(struct pci_dev *pdev) { return true; }
> static inline bool xe_configfs_media_gt_allowed(struct pci_dev *pdev) { return true; }
> static inline u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev) { return U64_MAX; }
> diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.c b/drivers/gpu/drm/xe/xe_survivability_mode.c
> index 45d44ebe288b..3b96097f6ee6 100644
> --- a/drivers/gpu/drm/xe/xe_survivability_mode.c
> +++ b/drivers/gpu/drm/xe/xe_survivability_mode.c
> @@ -306,7 +306,8 @@ static const struct attribute_group survivability_info_group = {
> static int create_survivability_sysfs(struct pci_dev *pdev)
> {
> /* Survivability info is required if not enabled via configfs */
> - bool needs_info = !xe_configfs_get_survivability_mode(pdev);
> + bool needs_info = !(xe_configfs_get_survivability_mode(pdev) &
> + XE_CONFIGFS_SURVIVABILITY_ENABLE);
> struct xe_device *xe = pdev_to_xe_device(pdev);
> struct device *dev = &pdev->dev;
> int ret;
> @@ -405,14 +406,14 @@ bool xe_survivability_mode_is_requested(struct xe_device *xe)
> struct xe_mmio *mmio = xe_root_tile_mmio(xe);
> struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
> u32 data;
> - bool survivability_mode;
> + u8 survivability_mode;
>
> if (!IS_DGFX(xe) || IS_SRIOV_VF(xe) || xe->info.platform < XE_BATTLEMAGE)
> return false;
>
> survivability_mode = xe_configfs_get_survivability_mode(pdev);
> /* Enable survivability mode if set via configfs */
> - if (survivability_mode)
> + if (survivability_mode & XE_CONFIGFS_SURVIVABILITY_ENABLE)
> return true;
>
> data = xe_mmio_read32(mmio, PCODE_SCRATCH(0));
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-10-13 19:15 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 22:06 [PATCH 00/15] Add new debug infrastructure for configfs Stuart Summers
2026-10-05 22:06 ` [PATCH 01/15] drm/xe: Guard configfs attribute reads in getters Stuart Summers
2026-10-05 22:06 ` [PATCH 02/15] drm/xe/configfs: Fix out-of-bounds read in parse_wa_bb_lines() Stuart Summers
2026-10-13 19:08 ` Rodrigo Vivi
2026-10-05 22:06 ` [PATCH 03/15] drm/xe/configfs: Copy wa_bb out under the configfs lock Stuart Summers
2026-10-13 19:10 ` Rodrigo Vivi
2026-10-13 20:35 ` Summers, Stuart
2026-10-05 22:06 ` [PATCH 04/15] drm/xe: Invert vram_page_offline configfs attribute Stuart Summers
2026-10-13 19:13 ` Rodrigo Vivi
2026-10-05 22:06 ` [PATCH 05/15] drm/xe: Make survivability_mode configfs attribute a bitmap Stuart Summers
2026-10-13 19:14 ` Rodrigo Vivi [this message]
2026-10-05 22:06 ` [PATCH 06/15] drm/xe: Sort xe_config_device fields Stuart Summers
2026-10-05 22:06 ` [PATCH 07/15] drm/xe: Split out configfs data structures Stuart Summers
2026-10-05 22:06 ` [PATCH 08/15] drm/xe: Add a new debug focused configfs group Stuart Summers
2026-10-05 22:06 ` [PATCH 09/15] drm/xe: Move debug configfs entries to xe_configfs_debug.c Stuart Summers
2026-10-13 19:16 ` Rodrigo Vivi
2026-10-05 22:06 ` [PATCH 10/15] drm/xe/guc: Add configfs support for guc_log_level Stuart Summers
2026-10-05 22:06 ` [PATCH 11/15] drm/xe/guc: Add support for NPK as a GuC log target Stuart Summers
2026-10-05 22:06 ` [PATCH 12/15] drm/xe: Add infrastructure for debug configfs parameters Stuart Summers
2026-10-05 22:06 ` [PATCH 13/15] drm/xe: Migrate existing debug configfs entries to params infrastructure Stuart Summers
2026-10-05 22:06 ` [PATCH 14/15] drm/xe: Taint kernel when debug configfs parameters are set Stuart Summers
2026-10-05 22:06 ` [PATCH 15/15] drm/xe: Add enable_media module parameter Stuart Summers
2026-10-05 22:13 ` ✗ CI.checkpatch: warning for Add new debug infrastructure for configfs (rev10) Patchwork
2026-10-05 22:15 ` ✓ CI.KUnit: success " Patchwork
2026-10-05 23:17 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-06 6:22 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-10-07 19:13 ` Summers, Stuart
-- strict thread matches above, loose matches on Subject: below --
2026-10-05 19:06 [PATCH 00/15] Add new debug infrastructure for configfs Stuart Summers
2026-10-05 19:06 ` [PATCH 05/15] drm/xe: Make survivability_mode configfs attribute a bitmap Stuart Summers
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=as6DJeimtHriaWle@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=gustavo.sousa@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=matthew.d.roper@intel.com \
--cc=shuicheng.lin@intel.com \
--cc=stuart.summers@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox