Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F95A606A31A for ; Mon, 30 Nov 2026 23:25:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=LERcob+0 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D539210F565; Mon, 30 Nov 2026 23:25:30 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 54E3510E295 for ; Mon, 30 Nov 2026 23:24:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796081096; x=1827617096; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zoamBhOVBu1PFRvfjk+fK2TayTALTXG9qf32bSu9CUo=; b=LERcob+0B8eNsbHSzKqXaMRnTdsoTyB9/hR1ubWnbtwSoByuShJCRoyY xRBRDYxDvblWX8Gnk+C6+UZPubsIv0dWjEt/Xec5ggDDz44EJ3oFi6aS+ YxiMHXCq4YKzj4GRKXusubKEVT9sp+iYud5Mo7Gg9slr2ruusVPT1hR4V nwJwq+rRJp/2749bgYIrfPgAWS/WVPp6u7v06W35nQIqLMeoNi4WvNGHJ nVMObFZCpPNRYEDABC67wIY+OfUxYadrCCxpi6QQ4Ab71DwtFR9Q0IfOi kfJSPwfHMlVRaUTci6QzSfoeq0jrXKo8u1KxSuXa1Fl+wdqfAifFUFS0j A==; X-CSE-ConnectionGUID: f00njTA3TRSWFZ7Wf+9tAQ== X-CSE-MsgGUID: rT1GZP8mRseWttPnB4jr+g== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4935710" X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="4935710" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 15:24:41 -0800 X-CSE-ConnectionGUID: Ytyvaos+QRO8Bj4M+CCFlA== X-CSE-MsgGUID: 8sCuNuR1SPuUGfNaE3n+oQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="13562134" Received: from dut4599nvls.fm.intel.com ([10.80.95.137]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 15:24:41 -0800 From: Stuart Summers To: Cc: intel-xe@lists.freedesktop.org, rodrigo.vivi@intel.com, matthew.d.roper@intel.com, gustavo.sousa@intel.com, Stuart Summers Subject: [PATCH 6/8] drm/xe: Sort xe_config_device fields Date: Mon, 30 Nov 2026 23:24:44 +0000 Message-ID: <20261130232438.584409-16-stuart.summers@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261130232438.584409-10-stuart.summers@intel.com> References: <20261130232438.584409-10-stuart.summers@intel.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 As we're planning more configfs entries over time, let's add some sorting rules to make sure this stays clean and easy to manage. Sorting first by type and then name for readability. The documentation block is sorted alphabetically by attribute name instead, since there is no type information to group by there. Signed-off-by: Stuart Summers Reviewed-by: Gustavo Sousa --- drivers/gpu/drm/xe/xe_configfs.c | 1827 +++++++++++++++--------------- drivers/gpu/drm/xe/xe_configfs.h | 18 +- 2 files changed, 930 insertions(+), 915 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c index dbb5e163e41a..a5ccd207bc6e 100644 --- a/drivers/gpu/drm/xe/xe_configfs.c +++ b/drivers/gpu/drm/xe/xe_configfs.c @@ -58,12 +58,16 @@ * │   └── ... * : * └── 0000:03:00.0 - * ├── survivability_mode - * ├── gt_types_allowed + * ├── ctx_restore_mid_bb + * ├── ctx_restore_post_bb + * ├── enable_multi_queue + * ├── enable_psmi + * ├── enable_vram_page_offline * ├── engines_allowed + * ├── force_ocode_load + * ├── gt_types_allowed * ├── migrate_ulls_period_ms - * ├── enable_psmi - * └── enable_vram_page_offline + * └── survivability_mode * * After configuring the attributes as per next section, the device can be * probed with:: @@ -75,62 +79,93 @@ * Configure Attributes * ==================== * - * Survivability mode: - * ------------------- + * Context restore BB + * ------------------ * - * 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:: + * Allow to execute a batch buffer during any context switches. When the + * GPU is restoring the context, it executes additional commands. It's useful + * for testing additional workarounds and validating certain HW behaviors: it's + * not intended for normal execution and will taint the kernel with TAINT_TEST + * when used. * - * # echo 1 > /sys/kernel/config/xe/0000:03:00.0/survivability_mode + * The syntax allows to pass straight instructions to be executed by the engine + * in a batch buffer or set specific registers. * - * This attribute can only be set before binding to the device. + * #. Generic instruction:: * - * Force OCODE load: - * ----------------- + * cmd [[dword0] [dword1] [...]] * - * With CONFIG_DRM_XE_DEBUG enabled, force an OCODE load at probe and resume - * even if OCODE is already running. This attribute can only be set before - * binding. + * #. Simple register setting:: * - * Allowed GT types: - * ----------------- + * reg
* - * Allow only specific types of GTs to be detected and initialized by the - * driver. Any combination of GT types can be enabled/disabled, although - * some settings will cause the device to fail to probe. + * Commands are saved per engine class: all instances of that class will execute + * those commands during context switch. The instruction, dword arguments, + * addresses and values are in hex format like in the examples below. * - * Writes support both comma- and newline-separated input format. Reads - * will always return one GT type per line. "primary" and "media" are the - * GT type names supported by this interface. + * #. Execute a LRI command to write 0xDEADBEEF to register 0x4f10 after the + * normal context restore:: + * + * # echo 'rcs cmd 11000001 4F100 DEADBEEF' \ + * > /sys/kernel/config/xe/0000:03:00.0/ctx_restore_post_bb + * + * #. Execute a LRI command to write 0xDEADBEEF to register 0x4f10 at the + * beginning of the context restore:: + * + * # echo 'rcs cmd 11000001 4F100 DEADBEEF' \ + * > /sys/kernel/config/xe/0000:03:00.0/ctx_restore_mid_bb + + * #. Load certain values in a couple of registers (it can be used as a simpler + * alternative to the `cmd`) action:: + * + * # cat > /sys/kernel/config/xe/0000:03:00.0/ctx_restore_post_bb < /sys/kernel/config/xe/0000:03:00.0/enable_multi_queue * * This attribute can only be set before binding to the device. * - * Examples: + * PSMI + * ---- * - * Allow both primary and media GTs to be initialized and used. This matches - * the driver's default behavior:: + * Enable extra debugging capabilities to trace engine execution. Only useful + * during early platform enabling and requires additional hardware connected. + * Once it's enabled, additionals WAs are added and runtime configuration is + * done via debugfs. Example to enable it:: * - * # echo 'primary,media' > /sys/kernel/config/xe/0000:03:00.0/gt_types_allowed + * # echo 1 > /sys/kernel/config/xe/0000:03:00.0/enable_psmi * - * Allow only the primary GT of each tile to be initialized and used, - * effectively disabling the media GT if it exists on the platform:: + * This attribute can only be set before binding to the device. * - * # echo 'primary' > /sys/kernel/config/xe/0000:03:00.0/gt_types_allowed + * Enable VRAM page offline: + * ------------------------- * - * Allow only the media GT of each tile to be initialized and used, - * effectively disabling the primary GT. **This configuration will cause - * device probe failure on all current platforms, but may be allowed on - * igpu platforms in the future**:: + * 0, n, N, false - Disable vram page offline (Logging only) + * 1, y, Y, true - Enable vram page offline (Offlining is active - default) * - * # echo 'media' > /sys/kernel/config/xe/0000:03:00.0/gt_types_allowed + * Example to disable VRAM offline:: * - * Disable all GTs. Only other GPU IP (such as display) is potentially usable. - * **This configuration will cause device probe failure on all current - * platforms, but may be allowed on igpu platforms in the future**:: + * # echo 0 > /sys/kernel/config/xe/0000:03:00.0/enable_vram_page_offline * - * # echo '' > /sys/kernel/config/xe/0000:03:00.0/gt_types_allowed + * This attribute can only be set on CRI before binding to the device. * * Allowed engines: * ---------------- @@ -158,81 +193,76 @@ * * This attribute can only be set before binding to the device. * - * PSMI - * ---- - * - * Enable extra debugging capabilities to trace engine execution. Only useful - * during early platform enabling and requires additional hardware connected. - * Once it's enabled, additionals WAs are added and runtime configuration is - * done via debugfs. Example to enable it:: + * Force OCODE load: + * ----------------- * - * # echo 1 > /sys/kernel/config/xe/0000:03:00.0/enable_psmi + * With CONFIG_DRM_XE_DEBUG enabled, force an OCODE load at probe and resume + * even if OCODE is already running. This attribute can only be set before + * binding. * - * This attribute can only be set before binding to the device. + * Allowed GT types: + * ----------------- * - * Enable VRAM page offline: - * ------------------------- + * Allow only specific types of GTs to be detected and initialized by the + * driver. Any combination of GT types can be enabled/disabled, although + * some settings will cause the device to fail to probe. * - * 0, n, N, false - Disable vram page offline (Logging only) - * 1, y, Y, true - Enable vram page offline (Offlining is active - default) + * Writes support both comma- and newline-separated input format. Reads + * will always return one GT type per line. "primary" and "media" are the + * GT type names supported by this interface. * - * Example to disable VRAM offline:: + * This attribute can only be set before binding to the device. * - * # echo 0 > /sys/kernel/config/xe/0000:03:00.0/enable_vram_page_offline + * Examples: * - * This attribute can only be set on CRI before binding to the device. + * Allow both primary and media GTs to be initialized and used. This matches + * the driver's default behavior:: * - * Context restore BB - * ------------------ + * # echo 'primary,media' > /sys/kernel/config/xe/0000:03:00.0/gt_types_allowed * - * Allow to execute a batch buffer during any context switches. When the - * GPU is restoring the context, it executes additional commands. It's useful - * for testing additional workarounds and validating certain HW behaviors: it's - * not intended for normal execution and will taint the kernel with TAINT_TEST - * when used. + * Allow only the primary GT of each tile to be initialized and used, + * effectively disabling the media GT if it exists on the platform:: * - * The syntax allows to pass straight instructions to be executed by the engine - * in a batch buffer or set specific registers. + * # echo 'primary' > /sys/kernel/config/xe/0000:03:00.0/gt_types_allowed * - * #. Generic instruction:: + * Allow only the media GT of each tile to be initialized and used, + * effectively disabling the primary GT. **This configuration will cause + * device probe failure on all current platforms, but may be allowed on + * igpu platforms in the future**:: * - * cmd [[dword0] [dword1] [...]] + * # echo 'media' > /sys/kernel/config/xe/0000:03:00.0/gt_types_allowed * - * #. Simple register setting:: + * Disable all GTs. Only other GPU IP (such as display) is potentially usable. + * **This configuration will cause device probe failure on all current + * platforms, but may be allowed on igpu platforms in the future**:: * - * reg
+ * # echo '' > /sys/kernel/config/xe/0000:03:00.0/gt_types_allowed * - * Commands are saved per engine class: all instances of that class will execute - * those commands during context switch. The instruction, dword arguments, - * addresses and values are in hex format like in the examples below. + * Migrate ULLS Period (ms) + * ------------------------ * - * #. Execute a LRI command to write 0xDEADBEEF to register 0x4f10 after the - * normal context restore:: + * Migrate ULLS period, in milliseconds. This is the delay between entering + * migrate ULLS (a continuously running batch) and exiting it. Migrate ULLS is + * currently entered during page faults and SVM prefetch operations. Default 5, + * zero indicates ULLS is disabled. * - * # echo 'rcs cmd 11000001 4F100 DEADBEEF' \ - * > /sys/kernel/config/xe/0000:03:00.0/ctx_restore_post_bb + * How to disable migration ULLS: * - * #. Execute a LRI command to write 0xDEADBEEF to register 0x4f10 at the - * beginning of the context restore:: + * # echo 0 > /sys/kernel/config/xe/0000:03:00.0/migrate_ulls_period_ms * - * # echo 'rcs cmd 11000001 4F100 DEADBEEF' \ - * > /sys/kernel/config/xe/0000:03:00.0/ctx_restore_mid_bb - - * #. Load certain values in a couple of registers (it can be used as a simpler - * alternative to the `cmd`) action:: + * This attribute can only be set before binding to the device. * - * # cat > /sys/kernel/config/xe/0000:03:00.0/ctx_restore_post_bb < /sys/kernel/config/xe/0000:03:00.0/survivability_mode * - * Currently this is implemented only for post and mid context restore and - * these attributes can only be set before binding to the device. + * This attribute can only be set before binding to the device. * * Max SR-IOV Virtual Functions * ---------------------------- @@ -260,32 +290,6 @@ * * This setting only takes effect when probing the device. * - * Enable multi-queue - * ------------------ - * - * Multi-queue support on the device is enabled by default where the - * hardware supports it. Writing 0 force-disables multi-queue support: - * multi-queue exec-queue group creation via ioctl is refused, and the - * GuC feature is disabled:: - * - * # echo 0 > /sys/kernel/config/xe/0000:03:00.0/enable_multi_queue - * - * This attribute can only be set before binding to the device. - * - * Migrate ULLS Period (ms) - * ------------------------ - * - * Migrate ULLS period, in milliseconds. This is the delay between entering - * migrate ULLS (a continuously running batch) and exiting it. Migrate ULLS is - * currently entered during page faults and SVM prefetch operations. Default 5, - * zero indicates ULLS is disabled. - * - * How to disable migration ULLS: - * - * # echo 0 > /sys/kernel/config/xe/0000:03:00.0/migrate_ulls_period_ms - * - * This attribute can only be set before binding to the device. - * * Remove devices * ============== * @@ -304,17 +308,22 @@ struct xe_config_group_device { struct config_group group; struct config_group sriov; + /* + * Fields sorted by type (largest first) then name: struct arrays, + * u64, u32/unsigned int, u8, bool, sub-structs last. Within each + * type, entries are sorted alphabetically. + */ struct xe_config_device { - u64 gt_types_allowed; + struct wa_bb ctx_restore_mid_bb[XE_ENGINE_CLASS_MAX]; + struct wa_bb ctx_restore_post_bb[XE_ENGINE_CLASS_MAX]; u64 engines_allowed; + u64 gt_types_allowed; 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]; u8 survivability_mode; - bool force_ocode_load; - bool enable_psmi; bool enable_multi_queue; + bool enable_psmi; bool enable_vram_page_offline; + bool force_ocode_load; struct { unsigned int max_vfs; bool admin_only_pf; @@ -330,14 +339,14 @@ struct xe_config_group_device { }; static const struct xe_config_device device_defaults = { - .gt_types_allowed = U64_MAX, .engines_allowed = U64_MAX, + .gt_types_allowed = U64_MAX, .migrate_ulls_period_ms = 5, .survivability_mode = 0, - .force_ocode_load = false, - .enable_psmi = false, .enable_multi_queue = true, + .enable_psmi = false, .enable_vram_page_offline = true, + .force_ocode_load = false, .sriov = { .max_vfs = XE_DEFAULT_MAX_VFS, .admin_only_pf = XE_DEFAULT_ADMIN_ONLY_PF, @@ -414,435 +423,188 @@ static bool is_bound(struct xe_config_group_device *dev) return ret; } -static ssize_t survivability_mode_show(struct config_item *item, char *page) -{ - struct xe_config_device *dev = to_xe_config_device(item); +static struct xe_config_group_device *find_xe_config_group_device(struct pci_dev *pdev); - return sprintf(page, "%u\n", dev->survivability_mode); -} - -static ssize_t survivability_mode_store(struct config_item *item, const char *page, size_t len) +/** + * xe_configfs_get_ctx_restore_mid_bb - get configfs ctx_restore_mid_bb setting + * @pdev: pci device + * @class: hw engine class + * @cs: destination buffer for the batch, or NULL to only query the length + * @max_len: capacity of @cs, in dwords + * + * Copy the configured batch into @cs while holding the configfs lock, so the + * caller never gets a pointer to storage owned by the configfs group. + * + * Return: Number of dwords used in the mid_ctx_restore setting in configfs, or + * -ENOSPC if it does not fit in @max_len + */ +ssize_t xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev, + enum xe_engine_class class, + u32 *cs, size_t max_len) { - struct xe_config_group_device *dev = to_xe_config_group_device(item); - u8 survivability_mode; - int ret; - - ret = kstrtou8(page, 0, &survivability_mode); - if (ret) - return ret; - - if (survivability_mode & ~XE_CONFIGFS_SURVIVABILITY_MASK) - return -EINVAL; + struct xe_config_group_device *dev = find_xe_config_group_device(pdev); + ssize_t len; - guard(mutex)(&dev->lock); - if (is_bound(dev)) - return -EBUSY; + if (!dev) + return 0; - dev->config.survivability_mode = survivability_mode; + scoped_guard(mutex, &dev->lock) { + len = dev->config.ctx_restore_mid_bb[class].len; + if (cs && len) { + if (len > max_len) + len = -ENOSPC; + else + memcpy(cs, dev->config.ctx_restore_mid_bb[class].cs, + len * sizeof(u32)); + } + } + config_group_put(&dev->group); return len; } -static ssize_t force_ocode_load_show(struct config_item *item, char *page) -{ - struct xe_config_device *dev = to_xe_config_device(item); - - return sprintf(page, "%d\n", dev->force_ocode_load); -} - -static ssize_t force_ocode_load_store(struct config_item *item, const char *page, size_t len) +/** + * xe_configfs_get_ctx_restore_post_bb - get configfs ctx_restore_post_bb setting + * @pdev: pci device + * @class: hw engine class + * @cs: destination buffer for the batch, or NULL to only query the length + * @max_len: capacity of @cs, in dwords + * + * Copy the configured batch into @cs while holding the configfs lock, so the + * caller never gets a pointer to storage owned by the configfs group. + * + * Return: Number of dwords used in the post_ctx_restore setting in configfs, or + * -ENOSPC if it does not fit in @max_len + */ +ssize_t xe_configfs_get_ctx_restore_post_bb(struct pci_dev *pdev, + enum xe_engine_class class, + u32 *cs, size_t max_len) { - struct xe_config_group_device *dev = to_xe_config_group_device(item); - bool force_load; - int ret; - - ret = kstrtobool(page, &force_load); - if (ret) - return ret; + struct xe_config_group_device *dev = find_xe_config_group_device(pdev); + ssize_t len; - guard(mutex)(&dev->lock); - if (is_bound(dev)) - return -EBUSY; + if (!dev) + return 0; - dev->config.force_ocode_load = force_load; + scoped_guard(mutex, &dev->lock) { + len = dev->config.ctx_restore_post_bb[class].len; + if (cs && len) { + if (len > max_len) + len = -ENOSPC; + else + memcpy(cs, dev->config.ctx_restore_post_bb[class].cs, + len * sizeof(u32)); + } + } + config_group_put(&dev->group); return len; } -static ssize_t gt_types_allowed_show(struct config_item *item, char *page) +static bool wa_bb_read_advance(bool dereference, char **p, + const char *append, size_t len, + size_t *max_size) { - struct xe_config_device *dev = to_xe_config_device(item); - char *p = page; + if (dereference) { + if (len >= *max_size) + return false; + *max_size -= len; + if (append) + memcpy(*p, append, len); + } - for (size_t i = 0; i < ARRAY_SIZE(gt_types); i++) - if (dev->gt_types_allowed & BIT_ULL(gt_types[i].type)) - p += sprintf(p, "%s\n", gt_types[i].name); + *p += len; - return p - page; + return true; } -static ssize_t gt_types_allowed_store(struct config_item *item, const char *page, - size_t len) +static ssize_t wa_bb_show(struct xe_config_group_device *dev, + struct wa_bb wa_bb[static XE_ENGINE_CLASS_MAX], + char *data, size_t sz) { - struct xe_config_group_device *dev = to_xe_config_group_device(item); - char *buf __free(kfree) = kstrdup(page, GFP_KERNEL); - char *p = buf; - u64 typemask = 0; + char *p = data; - if (!buf) - return -ENOMEM; + guard(mutex)(&dev->lock); - while (p) { - char *typename = strsep(&p, ",\n"); - bool matched = false; + for (size_t i = 0; i < ARRAY_SIZE(engine_info); i++) { + enum xe_engine_class ec = engine_info[i].engine_class; + size_t len; - if (typename[0] == '\0') + if (!wa_bb[ec].len) continue; - for (size_t i = 0; i < ARRAY_SIZE(gt_types); i++) { - if (strcmp(typename, gt_types[i].name) == 0) { - typemask |= BIT(gt_types[i].type); - matched = true; - break; - } + len = snprintf(p, sz, "%s:", engine_info[i].cls); + if (!wa_bb_read_advance(data, &p, NULL, len, &sz)) + return -ENOBUFS; + + for (size_t j = 0; j < wa_bb[ec].len; j++) { + len = snprintf(p, sz, " %08x", wa_bb[ec].cs[j]); + if (!wa_bb_read_advance(data, &p, NULL, len, &sz)) + return -ENOBUFS; } - if (!matched) - return -EINVAL; + if (!wa_bb_read_advance(data, &p, "\n", 1, &sz)) + return -ENOBUFS; } - guard(mutex)(&dev->lock); - if (is_bound(dev)) - return -EBUSY; + if (!wa_bb_read_advance(data, &p, "", 1, &sz)) + return -ENOBUFS; - dev->config.gt_types_allowed = typemask; + /* Reserve one more to match check for '\0' */ + if (!data) + p++; - return len; + return p - data; } -static ssize_t engines_allowed_show(struct config_item *item, char *page) +static ssize_t ctx_restore_mid_bb_show(struct config_item *item, char *page) { - struct xe_config_device *dev = to_xe_config_device(item); - char *p = page; - - for (size_t i = 0; i < ARRAY_SIZE(engine_info); i++) { - u64 mask = engine_info[i].mask; - - if ((dev->engines_allowed & mask) == mask) { - p += sprintf(p, "%s*\n", engine_info[i].cls); - } else if (mask & dev->engines_allowed) { - u16 bit0 = __ffs64(mask), bit; + struct xe_config_group_device *dev = to_xe_config_group_device(item); - mask &= dev->engines_allowed; + return wa_bb_show(dev, dev->config.ctx_restore_mid_bb, page, SZ_4K); +} - for_each_set_bit(bit, (const unsigned long *)&mask, 64) - p += sprintf(p, "%s%u\n", engine_info[i].cls, - bit - bit0); - } - } +static ssize_t ctx_restore_post_bb_show(struct config_item *item, char *page) +{ + struct xe_config_group_device *dev = to_xe_config_group_device(item); - return p - page; + return wa_bb_show(dev, dev->config.ctx_restore_post_bb, page, SZ_4K); } -/* - * Lookup engine_info. If @mask is not NULL, reduce the mask according to the - * instance in @pattern. - * - * Examples of inputs: - * - lookup_engine_info("rcs0", &mask): return "rcs" entry from @engine_info and - * mask == BIT_ULL(XE_HW_ENGINE_RCS0) - * - lookup_engine_info("rcs*", &mask): return "rcs" entry from @engine_info and - * mask == XE_HW_ENGINE_RCS_MASK - * - lookup_engine_info("rcs", NULL): return "rcs" entry from @engine_info - */ -static const struct engine_info *lookup_engine_info(const char *pattern, u64 *mask) +static void wa_bb_append(struct wa_bb *wa_bb, u32 val) { - for (size_t i = 0; i < ARRAY_SIZE(engine_info); i++) { - u8 instance; - u16 bit; + if (wa_bb->cs) + wa_bb->cs[wa_bb->len] = val; - if (!str_has_prefix(pattern, engine_info[i].cls)) - continue; + wa_bb->len++; +} - pattern += strlen(engine_info[i].cls); - if (!mask) - return *pattern ? NULL : &engine_info[i]; +static ssize_t parse_hex(const char *line, u32 *pval) +{ + char numstr[12]; + const char *p; + ssize_t numlen; - if (!strcmp(pattern, "*")) { - *mask = engine_info[i].mask; - return &engine_info[i]; - } + p = line + strspn(line, " \t"); + if (!*p || *p == '\n') + return 0; - if (kstrtou8(pattern, 10, &instance)) - return NULL; + numlen = strcspn(p, " \t\n"); + if (!numlen || numlen >= sizeof(numstr) - 1) + return -EINVAL; - bit = __ffs64(engine_info[i].mask) + instance; - if (bit >= fls64(engine_info[i].mask)) - return NULL; + memcpy(numstr, p, numlen); + numstr[numlen] = '\0'; + p += numlen; - *mask = BIT_ULL(bit); - return &engine_info[i]; - } + if (kstrtou32(numstr, 16, pval)) + return -EINVAL; - return NULL; + return p - line; } static int parse_engine(const char *s, const char *end_chars, u64 *mask, - const struct engine_info **pinfo) -{ - char buf[MAX_ENGINE_CLASS_CHARS + MAX_ENGINE_INSTANCE_CHARS + 1]; - const struct engine_info *info; - size_t len; - - len = strcspn(s, end_chars); - if (len >= sizeof(buf)) - return -EINVAL; - - memcpy(buf, s, len); - buf[len] = '\0'; - - info = lookup_engine_info(buf, mask); - if (!info) - return -ENOENT; - - if (pinfo) - *pinfo = info; - - return len; -} - -static ssize_t engines_allowed_store(struct config_item *item, const char *page, - size_t len) -{ - struct xe_config_group_device *dev = to_xe_config_group_device(item); - ssize_t patternlen, p; - u64 mask, val = 0; - - for (p = 0; p < len; p += patternlen + 1) { - patternlen = parse_engine(page + p, ",\n", &mask, NULL); - if (patternlen < 0) - return -EINVAL; - - val |= mask; - } - - guard(mutex)(&dev->lock); - if (is_bound(dev)) - return -EBUSY; - - dev->config.engines_allowed = val; - - return len; -} - -static ssize_t enable_psmi_show(struct config_item *item, char *page) -{ - struct xe_config_device *dev = to_xe_config_device(item); - - return sprintf(page, "%d\n", dev->enable_psmi); -} - -static ssize_t enable_psmi_store(struct config_item *item, const char *page, size_t len) -{ - struct xe_config_group_device *dev = to_xe_config_group_device(item); - bool val; - int ret; - - ret = kstrtobool(page, &val); - if (ret) - return ret; - - guard(mutex)(&dev->lock); - if (is_bound(dev)) - return -EBUSY; - - dev->config.enable_psmi = val; - - return len; -} - -static ssize_t enable_multi_queue_show(struct config_item *item, char *page) -{ - struct xe_config_device *dev = to_xe_config_device(item); - - return sprintf(page, "%d\n", dev->enable_multi_queue); -} - -static ssize_t enable_multi_queue_store(struct config_item *item, const char *page, - size_t len) -{ - struct xe_config_group_device *dev = to_xe_config_group_device(item); - bool val; - int ret; - - ret = kstrtobool(page, &val); - if (ret) - return ret; - - guard(mutex)(&dev->lock); - if (is_bound(dev)) - return -EBUSY; - - dev->config.enable_multi_queue = val; - - return len; -} - -static ssize_t migrate_ulls_period_ms_show(struct config_item *item, char *page) -{ - struct xe_config_device *dev = to_xe_config_device(item); - - return sprintf(page, "%u\n", dev->migrate_ulls_period_ms); -} - -static ssize_t migrate_ulls_period_ms_store(struct config_item *item, - const char *page, size_t len) -{ - struct xe_config_group_device *dev = to_xe_config_group_device(item); - u32 val; - int ret; - - ret = kstrtou32(page, 0, &val); - if (ret) - return ret; - - guard(mutex)(&dev->lock); - if (is_bound(dev)) - return -EBUSY; - - dev->config.migrate_ulls_period_ms = val; - - return len; -} - -static ssize_t enable_vram_page_offline_show(struct config_item *item, char *page) -{ - struct xe_config_device *dev = to_xe_config_device(item); - - return sprintf(page, "%s\n", str_yes_no(dev->enable_vram_page_offline)); -} - -static ssize_t enable_vram_page_offline_store(struct config_item *item, - const char *page, size_t len) -{ - struct xe_config_group_device *dev = to_xe_config_group_device(item); - bool val; - int ret; - - ret = kstrtobool(page, &val); - if (ret) - return ret; - - guard(mutex)(&dev->lock); - if (is_bound(dev)) - return -EBUSY; - - dev->config.enable_vram_page_offline = val; - - return len; -} - -static bool wa_bb_read_advance(bool dereference, char **p, - const char *append, size_t len, - size_t *max_size) -{ - if (dereference) { - if (len >= *max_size) - return false; - *max_size -= len; - if (append) - memcpy(*p, append, len); - } - - *p += len; - - return true; -} - -static ssize_t wa_bb_show(struct xe_config_group_device *dev, - struct wa_bb wa_bb[static XE_ENGINE_CLASS_MAX], - char *data, size_t sz) -{ - char *p = data; - - guard(mutex)(&dev->lock); - - for (size_t i = 0; i < ARRAY_SIZE(engine_info); i++) { - enum xe_engine_class ec = engine_info[i].engine_class; - size_t len; - - if (!wa_bb[ec].len) - continue; - - len = snprintf(p, sz, "%s:", engine_info[i].cls); - if (!wa_bb_read_advance(data, &p, NULL, len, &sz)) - return -ENOBUFS; - - for (size_t j = 0; j < wa_bb[ec].len; j++) { - len = snprintf(p, sz, " %08x", wa_bb[ec].cs[j]); - if (!wa_bb_read_advance(data, &p, NULL, len, &sz)) - return -ENOBUFS; - } - - if (!wa_bb_read_advance(data, &p, "\n", 1, &sz)) - return -ENOBUFS; - } - - if (!wa_bb_read_advance(data, &p, "", 1, &sz)) - return -ENOBUFS; - - /* Reserve one more to match check for '\0' */ - if (!data) - p++; - - return p - data; -} - -static ssize_t ctx_restore_mid_bb_show(struct config_item *item, char *page) -{ - struct xe_config_group_device *dev = to_xe_config_group_device(item); - - return wa_bb_show(dev, dev->config.ctx_restore_mid_bb, page, SZ_4K); -} - -static ssize_t ctx_restore_post_bb_show(struct config_item *item, char *page) -{ - struct xe_config_group_device *dev = to_xe_config_group_device(item); - - return wa_bb_show(dev, dev->config.ctx_restore_post_bb, page, SZ_4K); -} - -static void wa_bb_append(struct wa_bb *wa_bb, u32 val) -{ - if (wa_bb->cs) - wa_bb->cs[wa_bb->len] = val; - - wa_bb->len++; -} - -static ssize_t parse_hex(const char *line, u32 *pval) -{ - char numstr[12]; - const char *p; - ssize_t numlen; - - p = line + strspn(line, " \t"); - if (!*p || *p == '\n') - return 0; - - numlen = strcspn(p, " \t\n"); - if (!numlen || numlen >= sizeof(numstr) - 1) - return -EINVAL; - - memcpy(numstr, p, numlen); - numstr[numlen] = '\0'; - p += numlen; - - if (kstrtou32(numstr, 16, pval)) - return -EINVAL; - - return p - line; -} + const struct engine_info **pinfo); /* * Parse lines with the format @@ -981,341 +743,278 @@ static ssize_t ctx_restore_post_bb_store(struct config_item *item, return wa_bb_store(dev->config.ctx_restore_post_bb, dev, data, sz); } -CONFIGFS_ATTR(, ctx_restore_mid_bb); -CONFIGFS_ATTR(, ctx_restore_post_bb); -CONFIGFS_ATTR(, enable_multi_queue); -CONFIGFS_ATTR(, migrate_ulls_period_ms); -CONFIGFS_ATTR(, enable_psmi); -CONFIGFS_ATTR(, enable_vram_page_offline); -CONFIGFS_ATTR(, engines_allowed); -CONFIGFS_ATTR(, gt_types_allowed); -CONFIGFS_ATTR(, survivability_mode); -CONFIGFS_ATTR(, force_ocode_load); - -static struct configfs_attribute *xe_config_device_attrs[] = { - &attr_ctx_restore_mid_bb, - &attr_ctx_restore_post_bb, - &attr_enable_multi_queue, - &attr_migrate_ulls_period_ms, - &attr_enable_psmi, - &attr_enable_vram_page_offline, - &attr_engines_allowed, - &attr_gt_types_allowed, - &attr_survivability_mode, - &attr_force_ocode_load, - NULL, -}; - -static void xe_config_device_release(struct config_item *item) +/** + * xe_configfs_get_engines_allowed - get engine allowed mask from configfs + * @pdev: pci device + * + * Return: engine mask with allowed engines set in configfs + */ +u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev) { - struct xe_config_group_device *dev = to_xe_config_group_device(item); + struct xe_config_group_device *dev = find_xe_config_group_device(pdev); + u64 engines_allowed; - mutex_destroy(&dev->lock); + if (!dev) + return device_defaults.engines_allowed; - kfree(dev->config.ctx_restore_mid_bb[0].cs); - kfree(dev->config.ctx_restore_post_bb[0].cs); - kfree(dev); -} + scoped_guard(mutex, &dev->lock) + engines_allowed = dev->config.engines_allowed; + config_group_put(&dev->group); -static struct configfs_item_operations xe_config_device_ops = { - .release = xe_config_device_release, -}; + return engines_allowed; +} -static bool xe_config_device_is_visible(struct config_item *item, - const struct configfs_attribute *attr, int n) +static ssize_t engines_allowed_show(struct config_item *item, char *page) { - struct xe_config_group_device *dev = to_xe_config_group_device(item); + struct xe_config_device *dev = to_xe_config_device(item); + char *p = page; - if (attr == &attr_force_ocode_load && !IS_ENABLED(CONFIG_DRM_XE_DEBUG)) - return false; + for (size_t i = 0; i < ARRAY_SIZE(engine_info); i++) { + u64 mask = engine_info[i].mask; - if (attr == &attr_survivability_mode) { - if (!dev->desc->is_dgfx || dev->desc->platform < XE_BATTLEMAGE) - return false; - } + if ((dev->engines_allowed & mask) == mask) { + p += sprintf(p, "%s*\n", engine_info[i].cls); + } else if (mask & dev->engines_allowed) { + u16 bit0 = __ffs64(mask), bit; - if (attr == &attr_enable_vram_page_offline) { - if (!dev->desc->is_dgfx || dev->desc->platform != XE_CRESCENTISLAND) - return false; + mask &= dev->engines_allowed; + + for_each_set_bit(bit, (const unsigned long *)&mask, 64) + p += sprintf(p, "%s%u\n", engine_info[i].cls, + bit - bit0); + } } - return true; + return p - page; } -static struct configfs_group_operations xe_config_device_group_ops = { - .is_visible = xe_config_device_is_visible, -}; - -static const struct config_item_type xe_config_device_type = { - .ct_item_ops = &xe_config_device_ops, - .ct_group_ops = &xe_config_device_group_ops, - .ct_attrs = xe_config_device_attrs, - .ct_owner = THIS_MODULE, -}; - -static ssize_t sriov_max_vfs_show(struct config_item *item, char *page) +/* + * Lookup engine_info. If @mask is not NULL, reduce the mask according to the + * instance in @pattern. + * + * Examples of inputs: + * - lookup_engine_info("rcs0", &mask): return "rcs" entry from @engine_info and + * mask == BIT_ULL(XE_HW_ENGINE_RCS0) + * - lookup_engine_info("rcs*", &mask): return "rcs" entry from @engine_info and + * mask == XE_HW_ENGINE_RCS_MASK + * - lookup_engine_info("rcs", NULL): return "rcs" entry from @engine_info + */ +static const struct engine_info *lookup_engine_info(const char *pattern, u64 *mask) { - struct xe_config_group_device *dev = to_xe_config_group_device(item->ci_parent); + for (size_t i = 0; i < ARRAY_SIZE(engine_info); i++) { + u8 instance; + u16 bit; - guard(mutex)(&dev->lock); + if (!str_has_prefix(pattern, engine_info[i].cls)) + continue; - if (dev->config.sriov.max_vfs == UINT_MAX) - return sprintf(page, "%s\n", "unlimited"); - else - return sprintf(page, "%u\n", dev->config.sriov.max_vfs); -} + pattern += strlen(engine_info[i].cls); + if (!mask) + return *pattern ? NULL : &engine_info[i]; -static ssize_t sriov_max_vfs_store(struct config_item *item, const char *page, size_t len) -{ - struct xe_config_group_device *dev = to_xe_config_group_device(item->ci_parent); - unsigned int max_vfs; - int ret; + if (!strcmp(pattern, "*")) { + *mask = engine_info[i].mask; + return &engine_info[i]; + } - guard(mutex)(&dev->lock); + if (kstrtou8(pattern, 10, &instance)) + return NULL; - if (is_bound(dev)) - return -EBUSY; + bit = __ffs64(engine_info[i].mask) + instance; + if (bit >= fls64(engine_info[i].mask)) + return NULL; - ret = kstrtouint(page, 0, &max_vfs); - if (ret) { - if (!sysfs_streq(page, "unlimited")) - return ret; - max_vfs = UINT_MAX; + *mask = BIT_ULL(bit); + return &engine_info[i]; } - dev->config.sriov.max_vfs = max_vfs; - return len; + return NULL; } -static ssize_t sriov_admin_only_pf_show(struct config_item *item, char *page) +static int parse_engine(const char *s, const char *end_chars, u64 *mask, + const struct engine_info **pinfo) { - struct xe_config_group_device *dev = to_xe_config_group_device(item->ci_parent); + char buf[MAX_ENGINE_CLASS_CHARS + MAX_ENGINE_INSTANCE_CHARS + 1]; + const struct engine_info *info; + size_t len; - guard(mutex)(&dev->lock); + len = strcspn(s, end_chars); + if (len >= sizeof(buf)) + return -EINVAL; - return sprintf(page, "%s\n", str_yes_no(dev->config.sriov.admin_only_pf)); + memcpy(buf, s, len); + buf[len] = '\0'; + + info = lookup_engine_info(buf, mask); + if (!info) + return -ENOENT; + + if (pinfo) + *pinfo = info; + + return len; } -static ssize_t sriov_admin_only_pf_store(struct config_item *item, const char *page, size_t len) +static ssize_t engines_allowed_store(struct config_item *item, const char *page, + size_t len) { - struct xe_config_group_device *dev = to_xe_config_group_device(item->ci_parent); - bool admin_only_pf; - int ret; + struct xe_config_group_device *dev = to_xe_config_group_device(item); + ssize_t patternlen, p; + u64 mask, val = 0; - guard(mutex)(&dev->lock); + for (p = 0; p < len; p += patternlen + 1) { + patternlen = parse_engine(page + p, ",\n", &mask, NULL); + if (patternlen < 0) + return -EINVAL; + + val |= mask; + } + guard(mutex)(&dev->lock); if (is_bound(dev)) return -EBUSY; - ret = kstrtobool(page, &admin_only_pf); - if (ret) - return ret; + dev->config.engines_allowed = val; - dev->config.sriov.admin_only_pf = admin_only_pf; return len; } -CONFIGFS_ATTR(sriov_, max_vfs); -CONFIGFS_ATTR(sriov_, admin_only_pf); - -static struct configfs_attribute *xe_config_sriov_attrs[] = { - &sriov_attr_max_vfs, - &sriov_attr_admin_only_pf, - NULL, -}; - -static bool xe_config_sriov_is_visible(struct config_item *item, - const struct configfs_attribute *attr, int n) +static u64 get_gt_types_allowed(struct pci_dev *pdev) { - struct xe_config_group_device *dev = to_xe_config_group_device(item->ci_parent); - - if (attr == &sriov_attr_max_vfs && dev->mode != XE_SRIOV_MODE_PF) - return false; - if (attr == &sriov_attr_admin_only_pf && dev->mode != XE_SRIOV_MODE_PF) - return false; + struct xe_config_group_device *dev = find_xe_config_group_device(pdev); + u64 mask; - return true; -} + if (!dev) + return device_defaults.gt_types_allowed; -static struct configfs_group_operations xe_config_sriov_group_ops = { - .is_visible = xe_config_sriov_is_visible, -}; + scoped_guard(mutex, &dev->lock) + mask = dev->config.gt_types_allowed; + config_group_put(&dev->group); -static const struct config_item_type xe_config_sriov_type = { - .ct_owner = THIS_MODULE, - .ct_group_ops = &xe_config_sriov_group_ops, - .ct_attrs = xe_config_sriov_attrs, -}; + return mask; +} -static const struct xe_device_desc *xe_match_desc(struct pci_dev *pdev) +/** + * xe_configfs_primary_gt_allowed - determine whether primary GTs are supported + * @pdev: pci device + * + * Return: True if primary GTs are enabled, false if they have been disabled via + * configfs. + */ +bool xe_configfs_primary_gt_allowed(struct pci_dev *pdev) { - struct device_driver *driver = driver_find("xe", &pci_bus_type); - struct pci_driver *drv = to_pci_driver(driver); - const struct pci_device_id *ids = drv ? drv->id_table : NULL; - const struct pci_device_id *found = pci_match_id(ids, pdev); - - return found ? (const void *)found->driver_data : NULL; + return get_gt_types_allowed(pdev) & BIT_ULL(XE_GT_TYPE_MAIN); } -static struct pci_dev *get_physfn_instead(struct pci_dev *virtfn) +/** + * xe_configfs_media_gt_allowed - determine whether media GTs are supported + * @pdev: pci device + * + * Return: True if the media GTs are enabled, false if they have been disabled + * via configfs. + */ +bool xe_configfs_media_gt_allowed(struct pci_dev *pdev) { - struct pci_dev *physfn = pci_physfn(virtfn); - - pci_dev_get(physfn); - pci_dev_put(virtfn); - return physfn; + return get_gt_types_allowed(pdev) & BIT_ULL(XE_GT_TYPE_MEDIA); } -static struct config_group *xe_config_make_device_group(struct config_group *group, - const char *name) +static ssize_t gt_types_allowed_show(struct config_item *item, char *page) { - unsigned int domain, bus, slot, function; - struct xe_config_group_device *dev; - const struct xe_device_desc *match; - enum xe_sriov_mode mode; - struct pci_dev *pdev; - char canonical[16]; - int vfnumber = 0; - int ret; - - ret = sscanf(name, "%x:%x:%x.%x", &domain, &bus, &slot, &function); - if (ret != 4) - return ERR_PTR(-EINVAL); - - ret = scnprintf(canonical, sizeof(canonical), "%04x:%02x:%02x.%d", domain, bus, - PCI_SLOT(PCI_DEVFN(slot, function)), - PCI_FUNC(PCI_DEVFN(slot, function))); - if (ret != 12 || strcmp(name, canonical)) - return ERR_PTR(-EINVAL); - - pdev = pci_get_domain_bus_and_slot(domain, bus, PCI_DEVFN(slot, function)); - mode = pdev ? dev_is_pf(&pdev->dev) ? - XE_SRIOV_MODE_PF : XE_SRIOV_MODE_NONE : XE_SRIOV_MODE_VF; - - if (!pdev && function) - pdev = pci_get_domain_bus_and_slot(domain, bus, PCI_DEVFN(slot, 0)); - if (!pdev && slot) - pdev = pci_get_domain_bus_and_slot(domain, bus, PCI_DEVFN(0, 0)); - if (!pdev) - return ERR_PTR(-ENODEV); + struct xe_config_device *dev = to_xe_config_device(item); + char *p = page; - if (PCI_DEVFN(slot, function) != pdev->devfn) { - pdev = get_physfn_instead(pdev); - vfnumber = PCI_DEVFN(slot, function) - pdev->devfn; - if (!dev_is_pf(&pdev->dev) || vfnumber > pci_sriov_get_totalvfs(pdev)) { - pci_dev_put(pdev); - return ERR_PTR(-ENODEV); - } - } + for (size_t i = 0; i < ARRAY_SIZE(gt_types); i++) + if (dev->gt_types_allowed & BIT_ULL(gt_types[i].type)) + p += sprintf(p, "%s\n", gt_types[i].name); - match = xe_match_desc(pdev); - if (match && vfnumber && !match->has_sriov) { - pci_info(pdev, "xe driver does not support VFs on this device\n"); - match = NULL; - } else if (!match) { - pci_info(pdev, "xe driver does not support configuration of this device\n"); - } + return p - page; +} - pci_dev_put(pdev); +static ssize_t gt_types_allowed_store(struct config_item *item, const char *page, + size_t len) +{ + struct xe_config_group_device *dev = to_xe_config_group_device(item); + char *buf __free(kfree) = kstrdup(page, GFP_KERNEL); + char *p = buf; + u64 typemask = 0; - if (!match) - return ERR_PTR(-ENOENT); + if (!buf) + return -ENOMEM; - dev = kzalloc_obj(*dev); - if (!dev) - return ERR_PTR(-ENOMEM); + while (p) { + char *typename = strsep(&p, ",\n"); + bool matched = false; - dev->desc = match; - dev->mode = match->has_sriov ? mode : XE_SRIOV_MODE_NONE; + if (typename[0] == '\0') + continue; - set_device_defaults(&dev->config); + for (size_t i = 0; i < ARRAY_SIZE(gt_types); i++) { + if (strcmp(typename, gt_types[i].name) == 0) { + typemask |= BIT(gt_types[i].type); + matched = true; + break; + } + } - config_group_init_type_name(&dev->group, name, &xe_config_device_type); - if (dev->mode != XE_SRIOV_MODE_NONE) { - config_group_init_type_name(&dev->sriov, "sriov", &xe_config_sriov_type); - configfs_add_default_group(&dev->sriov, &dev->group); + if (!matched) + return -EINVAL; } - mutex_init(&dev->lock); - - return &dev->group; -} - -static struct configfs_group_operations xe_config_group_ops = { - .make_group = xe_config_make_device_group, -}; + guard(mutex)(&dev->lock); + if (is_bound(dev)) + return -EBUSY; -static const struct config_item_type xe_configfs_type = { - .ct_group_ops = &xe_config_group_ops, - .ct_owner = THIS_MODULE, -}; + dev->config.gt_types_allowed = typemask; -static struct configfs_subsystem xe_configfs = { - .su_group = { - .cg_item = { - .ci_namebuf = "xe", - .ci_type = &xe_configfs_type, - }, - }, -}; + return len; +} -static struct xe_config_group_device *find_xe_config_group_device(struct pci_dev *pdev) +/** + * xe_configfs_get_migrate_ulls_period_ms - get configfs migrate_ulls_period_ms setting + * @pdev: pci device + * + * Return: Migrate ULLS period in milliseconds (zero is disabled). + */ +u32 xe_configfs_get_migrate_ulls_period_ms(struct pci_dev *pdev) { - struct config_item *item; + struct xe_config_group_device *dev = find_xe_config_group_device(pdev); + u32 ret; - mutex_lock(&xe_configfs.su_mutex); - item = config_group_find_item(&xe_configfs.su_group, pci_name(pdev)); - mutex_unlock(&xe_configfs.su_mutex); + if (!dev) + return device_defaults.migrate_ulls_period_ms; - if (!item) - return NULL; + scoped_guard(mutex, &dev->lock) + ret = dev->config.migrate_ulls_period_ms; + config_group_put(&dev->group); - return to_xe_config_group_device(item); + return ret; } -static void dump_custom_dev_config(struct pci_dev *pdev, - struct xe_config_group_device *dev) +static ssize_t migrate_ulls_period_ms_show(struct config_item *item, char *page) { -#define PRI_CUSTOM_ATTR(fmt_, attr_) do { \ - if (dev->config.attr_ != device_defaults.attr_) \ - pci_info(pdev, "configfs: " __stringify(attr_) " = " fmt_ "\n", \ - dev->config.attr_); \ - } while (0) - - PRI_CUSTOM_ATTR("%llx", gt_types_allowed); - PRI_CUSTOM_ATTR("%llx", engines_allowed); - PRI_CUSTOM_ATTR("%u", migrate_ulls_period_ms); - PRI_CUSTOM_ATTR("%d", enable_multi_queue); - PRI_CUSTOM_ATTR("%d", enable_psmi); - PRI_CUSTOM_ATTR("%d", enable_vram_page_offline); - PRI_CUSTOM_ATTR("%u", survivability_mode); - PRI_CUSTOM_ATTR("%d", force_ocode_load); - PRI_CUSTOM_ATTR("%u", sriov.admin_only_pf); + struct xe_config_device *dev = to_xe_config_device(item); -#undef PRI_CUSTOM_ATTR + return sprintf(page, "%u\n", dev->migrate_ulls_period_ms); } -/** - * 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 different than the default value. - */ -void xe_configfs_check_device(struct pci_dev *pdev) +static ssize_t migrate_ulls_period_ms_store(struct config_item *item, + const char *page, size_t len) { - struct xe_config_group_device *dev = find_xe_config_group_device(pdev); + struct xe_config_group_device *dev = to_xe_config_group_device(item); + u32 val; + int ret; - if (!dev) - return; + ret = kstrtou32(page, 0, &val); + if (ret) + return ret; - /* memcmp here is safe as both are zero-initialized */ - if (memcmp(&dev->config, &device_defaults, sizeof(dev->config))) { - pci_info(pdev, "Found custom settings in configfs\n"); - dump_custom_dev_config(pdev, dev); - } + guard(mutex)(&dev->lock); + if (is_bound(dev)) + return -EBUSY; - config_group_put(&dev->group); + dev->config.migrate_ulls_period_ms = val; + + return len; } /** @@ -1339,82 +1038,82 @@ u8 xe_configfs_get_survivability_mode(struct pci_dev *pdev) return mode; } -bool xe_configfs_get_force_ocode_load(struct pci_dev *pdev) +static ssize_t survivability_mode_show(struct config_item *item, char *page) { - struct xe_config_group_device *dev = find_xe_config_group_device(pdev); - bool force_load; - - if (!dev || !IS_ENABLED(CONFIG_DRM_XE_DEBUG)) { - if (dev) - config_group_put(&dev->group); - return false; - } - - scoped_guard(mutex, &dev->lock) - force_load = dev->config.force_ocode_load; - config_group_put(&dev->group); + struct xe_config_device *dev = to_xe_config_device(item); - return force_load; + return sprintf(page, "%u\n", dev->survivability_mode); } -static u64 get_gt_types_allowed(struct pci_dev *pdev) +static ssize_t survivability_mode_store(struct config_item *item, const char *page, size_t len) { - struct xe_config_group_device *dev = find_xe_config_group_device(pdev); - u64 mask; + struct xe_config_group_device *dev = to_xe_config_group_device(item); + u8 survivability_mode; + int ret; - if (!dev) - return device_defaults.gt_types_allowed; + ret = kstrtou8(page, 0, &survivability_mode); + if (ret) + return ret; - scoped_guard(mutex, &dev->lock) - mask = dev->config.gt_types_allowed; - config_group_put(&dev->group); + if (survivability_mode & ~XE_CONFIGFS_SURVIVABILITY_MASK) + return -EINVAL; - return mask; -} + guard(mutex)(&dev->lock); + if (is_bound(dev)) + return -EBUSY; -/** - * xe_configfs_primary_gt_allowed - determine whether primary GTs are supported - * @pdev: pci device - * - * Return: True if primary GTs are enabled, false if they have been disabled via - * configfs. - */ -bool xe_configfs_primary_gt_allowed(struct pci_dev *pdev) -{ - return get_gt_types_allowed(pdev) & BIT_ULL(XE_GT_TYPE_MAIN); -} + dev->config.survivability_mode = survivability_mode; -/** - * xe_configfs_media_gt_allowed - determine whether media GTs are supported - * @pdev: pci device - * - * Return: True if the media GTs are enabled, false if they have been disabled - * via configfs. - */ -bool xe_configfs_media_gt_allowed(struct pci_dev *pdev) -{ - return get_gt_types_allowed(pdev) & BIT_ULL(XE_GT_TYPE_MEDIA); + return len; } /** - * xe_configfs_get_engines_allowed - get engine allowed mask from configfs + * xe_configfs_get_enable_multi_queue - get configfs enable_multi_queue setting * @pdev: pci device * - * Return: engine mask with allowed engines set in configfs + * Return: true if multi-queue is enabled for this device (the default), + * false if it has been force-disabled via configfs. */ -u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev) +bool xe_configfs_get_enable_multi_queue(struct pci_dev *pdev) { struct xe_config_group_device *dev = find_xe_config_group_device(pdev); - u64 engines_allowed; + bool ret; if (!dev) - return device_defaults.engines_allowed; + return true; scoped_guard(mutex, &dev->lock) - engines_allowed = dev->config.engines_allowed; + ret = dev->config.enable_multi_queue; config_group_put(&dev->group); - return engines_allowed; + return ret; +} + +static ssize_t enable_multi_queue_show(struct config_item *item, char *page) +{ + struct xe_config_device *dev = to_xe_config_device(item); + + return sprintf(page, "%d\n", dev->enable_multi_queue); +} + +static ssize_t enable_multi_queue_store(struct config_item *item, const char *page, + size_t len) +{ + struct xe_config_group_device *dev = to_xe_config_group_device(item); + bool val; + int ret; + + ret = kstrtobool(page, &val); + if (ret) + return ret; + + guard(mutex)(&dev->lock); + if (is_bound(dev)) + return -EBUSY; + + dev->config.enable_multi_queue = val; + + return len; } /** @@ -1438,46 +1137,30 @@ bool xe_configfs_get_psmi_enabled(struct pci_dev *pdev) return ret; } -/** - * xe_configfs_get_enable_multi_queue - get configfs enable_multi_queue setting - * @pdev: pci device - * - * Return: true if multi-queue is enabled for this device (the default), - * false if it has been force-disabled via configfs. - */ -bool xe_configfs_get_enable_multi_queue(struct pci_dev *pdev) +static ssize_t enable_psmi_show(struct config_item *item, char *page) { - struct xe_config_group_device *dev = find_xe_config_group_device(pdev); - bool ret; - - if (!dev) - return true; - - scoped_guard(mutex, &dev->lock) - ret = dev->config.enable_multi_queue; - config_group_put(&dev->group); + struct xe_config_device *dev = to_xe_config_device(item); - return ret; + return sprintf(page, "%d\n", dev->enable_psmi); } -/** - * xe_configfs_get_migrate_ulls_period_ms - get configfs migrate_ulls_period_ms setting - * @pdev: pci device - * - * Return: Migrate ULLS period in milliseconds (zero is disabled). - */ -u32 xe_configfs_get_migrate_ulls_period_ms(struct pci_dev *pdev) +static ssize_t enable_psmi_store(struct config_item *item, const char *page, size_t len) { - struct xe_config_group_device *dev = find_xe_config_group_device(pdev); - u32 ret; + struct xe_config_group_device *dev = to_xe_config_group_device(item); + bool val; + int ret; - if (!dev) - return device_defaults.migrate_ulls_period_ms; + ret = kstrtobool(page, &val); + if (ret) + return ret; - ret = dev->config.migrate_ulls_period_ms; - config_group_put(&dev->group); + guard(mutex)(&dev->lock); + if (is_bound(dev)) + return -EBUSY; - return ret; + dev->config.enable_psmi = val; + + return len; } /** @@ -1501,82 +1184,414 @@ bool xe_configfs_get_enable_vram_page_offline(struct pci_dev *pdev) return ret; } -/** - * xe_configfs_get_ctx_restore_mid_bb - get configfs ctx_restore_mid_bb setting - * @pdev: pci device - * @class: hw engine class - * @cs: destination buffer for the batch, or NULL to only query the length - * @max_len: capacity of @cs, in dwords - * - * Copy the configured batch into @cs while holding the configfs lock, so the - * caller never gets a pointer to storage owned by the configfs group. - * - * Return: Number of dwords used in the mid_ctx_restore setting in configfs, or - * -ENOSPC if it does not fit in @max_len - */ -ssize_t xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev, - enum xe_engine_class class, - u32 *cs, size_t max_len) +static ssize_t enable_vram_page_offline_show(struct config_item *item, char *page) { - struct xe_config_group_device *dev = find_xe_config_group_device(pdev); - ssize_t len; + struct xe_config_device *dev = to_xe_config_device(item); - if (!dev) - return 0; + return sprintf(page, "%s\n", str_yes_no(dev->enable_vram_page_offline)); +} - scoped_guard(mutex, &dev->lock) { - len = dev->config.ctx_restore_mid_bb[class].len; - if (cs && len) { - if (len > max_len) - len = -ENOSPC; - else - memcpy(cs, dev->config.ctx_restore_mid_bb[class].cs, - len * sizeof(u32)); - } - } - config_group_put(&dev->group); +static ssize_t enable_vram_page_offline_store(struct config_item *item, + const char *page, size_t len) +{ + struct xe_config_group_device *dev = to_xe_config_group_device(item); + bool val; + int ret; + + ret = kstrtobool(page, &val); + if (ret) + return ret; + + guard(mutex)(&dev->lock); + if (is_bound(dev)) + return -EBUSY; + + dev->config.enable_vram_page_offline = val; return len; } -/** - * xe_configfs_get_ctx_restore_post_bb - get configfs ctx_restore_post_bb setting - * @pdev: pci device - * @class: hw engine class - * @cs: destination buffer for the batch, or NULL to only query the length - * @max_len: capacity of @cs, in dwords - * - * Copy the configured batch into @cs while holding the configfs lock, so the - * caller never gets a pointer to storage owned by the configfs group. - * - * Return: Number of dwords used in the post_ctx_restore setting in configfs, or - * -ENOSPC if it does not fit in @max_len - */ -ssize_t xe_configfs_get_ctx_restore_post_bb(struct pci_dev *pdev, - enum xe_engine_class class, - u32 *cs, size_t max_len) +bool xe_configfs_get_force_ocode_load(struct pci_dev *pdev) { struct xe_config_group_device *dev = find_xe_config_group_device(pdev); - ssize_t len; - - if (!dev) - return 0; + bool force_load; - scoped_guard(mutex, &dev->lock) { - len = dev->config.ctx_restore_post_bb[class].len; - if (cs && len) { - if (len > max_len) - len = -ENOSPC; - else - memcpy(cs, dev->config.ctx_restore_post_bb[class].cs, - len * sizeof(u32)); - } + if (!dev || !IS_ENABLED(CONFIG_DRM_XE_DEBUG)) { + if (dev) + config_group_put(&dev->group); + return false; } + + scoped_guard(mutex, &dev->lock) + force_load = dev->config.force_ocode_load; config_group_put(&dev->group); + return force_load; +} + +static ssize_t force_ocode_load_show(struct config_item *item, char *page) +{ + struct xe_config_device *dev = to_xe_config_device(item); + + return sprintf(page, "%d\n", dev->force_ocode_load); +} + +static ssize_t force_ocode_load_store(struct config_item *item, const char *page, size_t len) +{ + struct xe_config_group_device *dev = to_xe_config_group_device(item); + bool force_load; + int ret; + + ret = kstrtobool(page, &force_load); + if (ret) + return ret; + + guard(mutex)(&dev->lock); + if (is_bound(dev)) + return -EBUSY; + + dev->config.force_ocode_load = force_load; + return len; } +CONFIGFS_ATTR(, ctx_restore_mid_bb); +CONFIGFS_ATTR(, ctx_restore_post_bb); +CONFIGFS_ATTR(, engines_allowed); +CONFIGFS_ATTR(, gt_types_allowed); +CONFIGFS_ATTR(, migrate_ulls_period_ms); +CONFIGFS_ATTR(, survivability_mode); +CONFIGFS_ATTR(, enable_multi_queue); +CONFIGFS_ATTR(, enable_psmi); +CONFIGFS_ATTR(, enable_vram_page_offline); +CONFIGFS_ATTR(, force_ocode_load); + +static struct configfs_attribute *xe_config_device_attrs[] = { + &attr_ctx_restore_mid_bb, + &attr_ctx_restore_post_bb, + &attr_engines_allowed, + &attr_gt_types_allowed, + &attr_migrate_ulls_period_ms, + &attr_survivability_mode, + &attr_enable_multi_queue, + &attr_enable_psmi, + &attr_enable_vram_page_offline, + &attr_force_ocode_load, + NULL, +}; + +static void xe_config_device_release(struct config_item *item) +{ + struct xe_config_group_device *dev = to_xe_config_group_device(item); + + mutex_destroy(&dev->lock); + + kfree(dev->config.ctx_restore_mid_bb[0].cs); + kfree(dev->config.ctx_restore_post_bb[0].cs); + kfree(dev); +} + +static struct configfs_item_operations xe_config_device_ops = { + .release = xe_config_device_release, +}; + +static bool xe_config_device_is_visible(struct config_item *item, + const struct configfs_attribute *attr, int n) +{ + struct xe_config_group_device *dev = to_xe_config_group_device(item); + + if (attr == &attr_force_ocode_load && !IS_ENABLED(CONFIG_DRM_XE_DEBUG)) + return false; + + if (attr == &attr_survivability_mode) { + if (!dev->desc->is_dgfx || dev->desc->platform < XE_BATTLEMAGE) + return false; + } + + if (attr == &attr_enable_vram_page_offline) { + if (!dev->desc->is_dgfx || dev->desc->platform != XE_CRESCENTISLAND) + return false; + } + + return true; +} + +static struct configfs_group_operations xe_config_device_group_ops = { + .is_visible = xe_config_device_is_visible, +}; + +static const struct config_item_type xe_config_device_type = { + .ct_item_ops = &xe_config_device_ops, + .ct_group_ops = &xe_config_device_group_ops, + .ct_attrs = xe_config_device_attrs, + .ct_owner = THIS_MODULE, +}; + +static ssize_t sriov_max_vfs_show(struct config_item *item, char *page) +{ + struct xe_config_group_device *dev = to_xe_config_group_device(item->ci_parent); + + guard(mutex)(&dev->lock); + + if (dev->config.sriov.max_vfs == UINT_MAX) + return sprintf(page, "%s\n", "unlimited"); + else + return sprintf(page, "%u\n", dev->config.sriov.max_vfs); +} + +static ssize_t sriov_max_vfs_store(struct config_item *item, const char *page, size_t len) +{ + struct xe_config_group_device *dev = to_xe_config_group_device(item->ci_parent); + unsigned int max_vfs; + int ret; + + guard(mutex)(&dev->lock); + + if (is_bound(dev)) + return -EBUSY; + + ret = kstrtouint(page, 0, &max_vfs); + if (ret) { + if (!sysfs_streq(page, "unlimited")) + return ret; + max_vfs = UINT_MAX; + } + + dev->config.sriov.max_vfs = max_vfs; + return len; +} + +static ssize_t sriov_admin_only_pf_show(struct config_item *item, char *page) +{ + struct xe_config_group_device *dev = to_xe_config_group_device(item->ci_parent); + + guard(mutex)(&dev->lock); + + return sprintf(page, "%s\n", str_yes_no(dev->config.sriov.admin_only_pf)); +} + +static ssize_t sriov_admin_only_pf_store(struct config_item *item, const char *page, size_t len) +{ + struct xe_config_group_device *dev = to_xe_config_group_device(item->ci_parent); + bool admin_only_pf; + int ret; + + guard(mutex)(&dev->lock); + + if (is_bound(dev)) + return -EBUSY; + + ret = kstrtobool(page, &admin_only_pf); + if (ret) + return ret; + + dev->config.sriov.admin_only_pf = admin_only_pf; + return len; +} + +CONFIGFS_ATTR(sriov_, max_vfs); +CONFIGFS_ATTR(sriov_, admin_only_pf); + +static struct configfs_attribute *xe_config_sriov_attrs[] = { + &sriov_attr_max_vfs, + &sriov_attr_admin_only_pf, + NULL, +}; + +static bool xe_config_sriov_is_visible(struct config_item *item, + const struct configfs_attribute *attr, int n) +{ + struct xe_config_group_device *dev = to_xe_config_group_device(item->ci_parent); + + if (attr == &sriov_attr_max_vfs && dev->mode != XE_SRIOV_MODE_PF) + return false; + if (attr == &sriov_attr_admin_only_pf && dev->mode != XE_SRIOV_MODE_PF) + return false; + + return true; +} + +static struct configfs_group_operations xe_config_sriov_group_ops = { + .is_visible = xe_config_sriov_is_visible, +}; + +static const struct config_item_type xe_config_sriov_type = { + .ct_owner = THIS_MODULE, + .ct_group_ops = &xe_config_sriov_group_ops, + .ct_attrs = xe_config_sriov_attrs, +}; + +static const struct xe_device_desc *xe_match_desc(struct pci_dev *pdev) +{ + struct device_driver *driver = driver_find("xe", &pci_bus_type); + struct pci_driver *drv = to_pci_driver(driver); + const struct pci_device_id *ids = drv ? drv->id_table : NULL; + const struct pci_device_id *found = pci_match_id(ids, pdev); + + return found ? (const void *)found->driver_data : NULL; +} + +static struct pci_dev *get_physfn_instead(struct pci_dev *virtfn) +{ + struct pci_dev *physfn = pci_physfn(virtfn); + + pci_dev_get(physfn); + pci_dev_put(virtfn); + return physfn; +} + +static struct config_group *xe_config_make_device_group(struct config_group *group, + const char *name) +{ + unsigned int domain, bus, slot, function; + struct xe_config_group_device *dev; + const struct xe_device_desc *match; + enum xe_sriov_mode mode; + struct pci_dev *pdev; + char canonical[16]; + int vfnumber = 0; + int ret; + + ret = sscanf(name, "%x:%x:%x.%x", &domain, &bus, &slot, &function); + if (ret != 4) + return ERR_PTR(-EINVAL); + + ret = scnprintf(canonical, sizeof(canonical), "%04x:%02x:%02x.%d", domain, bus, + PCI_SLOT(PCI_DEVFN(slot, function)), + PCI_FUNC(PCI_DEVFN(slot, function))); + if (ret != 12 || strcmp(name, canonical)) + return ERR_PTR(-EINVAL); + + pdev = pci_get_domain_bus_and_slot(domain, bus, PCI_DEVFN(slot, function)); + mode = pdev ? dev_is_pf(&pdev->dev) ? + XE_SRIOV_MODE_PF : XE_SRIOV_MODE_NONE : XE_SRIOV_MODE_VF; + + if (!pdev && function) + pdev = pci_get_domain_bus_and_slot(domain, bus, PCI_DEVFN(slot, 0)); + if (!pdev && slot) + pdev = pci_get_domain_bus_and_slot(domain, bus, PCI_DEVFN(0, 0)); + if (!pdev) + return ERR_PTR(-ENODEV); + + if (PCI_DEVFN(slot, function) != pdev->devfn) { + pdev = get_physfn_instead(pdev); + vfnumber = PCI_DEVFN(slot, function) - pdev->devfn; + if (!dev_is_pf(&pdev->dev) || vfnumber > pci_sriov_get_totalvfs(pdev)) { + pci_dev_put(pdev); + return ERR_PTR(-ENODEV); + } + } + + match = xe_match_desc(pdev); + if (match && vfnumber && !match->has_sriov) { + pci_info(pdev, "xe driver does not support VFs on this device\n"); + match = NULL; + } else if (!match) { + pci_info(pdev, "xe driver does not support configuration of this device\n"); + } + + pci_dev_put(pdev); + + if (!match) + return ERR_PTR(-ENOENT); + + dev = kzalloc_obj(*dev); + if (!dev) + return ERR_PTR(-ENOMEM); + + dev->desc = match; + dev->mode = match->has_sriov ? mode : XE_SRIOV_MODE_NONE; + + set_device_defaults(&dev->config); + + config_group_init_type_name(&dev->group, name, &xe_config_device_type); + if (dev->mode != XE_SRIOV_MODE_NONE) { + config_group_init_type_name(&dev->sriov, "sriov", &xe_config_sriov_type); + configfs_add_default_group(&dev->sriov, &dev->group); + } + + mutex_init(&dev->lock); + + return &dev->group; +} + +static struct configfs_group_operations xe_config_group_ops = { + .make_group = xe_config_make_device_group, +}; + +static const struct config_item_type xe_configfs_type = { + .ct_group_ops = &xe_config_group_ops, + .ct_owner = THIS_MODULE, +}; + +static struct configfs_subsystem xe_configfs = { + .su_group = { + .cg_item = { + .ci_namebuf = "xe", + .ci_type = &xe_configfs_type, + }, + }, +}; + +static struct xe_config_group_device *find_xe_config_group_device(struct pci_dev *pdev) +{ + struct config_item *item; + + mutex_lock(&xe_configfs.su_mutex); + item = config_group_find_item(&xe_configfs.su_group, pci_name(pdev)); + mutex_unlock(&xe_configfs.su_mutex); + + if (!item) + return NULL; + + return to_xe_config_group_device(item); +} + +static void dump_custom_dev_config(struct pci_dev *pdev, + struct xe_config_group_device *dev) +{ +#define PRI_CUSTOM_ATTR(fmt_, attr_) do { \ + if (dev->config.attr_ != device_defaults.attr_) \ + pci_info(pdev, "configfs: " __stringify(attr_) " = " fmt_ "\n", \ + dev->config.attr_); \ + } while (0) + + PRI_CUSTOM_ATTR("%llx", engines_allowed); + PRI_CUSTOM_ATTR("%llx", gt_types_allowed); + PRI_CUSTOM_ATTR("%u", migrate_ulls_period_ms); + PRI_CUSTOM_ATTR("%u", survivability_mode); + 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", force_ocode_load); + PRI_CUSTOM_ATTR("%u", sriov.admin_only_pf); + +#undef PRI_CUSTOM_ATTR +} + +/** + * 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 different than the default value. + */ +void xe_configfs_check_device(struct pci_dev *pdev) +{ + struct xe_config_group_device *dev = find_xe_config_group_device(pdev); + + if (!dev) + return; + + /* memcmp here is safe as both are zero-initialized */ + if (memcmp(&dev->config, &device_defaults, sizeof(dev->config))) { + pci_info(pdev, "Found custom settings in configfs\n"); + dump_custom_dev_config(pdev, dev); + } + + config_group_put(&dev->group); +} + #ifdef CONFIG_PCI_IOV /** * xe_configfs_admin_only_pf() - Get PF's operational mode. diff --git a/drivers/gpu/drm/xe/xe_configfs.h b/drivers/gpu/drm/xe/xe_configfs.h index 4748e6aee58a..fa0ea55c98ec 100644 --- a/drivers/gpu/drm/xe/xe_configfs.h +++ b/drivers/gpu/drm/xe/xe_configfs.h @@ -29,21 +29,21 @@ struct pci_dev; int xe_configfs_init(void); void xe_configfs_exit(void); void xe_configfs_check_device(struct pci_dev *pdev); -u8 xe_configfs_get_survivability_mode(struct pci_dev *pdev); -bool xe_configfs_get_force_ocode_load(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); -bool xe_configfs_get_psmi_enabled(struct pci_dev *pdev); -bool xe_configfs_get_enable_multi_queue(struct pci_dev *pdev); -u32 xe_configfs_get_migrate_ulls_period_ms(struct pci_dev *pdev); -bool xe_configfs_get_enable_vram_page_offline(struct pci_dev *pdev); ssize_t xe_configfs_get_ctx_restore_mid_bb(struct pci_dev *pdev, enum xe_engine_class class, u32 *cs, size_t max_len); ssize_t xe_configfs_get_ctx_restore_post_bb(struct pci_dev *pdev, enum xe_engine_class class, u32 *cs, size_t max_len); +u64 xe_configfs_get_engines_allowed(struct pci_dev *pdev); +bool xe_configfs_primary_gt_allowed(struct pci_dev *pdev); +bool xe_configfs_media_gt_allowed(struct pci_dev *pdev); +u32 xe_configfs_get_migrate_ulls_period_ms(struct pci_dev *pdev); +u8 xe_configfs_get_survivability_mode(struct pci_dev *pdev); +bool xe_configfs_get_enable_multi_queue(struct pci_dev *pdev); +bool xe_configfs_get_psmi_enabled(struct pci_dev *pdev); +bool xe_configfs_get_enable_vram_page_offline(struct pci_dev *pdev); +bool xe_configfs_get_force_ocode_load(struct pci_dev *pdev); #ifdef CONFIG_PCI_IOV unsigned int xe_configfs_get_max_vfs(struct pci_dev *pdev); bool xe_configfs_admin_only_pf(struct pci_dev *pdev); -- 2.43.0