[PATCH v5 09/11] drm/xe/configfs: Check if device was preconfigured
Michal Wajdeczko
michal.wajdeczko at intel.com
Tue Jul 29 11:42:13 UTC 2025
Since device configuration using configfs could be prepared long
time prior the driver load, add a debug log whether the current
device driver probe is using custom or default settings.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Reviewed-by: John Harrison <John.C.Harrison at Intel.com>
---
v2: make function void, rename helpers (Lucas) and rebased
---
drivers/gpu/drm/xe/xe_configfs.c | 25 +++++++++++++++++++++++++
drivers/gpu/drm/xe/xe_configfs.h | 2 ++
drivers/gpu/drm/xe/xe_pci.c | 3 +++
3 files changed, 30 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
index 150e7f2becc8..5f145ccdf535 100644
--- a/drivers/gpu/drm/xe/xe_configfs.c
+++ b/drivers/gpu/drm/xe/xe_configfs.c
@@ -107,6 +107,11 @@ static void set_device_defaults(struct xe_config_device *config)
*config = device_defaults;
}
+static bool config_device_is_default(const struct xe_config_device *config)
+{
+ return !memcmp(config, &device_defaults, sizeof(*config));
+}
+
struct engine_info {
const char *cls;
u64 mask;
@@ -339,6 +344,26 @@ static struct xe_config_group_device *find_xe_config_group_device(struct pci_dev
return to_xe_config_group_device(item);
}
+/**
+ * xe_configfs_check_device() - Test if device was configured by configfs
+ * @pdev: the &pci_dev device to test
+ *
+ * Try to find the configfs group that belongs to the specified pci device
+ * and print a diagnostic message if found.
+ */
+void xe_configfs_check_device(struct pci_dev *pdev)
+{
+ struct xe_config_group_device *dev = find_xe_config_group_device(pdev);
+
+ if (!dev)
+ return;
+
+ pci_dbg(pdev, "found %s settings in configfs\n",
+ config_device_is_default(&dev->config) ? "default" : "custom");
+
+ config_group_put(&dev->group);
+}
+
/**
* xe_configfs_get_survivability_mode - get configfs survivability mode attribute
* @pdev: pci device
diff --git a/drivers/gpu/drm/xe/xe_configfs.h b/drivers/gpu/drm/xe/xe_configfs.h
index fb8764008089..fa4ea7f0c375 100644
--- a/drivers/gpu/drm/xe/xe_configfs.h
+++ b/drivers/gpu/drm/xe/xe_configfs.h
@@ -13,12 +13,14 @@ struct pci_dev;
#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);
void xe_configfs_clear_survivability_mode(struct pci_dev *pdev);
u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev);
#else
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; }
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index 52d46c66ae1e..9ce6e6dca5bc 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -17,6 +17,7 @@
#include "display/xe_display.h"
#include "regs/xe_gt_regs.h"
+#include "xe_configfs.h"
#include "xe_device.h"
#include "xe_drv.h"
#include "xe_gt.h"
@@ -771,6 +772,8 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
struct xe_device *xe;
int err;
+ xe_configfs_check_device(pdev);
+
if (desc->require_force_probe && !id_forced(pdev->device)) {
dev_info(&pdev->dev,
"Your graphics device %04x is not officially supported\n"
--
2.47.1
More information about the Intel-xe
mailing list