Skip to contentSkip to conversation

accel-config: Return error if DSA environment not found

PATCH In review ramesh.thomas at intel.com 2 participants 5 messages Feb 10, 2021

lore
Share & tools
lore

ramesh.thomas at intel.com

#0 lore raw

PATCH 1/1 accel-config: Return error if DSA environment not found

From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Check for presence of DSA sysfs folder /sys/bus/dsa before running commands. If not found print an error message and return -ENOENT

Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/accel-config.c | 6 ++++++
 1 file changed, 6 insertions(+)
accfg/accel-config.c +6 -0
index f963fc7..01a1cd9 100644
@@ -95,6 +95,12 @@ int main(int argc, const char **argv)
 		return 0;
 	}
 
+	if (access("/sys/bus/dsa", R_OK)) {
+		fprintf(stderr,
+			"DSA environment not found. Is the driver loaded?\n");
+		return -ENOENT;
+	}
+
 	rc = accfg_new(&ctx);
 	if (rc)
 		return 0;
Signature · 1 line
2.26.2
#1 lore raw
Quoted 15 lines · ramesh.thomas(a)intel.com

From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Check for presence of DSA sysfs folder /sys/bus/dsa before running commands. If not found print an error message and return -ENOENT

Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
---
  accfg/accel-config.c | 6 ++++++
  1 file changed, 6 insertions(+)
accfg/accel-config.c +0 -0
index f963fc7..01a1cd9 100644

accfg/accel-config.c int main(int argc, const char **argv) · line 98

Quoted 4 lines
accfg/accel-config.c +1 -0
@@ -95,6 +95,12 @@ int main(int argc, const char **argv)
  		return 0;
  	}
 
+	if (access("/sys/bus/dsa", R_OK)) {

For the most part this is fine. I wonder if there will ever be a platform with IAX and no DSA. Maybe check for dsa || iax?

Quoted 8 lines
accfg/accel-config.c +5 -0
+		fprintf(stderr,
+			"DSA environment not found. Is the driver loaded?\n");
+		return -ENOENT;
+	}
+
  	rc = accfg_new(&ctx);
  	if (rc)
  		return 0;
#2 lore raw
Quoted 2 lines

For the most part this is fine. I wonder if there will ever be a platform with IAX and no DSA. Maybe check for dsa || iax?

Yes. Lunar Lake plans to include IAX for sure, but doubtful that DSA will be.

-Tony

#3 lore raw
Quoted 5 lines · Tony Luck
Quoted 2 lines

For the most part this is fine. I wonder if there will ever be a platform with IAX and no DSA. Maybe check for dsa || iax?

Yes. Lunar Lake plans to include IAX for sure, but doubtful that DSA will be.

I think checking for idxd kernel module being loaded would take care of all scenarios.

- Ramesh

#4 lore raw
Quoted 9 lines · Ramesh
Quoted 4 lines · Tony Luck
Quoted 2 lines

For the most part this is fine. I wonder if there will ever be a platform with IAX and no DSA. Maybe check for dsa || iax?

Yes. Lunar Lake plans to include IAX for sure, but doubtful that DSA will be.

I think checking for idxd kernel module being loaded would take care of all scenarios.

- Ramesh

Yes I think so.