]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/pf: Allow bulk change all VFs EQ/PT using sysfs
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Thu, 30 Oct 2025 22:23:41 +0000 (23:23 +0100)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Fri, 31 Oct 2025 19:01:43 +0000 (20:01 +0100)
It is expected to be a common practice to configure the same values
of execution quantum and preemption timeout parameters across all VFs.

Add write-only sysfs attributes that will apply required EQ/PT values
globally, without forcing admin to update PF and each VF separately.

  /sys/bus/pci/drivers/xe/BDF/
  ├── sriov_admin/
      ├── .bulk_profile
      │   ├── exec_quantum_ms [WO] unsigned integer
      │   └── preempt_timeout_us [WO] unsigned integer

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patch.msgid.link/20251030222348.186658-11-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_sriov_pf_sysfs.c

index f12d6752e9f1e74a56b81bcf3d9126162f854b97..0430ffaa746a8f3232bead4eb181ca736b8c066c 100644 (file)
@@ -22,6 +22,9 @@
  * :
  * ├── sriov_admin/
  *     ├── ...
+ *     ├── .bulk_profile
+ *     │   ├── exec_quantum_ms
+ *     │   └── preempt_timeout_us
  *     ├── pf/
  *     │   ├── ...
  *     │   └── profile
@@ -84,7 +87,40 @@ struct xe_sriov_vf_attr xe_sriov_vf_attr_##NAME = \
 
 /* device level attributes go here */
 
+#define DEFINE_SIMPLE_BULK_PROVISIONING_SRIOV_DEV_ATTR_WO(NAME, ITEM, TYPE)            \
+                                                                                       \
+static ssize_t xe_sriov_dev_attr_##NAME##_store(struct xe_device *xe,                  \
+                                               const char *buf, size_t count)          \
+{                                                                                      \
+       TYPE value;                                                                     \
+       int err;                                                                        \
+                                                                                       \
+       err = kstrto##TYPE(buf, 0, &value);                                             \
+       if (err)                                                                        \
+               return err;                                                             \
+                                                                                       \
+       err = xe_sriov_pf_provision_bulk_apply_##ITEM(xe, value);                       \
+       return err ?: count;                                                            \
+}                                                                                      \
+                                                                                       \
+static XE_SRIOV_DEV_ATTR_WO(NAME)
+
+DEFINE_SIMPLE_BULK_PROVISIONING_SRIOV_DEV_ATTR_WO(exec_quantum_ms, eq, u32);
+DEFINE_SIMPLE_BULK_PROVISIONING_SRIOV_DEV_ATTR_WO(preempt_timeout_us, pt, u32);
+
+static struct attribute *bulk_profile_dev_attrs[] = {
+       &xe_sriov_dev_attr_exec_quantum_ms.attr,
+       &xe_sriov_dev_attr_preempt_timeout_us.attr,
+       NULL
+};
+
+static const struct attribute_group bulk_profile_dev_attr_group = {
+       .name = ".bulk_profile",
+       .attrs = bulk_profile_dev_attrs,
+};
+
 static const struct attribute_group *xe_sriov_dev_attr_groups[] = {
+       &bulk_profile_dev_attr_group,
        NULL
 };