dma_intel: fix ats_disable attribute handling 91/42991/3
authorJeff Shaw <[email protected]>
Tue, 20 May 2025 19:45:20 +0000 (12:45 -0700)
committerDave Wallace <[email protected]>
Thu, 22 May 2025 11:21:54 +0000 (11:21 +0000)
Some DSA devices allow the Address Translation Service (ATS) to be
controlled at the workqueue level. For those devices, the ats_disable
attribute is exposed in sysfs. For devices that do not support ATS
control per workqueue, and are driven by an idxd kernel driver >= 6.6,
the ats_disable attribute is not visible in sysfs.

This change fixes the DSA workqueue initialization to handle the case
where the ats_disable sysfs attribute is not present.

Type: fix

Change-Id: Ia11a90686b9e1916ab50a4209b67f3270190c3f1
Signed-off-by: Jeff Shaw <[email protected]>
src/plugins/dma_intel/main.c

index 0f9ac18..ac57243 100644 (file)
@@ -161,9 +161,17 @@ intel_dsa_get_info (intel_dsa_channel_t *ch, clib_error_t **error)
   vec_reset_length (f);
   f = format (f, "%v/ats_disable%c", wq_dir_name, 0);
   err = clib_sysfs_read ((char *) f, "%s", &tmpstr);
-  if (err)
+  if (err && err->code == ENOENT)
+    {
+      /* ats_disable is not supported when it is invisible */
+      ch->ats_disable = 0;
+      vec_free (err);
+      err = NULL;
+    }
+  else if (err)
     goto error;
-  ch->ats_disable = atoi ((char *) tmpstr);
+  else
+    ch->ats_disable = atoi ((char *) tmpstr);
 
   vec_reset_length (f);
   f = format (f, "%v/block_on_fault%c", wq_dir_name, 0);