Skip to contentSkip to conversation

accel-config: Provide compatibility for legacy mode driver names

PATCH In review ramesh.thomas at intel.com 2 participants 4 messages Jul 15, 2021

lore
Share & tools
lore

ramesh.thomas at intel.com

#0 lore raw

PATCH 1/1 accel-config: Provide compatibility for legacy mode driver names

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

Check for presence of /sys/bus/dsa/drivers/idxd and use legacy driver names if not present.

Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/lib/libaccfg.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
accfg/lib/libaccfg.c +15 -1
index f21cab5..592c22c 100644
@@ -36,6 +36,13 @@
 #define IDXD_WQ_DEVICE_PORTAL(d, w) ((d)->ctx->compat ? \
 		(d)->bus_type_str : accfg_wq_device_portals[(w)->type])
 
+char *accfg_wq_device_portals_legacy[] = {
+	[ACCFG_WQT_KERNEL] = "idxd-kernel-portal",
+	[ACCFG_WQT_USER] = "idxd-user-portal",
+	[ACCFG_WQT_MDEV] = "idxd-mdev-portal",
+	NULL
+};
+
 char *accfg_wq_device_portals[] = {
 	[ACCFG_WQT_KERNEL] = "dmaengine",
 	[ACCFG_WQT_USER] = "user",
@@ -398,8 +405,15 @@ ACCFG_EXPORT int accfg_new(struct accfg_ctx **ctx)
 	c->refcount = 1;
 	log_init(&c->ctx, "libaccfg", "ACCFG_LOG");
 	c->timeout = 5000;
-	if (access(IDXD_DRIVER_BIND_PATH, R_OK))
+	if (access(IDXD_DRIVER_BIND_PATH, R_OK)) {
 		c->compat = true;
+		accfg_wq_device_portals[ACCFG_WQT_KERNEL] =
+			accfg_wq_device_portals_legacy[ACCFG_WQT_KERNEL];
+		accfg_wq_device_portals[ACCFG_WQT_USER] =
+			accfg_wq_device_portals_legacy[ACCFG_WQT_USER];
+		accfg_wq_device_portals[ACCFG_WQT_MDEV] =
+			accfg_wq_device_portals_legacy[ACCFG_WQT_MDEV];
+	}
 
 	list_head_init(&c->devices);
 
Signature · 1 line
2.26.3
#1 lore raw
Quoted 15 lines · ramesh.thomas(a)intel.com

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

Check for presence of /sys/bus/dsa/drivers/idxd and use legacy driver names if not present.

Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
---
  accfg/lib/libaccfg.c | 16 +++++++++++++++-
  1 file changed, 15 insertions(+), 1 deletion(-)
accfg/lib/libaccfg.c +0 -0
index f21cab5..592c22c 100644

accfg/lib/libaccfg.c line 45

Quoted 10 lines
accfg/lib/libaccfg.c +7 -0
@@ -36,6 +36,13 @@
  #define IDXD_WQ_DEVICE_PORTAL(d, w) ((d)->ctx->compat ? \
  		(d)->bus_type_str : accfg_wq_device_portals[(w)->type])
 
+char *accfg_wq_device_portals_legacy[] = {
+	[ACCFG_WQT_KERNEL] = "idxd-kernel-portal",
+	[ACCFG_WQT_USER] = "idxd-user-portal",
+	[ACCFG_WQT_MDEV] = "idxd-mdev-portal",
+	NULL
+};
+

I don't think this version exists upstream. It was an internal thing during transition that we can drop. I believe legacy is just /sys/bus/dsa/drivers/dsa only for everything.

Quoted 20 lines
accfg/lib/libaccfg.c +8 -1
  char *accfg_wq_device_portals[] = {
  	[ACCFG_WQT_KERNEL] = "dmaengine",
  	[ACCFG_WQT_USER] = "user",
@@ -398,8 +405,15 @@ ACCFG_EXPORT int accfg_new(struct accfg_ctx **ctx)
  	c->refcount = 1;
  	log_init(&c->ctx, "libaccfg", "ACCFG_LOG");
  	c->timeout = 5000;
-	if (access(IDXD_DRIVER_BIND_PATH, R_OK))
+	if (access(IDXD_DRIVER_BIND_PATH, R_OK)) {
  		c->compat = true;
+		accfg_wq_device_portals[ACCFG_WQT_KERNEL] =
+			accfg_wq_device_portals_legacy[ACCFG_WQT_KERNEL];
+		accfg_wq_device_portals[ACCFG_WQT_USER] =
+			accfg_wq_device_portals_legacy[ACCFG_WQT_USER];
+		accfg_wq_device_portals[ACCFG_WQT_MDEV] =
+			accfg_wq_device_portals_legacy[ACCFG_WQT_MDEV];
+	}
 
  	list_head_init(&c->devices);
 
#2 lore raw
Quoted 20 lines · Dave Jiang
Quoted 18 lines · ramesh.thomas(a)intel.com

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

Check for presence of /sys/bus/dsa/drivers/idxd and use legacy driver names if not present.

Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
---
  accfg/lib/libaccfg.c | 16 +++++++++++++++-
  1 file changed, 15 insertions(+), 1 deletion(-)
accfg/lib/libaccfg.c +0 -0
index f21cab5..592c22c 100644
@@ -36,6 +36,13 @@
  #define IDXD_WQ_DEVICE_PORTAL(d, w) ((d)->ctx->compat ? \
  		(d)->bus_type_str : accfg_wq_device_portals[(w)->type])
 
Quoted 11 lines

accfg/lib/libaccfg.c line 45

Quoted 7 lines
accfg/lib/libaccfg.c +7 -0
+char *accfg_wq_device_portals_legacy[] = {
+	[ACCFG_WQT_KERNEL] = "idxd-kernel-portal",
+	[ACCFG_WQT_USER] = "idxd-user-portal",
+	[ACCFG_WQT_MDEV] = "idxd-mdev-portal",
+	NULL
+};
+

I don't think this version exists upstream. It was an internal thing during transition that we can drop. I believe legacy is just /sys/bus/dsa/drivers/dsa only for everything.

/sys/bus/dsa/drivers/dsa compatibility is already there so we don't need this patch.

Quoted 22 lines
Quoted 22 lines
accfg/lib/libaccfg.c +8 -1
  char *accfg_wq_device_portals[] = {
  	[ACCFG_WQT_KERNEL] = "dmaengine",
  	[ACCFG_WQT_USER] = "user",
@@ -398,8 +405,15 @@ ACCFG_EXPORT int accfg_new(struct accfg_ctx **ctx)
  	c->refcount = 1;
  	log_init(&c->ctx, "libaccfg", "ACCFG_LOG");
  	c->timeout = 5000;
-	if (access(IDXD_DRIVER_BIND_PATH, R_OK))
+	if (access(IDXD_DRIVER_BIND_PATH, R_OK)) {
  		c->compat = true;
+		accfg_wq_device_portals[ACCFG_WQT_KERNEL] =
+			accfg_wq_device_portals_legacy[ACCFG_WQT_KERNEL];
+		accfg_wq_device_portals[ACCFG_WQT_USER] =
+			accfg_wq_device_portals_legacy[ACCFG_WQT_USER];
+		accfg_wq_device_portals[ACCFG_WQT_MDEV] =
+			accfg_wq_device_portals_legacy[ACCFG_WQT_MDEV];
+	}
 
  	list_head_init(&c->devices);
 
#3 lore raw
Quoted 30 lines · Ramesh
Quoted 19 lines · Dave Jiang
Quoted 18 lines · ramesh.thomas(a)intel.com

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

Check for presence of /sys/bus/dsa/drivers/idxd and use legacy driver names if not present.

Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
---
   accfg/lib/libaccfg.c | 16 +++++++++++++++-
   1 file changed, 15 insertions(+), 1 deletion(-)
accfg/lib/libaccfg.c +0 -0
index f21cab5..592c22c 100644
@@ -36,6 +36,13 @@
   #define IDXD_WQ_DEVICE_PORTAL(d, w) ((d)->ctx->compat ? \
             (d)->bus_type_str : accfg_wq_device_portals[(w)->type])
 
Quoted 10 lines

accfg/lib/libaccfg.c line 45

Quoted 7 lines
accfg/lib/libaccfg.c +7 -0
+char *accfg_wq_device_portals_legacy[] = {
+   [ACCFG_WQT_KERNEL] = "idxd-kernel-portal",
+   [ACCFG_WQT_USER] = "idxd-user-portal",
+   [ACCFG_WQT_MDEV] = "idxd-mdev-portal",
+   NULL
+};
+

I don't think this version exists upstream. It was an internal thing during transition that we can drop. I believe legacy is just /sys/bus/dsa/drivers/dsa only for everything.

Quoted 2 lines

/sys/bus/dsa/drivers/dsa compatibility is already there so we don't need this patch.

Ok then I think we are good. Thanks!

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
accfg/lib/libaccfg.c +8 -1
   char *accfg_wq_device_portals[] = {
     [ACCFG_WQT_KERNEL] = "dmaengine",
     [ACCFG_WQT_USER] = "user",
@@ -398,8 +405,15 @@ ACCFG_EXPORT int accfg_new(struct accfg_ctx **ctx)
     c->refcount = 1;
     log_init(&c->ctx, "libaccfg", "ACCFG_LOG");
     c->timeout = 5000;
-   if (access(IDXD_DRIVER_BIND_PATH, R_OK))
+   if (access(IDXD_DRIVER_BIND_PATH, R_OK)) {
             c->compat = true;
+           accfg_wq_device_portals[ACCFG_WQT_KERNEL] =
+                   accfg_wq_device_portals_legacy[ACCFG_WQT_KERNEL];
+           accfg_wq_device_portals[ACCFG_WQT_USER] =
+                   accfg_wq_device_portals_legacy[ACCFG_WQT_USER];
+           accfg_wq_device_portals[ACCFG_WQT_MDEV] =
+                   accfg_wq_device_portals_legacy[ACCFG_WQT_MDEV];
+   }
 
     list_head_init(&c->devices);