Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: "Summers, Stuart" <stuart.summers@intel.com>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Cc: "Tauro, Riana" <riana.tauro@intel.com>,
	"De Marchi, Lucas" <lucas.demarchi@intel.com>
Subject: Re: [PATCH 3/3] drm/xe/configfs: Don't expose survivability_mode if not applicable
Date: Tue, 2 Sep 2025 20:16:03 +0200	[thread overview]
Message-ID: <619ae479-8e0b-40ac-a1f4-a6086f19e896@intel.com> (raw)
In-Reply-To: <cb4d9b4ea275b9d8dfad37a7e078cea8477e9bda.camel@intel.com>



On 9/2/2025 7:25 PM, Summers, Stuart wrote:
> On Tue, 2025-09-02 at 15:17 +0200, Michal Wajdeczko wrote:
>> The survivability_mode attribute is applicable only for DGFX and
>> platforms newer than BATTLEMAGE. Use .is_visible() hook to hide
>> this attribute when above conditions are not met. Remove code that
>> was trying to fix such configuration during the runtime.
>>
>> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>> Cc: Riana Tauro <riana.tauro@intel.com>
>> ---
>>  drivers/gpu/drm/xe/xe_configfs.c           | 24 ++++++--------------
>> --
>>  drivers/gpu/drm/xe/xe_configfs.h           |  2 --
>>  drivers/gpu/drm/xe/xe_survivability_mode.c | 11 +---------
>>  3 files changed, 7 insertions(+), 30 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_configfs.c
>> b/drivers/gpu/drm/xe/xe_configfs.c
>> index 43f000260752..0337811864cd 100644
>> --- a/drivers/gpu/drm/xe/xe_configfs.c
>> +++ b/drivers/gpu/drm/xe/xe_configfs.c
>> @@ -369,7 +369,12 @@ static bool xe_config_device_is_visible(struct
>> config_item *item,
>>  {
>>         struct xe_config_group_device *dev =
>> to_xe_config_group_device(item);
>>  
>> -       return dev->desc; /* shall be always true */
>> +       if (attr == &attr_survivability_mode) {
>> +               if (!dev->desc->is_dgfx || dev->desc->platform <
>> XE_BATTLEMAGE)
>> +                       return false;
>> +       }
>> +
>> +       return true;
> 
> Why change the return here? Can we either leave this as dev->desc or
> otherwise use return true for the initial implementation (previous
> patch)?

the reason is simple: in patch 2/3 I just wanted to show how to obtain
the device xe device desc here to make some decisions based on that.

with plain "return true" in 2/3 I would have to mark desc var as "maybe_unused"

and OTOH leaving "return desc" here in 3/3 is redundant since we already might have de-referenced the pointer

so this one extra line in diff was IMO minimal cost to have two separate patches
(as I didn't want to combine survivability_mode change with introduction of is_visible)

> 
> Everything else in the series looks good to me. This does seem like a
> better way to approach this.

thanks,

> 
> Thanks,
> Stuart
> 
>>  }
>>  
>>  static struct configfs_group_operations xe_config_device_group_ops =
>> {
>> @@ -558,23 +563,6 @@ bool xe_configfs_get_survivability_mode(struct
>> pci_dev *pdev)
>>         return mode;
>>  }
>>  
>> -/**
>> - * xe_configfs_clear_survivability_mode - clear configfs
>> survivability mode
>> - * @pdev: pci device
>> - */
>> -void xe_configfs_clear_survivability_mode(struct pci_dev *pdev)
>> -{
>> -       struct xe_config_group_device *dev =
>> find_xe_config_group_device(pdev);
>> -
>> -       if (!dev)
>> -               return;
>> -
>> -       guard(mutex)(&dev->lock);
>> -       dev->config.survivability_mode = 0;
>> -
>> -       config_group_put(&dev->group);
>> -}
>> -
>>  /**
>>   * xe_configfs_get_engines_allowed - get engine allowed mask from
>> configfs
>>   * @pdev: pci device
>> diff --git a/drivers/gpu/drm/xe/xe_configfs.h
>> b/drivers/gpu/drm/xe/xe_configfs.h
>> index 58c8c3164000..1402e863b71c 100644
>> --- a/drivers/gpu/drm/xe/xe_configfs.h
>> +++ b/drivers/gpu/drm/xe/xe_configfs.h
>> @@ -15,7 +15,6 @@ 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);
>> -void xe_configfs_clear_survivability_mode(struct pci_dev *pdev);
>>  u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev);
>>  bool xe_configfs_get_psmi_enabled(struct pci_dev *pdev);
>>  #else
>> @@ -23,7 +22,6 @@ 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 void xe_configfs_clear_survivability_mode(struct
>> pci_dev *pdev) { }
>>  static inline u64 xe_configfs_get_engines_allowed(struct pci_dev
>> *pdev) { return U64_MAX; }
>>  static inline bool xe_configfs_get_psmi_enabled(struct pci_dev
>> *pdev) { return false; }
>>  #endif
>> diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.c
>> b/drivers/gpu/drm/xe/xe_survivability_mode.c
>> index 79426ea46861..19a1732e33d4 100644
>> --- a/drivers/gpu/drm/xe/xe_survivability_mode.c
>> +++ b/drivers/gpu/drm/xe/xe_survivability_mode.c
>> @@ -287,19 +287,10 @@ bool xe_survivability_mode_is_requested(struct
>> xe_device *xe)
>>         u32 data;
>>         bool survivability_mode;
>>  
>> -       if (!IS_DGFX(xe) || IS_SRIOV_VF(xe))
>> +       if (!IS_DGFX(xe) || IS_SRIOV_VF(xe) || xe->info.platform <
>> XE_BATTLEMAGE)
>>                 return false;
>>  
>>         survivability_mode =
>> xe_configfs_get_survivability_mode(pdev);
>> -
>> -       if (xe->info.platform < XE_BATTLEMAGE) {
>> -               if (survivability_mode) {
>> -                       dev_err(&pdev->dev, "Survivability Mode is
>> not supported on this card\n");
>> -                       xe_configfs_clear_survivability_mode(pdev);
>> -               }
>> -               return false;
>> -       }
>> -
>>         /* Enable survivability mode if set via configfs */
>>         if (survivability_mode)
>>                 return true;
> 


  reply	other threads:[~2025-09-02 18:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02 13:17 [PATCH 0/3] Allow to filter-out some configfs attrs Michal Wajdeczko
2025-09-02 13:17 ` [PATCH 1/3] drm/xe/configfs: Don't touch survivability_mode on fini Michal Wajdeczko
2025-09-02 16:37   ` Summers, Stuart
2025-09-02 18:04   ` Lucas De Marchi
2025-09-03  5:39     ` Riana Tauro
2025-09-03  5:49       ` Michal Wajdeczko
2025-09-03 17:50         ` Lucas De Marchi
2025-09-03 19:47           ` Michal Wajdeczko
2025-09-04  4:36             ` Riana Tauro
2025-09-04 10:35   ` [PATCH v2 " Michal Wajdeczko
2025-09-04 15:56     ` Lucas De Marchi
2025-09-09  5:16     ` Riana Tauro
2025-09-02 13:17 ` [PATCH 2/3] drm/xe/configfs: Prepare to filter-out configfs attributes Michal Wajdeczko
2025-09-02 13:17 ` [PATCH 3/3] drm/xe/configfs: Don't expose survivability_mode if not applicable Michal Wajdeczko
2025-09-02 17:25   ` Summers, Stuart
2025-09-02 18:16     ` Michal Wajdeczko [this message]
2025-09-02 18:19       ` Summers, Stuart
2025-09-02 18:10   ` Lucas De Marchi
2025-09-02 15:19 ` ✓ CI.KUnit: success for Allow to filter-out some configfs attrs Patchwork
2025-09-02 15:56 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-02 20:41 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-04 10:54 ` ✓ CI.KUnit: success for Allow to filter-out some configfs attrs (rev2) Patchwork
2025-09-04 11:30 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-04 23:14 ` ✗ Xe.CI.Full: failure " 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=619ae479-8e0b-40ac-a1f4-a6086f19e896@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=stuart.summers@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