Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6D667C87FCF for ; Sun, 27 Jul 2025 17:20:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 33D2510E317; Sun, 27 Jul 2025 17:20:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="BMaf9zeQ"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id B701210E3D9 for ; Sun, 27 Jul 2025 17:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1753636832; x=1785172832; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6KX+tpE5Vhq7T4VMHQl/25PJdsC3oHthZuUTV6U3jQI=; b=BMaf9zeQlfZz4Df160OxM/QZIDp8RSQNVgUvvgLpN8iL42IYEstLLXEp Whys/gzh3NerA7IofvrcrizlQQ83ScvZ4WAUcc/QQAzfkUEvYyVeJoW3I CnmRUuU6mOBuo/pSpx23ImYutLi2Sipd0gjvOhbTFOmauZyaDeHjm0kyG RG1eSOIXEm2gydbtEWGRDtBPNJ2gKiEM9b2y5lQX+Xfh0RbWNG5cqP6wx K2hc32OwL/lHy9d0wrmGvGCHHqmpr1vbQkNQ+r/odBgquWwrXuaQ1wtpf nwW9tclWVm8zcIlS5fWvAI5n2Tu+ZHRGq/ISKYmeThOgdPIYugEMG1nNx Q==; X-CSE-ConnectionGUID: CfDCm9v9Rr+R0RZJJ7ZgEg== X-CSE-MsgGUID: vHuHdNMWTYKbPHIXRr9azg== X-IronPort-AV: E=McAfee;i="6800,10657,11504"; a="56046734" X-IronPort-AV: E=Sophos;i="6.16,339,1744095600"; d="scan'208";a="56046734" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2025 10:20:32 -0700 X-CSE-ConnectionGUID: 2QmexpXpRkGbUd1rfaBWDA== X-CSE-MsgGUID: VaX85cf5TD61HN87d8fYIA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,339,1744095600"; d="scan'208";a="167556847" Received: from bjanicki-mobl2.ger.corp.intel.com (HELO mwajdecz-hp.clients.intel.com) ([10.246.2.202]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2025 10:20:30 -0700 From: Michal Wajdeczko To: intel-xe@lists.freedesktop.org Cc: Michal Wajdeczko , Lucas De Marchi Subject: [PATCH v4 09/11] drm/xe/configfs: Check if device was preconfigured Date: Sun, 27 Jul 2025 19:20:06 +0200 Message-ID: <20250727172009.587-10-michal.wajdeczko@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250727172009.587-1-michal.wajdeczko@intel.com> References: <20250727172009.587-1-michal.wajdeczko@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" 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 Cc: Lucas De Marchi --- 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 60d89d3ef656..73fb6812efe0 100644 --- a/drivers/gpu/drm/xe/xe_configfs.c +++ b/drivers/gpu/drm/xe/xe_configfs.c @@ -108,6 +108,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; @@ -333,6 +338,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