Add support for ABI change in driver
ramesh.thomas at intel.com
v3 cover Add support for ABI change in driver
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
v3:
- Get driver unbind path from symlink in device/driver to support cases where devices get auto-bound
v2:
- Fixed naming of driver bind paths to not incorrectly use "portal"
- Reworded commit messages correcting use of "portal"
v1: (reworded)
The new ABI changes the way devices are enumerated in sysfs and the device portals used to bind and unbind wqs to driver. These patches add support for the new ABI as well as compatibility with the ones in older kernels.
Following are the modes that are supported.
1. New ABI:
- Both iax and dsa devices will be in same bus /sys/bus/dsa
- Different device portals for "user", "kernel" and "mdev" type wqs
2. Kernel 5.11 and 5.12:
- iax and dsa will be in 2 separate buses
- Bus, device and device portal names are same
3. Older kernels :
- Has only dsa bus
4. OSV having kernel with CONFIG_INTEL_IDXD_COMPAT enabled:
- Only one dsa bus
- Both iax and dsa devices will be on dsa bus.
- Only one device portal for all wq types
Following are the changes added.
- Detect compatibility mode during init and store bus type in device contexts.
- Currently enumeration assumes device, bus and driver have the same name and relies on that to construct driver bind paths. Change it to dynamically construct the paths based on compatibility mode that was detected during init.
Ramesh Thomas (4):
accel-config: Fix some indentation and coding style issues
accel-config: Add compatibility mode detection
accel-config: Store bus type in device context
accel-config: Add support for new device bind paths
accfg/lib/libaccfg.c | 109 ++++++++++++++++++++++++++++++---------- accfg/lib/private.h | 70 +++++++++++++------------- accfg/libaccel_config.h | 37 +++++++------- util/sysfs.c | 5 +- util/sysfs.h | 13 ++--- 5 files changed, 147 insertions(+), 87 deletions(-)
Signature · 1 line
2.26.2
ramesh.thomas at intel.com
PATCH v3 1/4 accel-config: Fix some indentation and coding style issues
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Fix indentation issues to make patch review easier
--- accfg/lib/private.h | 68 ++++++++++++++++++++--------------------- accfg/libaccel_config.h | 34 ++++++++++----------- 2 files changed, 51 insertions(+), 51 deletions(-)
accfg/lib/private.h +34 -34
@@ -20,32 +20,32 @@struct accfg_device {struct accfg_ctx *ctx; -unsigned int id; -struct accfg_group * group; -struct accfg_wq * wq; -struct accfg_engine * engine; +unsigned int id; +struct accfg_group *group; +struct accfg_wq *wq; +struct accfg_engine *engine;struct list_head groups;struct list_head wqs;struct list_head engines; -struct list_node list; +struct list_node list;int group_init; -char *device_path; +char *device_path;char *mdev_path; -char *device_buf; +char *device_buf;char *device_type_str;enum accfg_device_type type; -size_t buf_len; +size_t buf_len;struct list_head mdev_list;/* Device Attributes */ struct accfg_error errors;int max_groups; -int max_work_queues; -int max_engines; -int max_work_queues_size; -int numa_node; -int ims_size; -int max_batch_size; +int max_work_queues; +int max_engines; +int max_work_queues_size; +int numa_node; +int ims_size; +int max_batch_size;int configurable;int max_tokens;unsigned int token_limit;
@@ -65,9 +65,9 @@ struct accfg_device_mdev { };struct accfg_group { -struct accfg_device *device; -int id; -int buf_len; +struct accfg_device *device; +int id; +int buf_len;int size;char *group_path;char *group_buf;
@@ -91,12 +91,12 @@ struct accfg_group {struct accfg_engine {struct accfg_device *device; -struct accfg_group *group; -struct list_node list; -char *engine_path; -char *engine_buf; -int type, id, buf_len; -int numa_node; +struct accfg_group *group; +struct list_node list; +char *engine_path; +char *engine_buf; +int type, id, buf_len; +int numa_node;/* Engine Attributes */ int group_id;
@@ -104,12 +104,12 @@ struct accfg_engine {struct accfg_wq {struct accfg_device *device; -struct accfg_group *group; +struct accfg_group *group;struct list_node list;char *wq_path; -char *wq_buf; -int id, buf_len; -int numa_node; +char *wq_buf; +int id, buf_len; +int numa_node;/* Workqueue Attributes */ int group_id;
@@ -138,23 +138,23 @@ struct accfg_wq {* @timeout: default library timeout in milliseconds */ struct accfg_ctx { -/* log_ctx must be first member for accfg_set_log_fn compat */ -struct log_ctx ctx; -int refcount; -int devices_init; +/* log_ctx must be first member for accfg_set_log_fn compat */ +struct log_ctx ctx; +int refcount; +int devices_init;int groups_init;struct list_head devices;uint64_t timeout; -void *private_data; +void *private_data; };static inline int check_udev (struct udev *udev) { -return udev ?0 : -ENXIO ; +return udev ?0 : -ENXIO ; }static inline int check_kmod (struct kmod_ctx *kmod_ctx) { -return kmod_ctx ?0 : -ENXIO ; +return kmod_ctx ?0 : -ENXIO ; }#endif /* _LIBACCFG_PRIVATE_H_ */
accfg/libaccel_config.h +17 -17
@@ -76,7 +76,7 @@ enum accfg_mdev_type {/* no need to save device error */ struct accfg_error { -uint64_t val[4 ]; +uint64_t val[4 ]; };/* parameters read from sysfs of accfg driver */
@@ -131,7 +131,7 @@ int accfg_new(struct accfg_ctx **ctx);/* override default log routine */ void accfg_set_log_fn(struct accfg_ctx *ctx, -void (*log_fn) (struct accfg_ctx * ctx, +void (*log_fn)(struct accfg_ctx *ctx, int priority, const char *file, int line, const char *fn, const char *format,
@@ -147,9 +147,9 @@ int accfg_device_disable(struct accfg_device *device, bool force);struct accfg_device *accfg_device_get_first (struct accfg_ctx *ctx);struct accfg_device *accfg_device_get_next (struct accfg_device *device);#define accfg_device_foreach (ctx, device) \ - for (device = accfg_device_get_first(ctx); \ - device != NULL; \ - device = accfg_device_get_next(device)) + for (device = accfg_device_get_first(ctx); \ + device != NULL; \ + device = accfg_device_get_next(device))struct accfg_ctx *accfg_device_get_ctx (struct accfg_device *);const char *accfg_device_get_devname (struct accfg_device *device);int accfg_device_type_validate (const char *dev_name);
@@ -184,7 +184,7 @@ int accfg_device_get_clients(struct accfg_device *device);int accfg_device_set_token_limit (struct accfg_device *dev,int val);int accfg_device_is_active (struct accfg_device *device);int accfg_device_get_cmd_status (struct accfg_device *device); -const char *accfg_device_get_cmd_status_str (struct accfg_device *device); +const char *accfg_device_get_cmd_status_str (struct accfg_device *device);struct accfg_device_mdev ;struct accfg_device_mdev *accfg_device_first_mdev (struct accfg_device *device);
@@ -205,9 +205,9 @@ struct accfg_group;struct accfg_group *accfg_group_get_first (struct accfg_device *device);struct accfg_group *accfg_group_get_next (struct accfg_group *group);#define accfg_group_foreach (device, group) \ - for (group = accfg_group_get_first(device); \ - group != NULL; \ - group = accfg_group_get_next(group)) + for (group = accfg_group_get_first(device); \ + group != NULL; \ + group = accfg_group_get_next(group))int accfg_group_get_id (struct accfg_group *group);struct accfg_group *accfg_device_group_get_by_id (struct accfg_device *device,int id);
@@ -235,9 +235,9 @@ struct accfg_wq *accfg_wq_get_next(struct accfg_wq *wq);#define accfg_wq_foreach (device, wq) \ - for (wq = accfg_wq_get_first(device); \ - wq != NULL; \ - wq = accfg_wq_get_next(wq)) + for (wq = accfg_wq_get_first(device); \ + wq != NULL; \ + wq = accfg_wq_get_next(wq))struct accfg_ctx *accfg_wq_get_ctx (struct accfg_wq *wq);struct accfg_device *accfg_wq_get_device (struct accfg_wq *wq);
@@ -268,9 +268,9 @@ int accfg_wq_set_threshold(struct accfg_wq *wq, int val);int accfg_wq_set_block_on_fault (struct accfg_wq *wq,int val);int accfg_wq_set_max_batch_size (struct accfg_wq *wq,int val);int accfg_wq_set_max_transfer_size (struct accfg_wq *wq,uint64_t val); -int accfg_wq_set_str_mode (struct accfg_wq *wq,const char * val); +int accfg_wq_set_str_mode (struct accfg_wq *wq,const char *val);int accfg_wq_set_mode (struct accfg_wq *wq,enum accfg_wq_mode mode); -int accfg_wq_set_str_type (struct accfg_wq *wq,const char * val); +int accfg_wq_set_str_type (struct accfg_wq *wq,const char *val);int accfg_wq_set_str_name (struct accfg_wq *wq,const char *val);int accfg_wq_enable (struct accfg_wq *wq);int accfg_wq_disable (struct accfg_wq *wq,bool force);
@@ -282,9 +282,9 @@ struct accfg_engine;struct accfg_engine *accfg_engine_get_first (struct accfg_device *device);struct accfg_engine *accfg_engine_get_next (struct accfg_engine *engine);#define accfg_engine_foreach (device, engine) \ - for (engine = accfg_engine_get_first(device); \ - engine != NULL; \ - engine = accfg_engine_get_next(engine)) + for (engine = accfg_engine_get_first(device); \ + engine != NULL; \ + engine = accfg_engine_get_next(engine))struct accfg_ctx *accfg_engine_get_ctx (struct accfg_engine *engine);struct accfg_device *accfg_engine_get_device (struct accfg_engine *engine);struct accfg_group *accfg_engine_get_group (struct accfg_engine *engine);
Signature · 1 line
2.26.2
ramesh.thomas at intel.com
PATCH v3 2/4 accel-config: Add compatibility mode detection
In reply to ramesh.thomas at intel.comFrom: Ramesh Thomas <ramesh.thomas(a)intel.com>
Add a flag in accfg context to store commpatibility mode. Absence of /sys/bus/dsa/drivers/idxd indicates compatibility mode.
--- accfg/lib/libaccfg.c | 4 ++++ accfg/lib/private.h | 1 + 2 files changed, 5 insertions(+)
accfg/lib/libaccfg.c +4 -0
@@ -28,6 +28,7 @@#include "private.h" #define MDEV_POSTFIX "mdev_supported_types" +#define IDXD_DRIVER_BIND_PATH "/sys/bus/dsa/drivers/idxd"const char *accfg_wq_mode_str[] = { [ACCFG_WQ_SHARED ] ="shared" ,
@@ -310,6 +311,9 @@ 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 )) + c->compat = true; +list_head_init (&c->devices);info (c,"ctx %p created\n" , c);
accfg/lib/private.h +1 -0
@@ -146,6 +146,7 @@ struct accfg_ctx {struct list_head devices;uint64_t timeout;void *private_data; +bool compat; };static inline int check_udev (struct udev *udev)
Signature · 1 line
2.26.2
ramesh.thomas at intel.com
PATCH v3 3/4 accel-config: Store bus type in device context
In reply to ramesh.thomas at intel.comFrom: Ramesh Thomas <ramesh.thomas(a)intel.com>
Store bus type in device context to be used as the driver in compat modes. It will be also used to construct driver bind paths in all modes.
--- accfg/lib/libaccfg.c | 48 ++++++++++++++++++++++++++------------------ accfg/lib/private.h | 1 + util/sysfs.c | 5 +++-- util/sysfs.h | 13 ++++++------ 4 files changed, 40 insertions(+), 27 deletions(-)
accfg/lib/libaccfg.c +29 -19
@@ -30,6 +30,12 @@#define MDEV_POSTFIX "mdev_supported_types"#define IDXD_DRIVER_BIND_PATH "/sys/bus/dsa/drivers/idxd" +char *accfg_bus_types[] = { +"dsa" , +"iax" , +NULL +}; +const char *accfg_wq_mode_str[] = { [ACCFG_WQ_SHARED ] ="shared" , [ACCFG_WQ_DEDICATED ] ="dedicated" ,
@@ -407,10 +413,11 @@ ACCFG_EXPORT void accfg_set_log_priority(struct accfg_ctx *ctx, }static int device_parse (struct accfg_ctx *ctx,const char *base_path, -char *dev_prefix,int (*filter)(const struct dirent *), +char *dev_prefix,char *bus_type, +int (*filter)(const struct dirent *),void *parent,add_dev_fn add_dev) { -return sysfs_device_parse (ctx, base_path, dev_prefix, +return sysfs_device_parse (ctx, base_path, dev_prefix, bus_type, filter, parent, add_dev); }
@@ -495,7 +502,8 @@ exit_add_mdev:return rc; } -static void *add_device (void *parent,int id,const char *ctl_base,char *dev_prefix) +static void *add_device (void *parent,int id,const char *ctl_base, +char *dev_prefix,char *bus_type) {struct accfg_ctx *ctx = parent;struct accfg_device *device;
@@ -592,6 +600,8 @@ static void *add_device(void *parent, int id, const char *ctl_base, char *dev_prif (rc <0 ) goto err_dev_path; + device->bus_type_str = bus_type; +if (device->mdev_path &&add_device_mdevs (ctx, device)) goto err_dev_path;
@@ -639,7 +649,7 @@ static int wq_parse_type(struct accfg_wq *wq, char *wq_type) }static void *add_wq (void *parent,int id,const char *wq_base, -char *dev_prefix) +char *dev_prefix,char *bus_type) {struct accfg_wq *wq;struct accfg_device *device = parent;
@@ -736,7 +746,7 @@ err_wq: }static void *add_group (void *parent,int id,const char *group_base, -char *dev_prefix) +char *dev_prefix,char *bus_type) {struct accfg_group *group;struct accfg_device *device = parent;
@@ -824,7 +834,7 @@ err_group: }static void *add_engine (void *parent,int id,const char *engine_base, -char *dev_prefix) +char *dev_prefix,char *bus_type) {struct accfg_engine *engine;struct accfg_device *device = parent;
@@ -927,14 +937,15 @@ static void groups_init(struct accfg_device *device) device->group_init =1 ;set_filename_prefix ("group" );device_parse (device->ctx, device->device_path,"group" , - filter_file_name_prefix, + device->bus_type_str, filter_file_name_prefix, device, add_group); }static void devices_init (struct accfg_ctx *ctx) {char **accel_name; -char *path; +char **bus_type; +char path[PATH_MAX ];struct accfg_device *device;if (ctx->devices_init) {
@@ -943,16 +954,15 @@ static void devices_init(struct accfg_ctx *ctx) } ctx->devices_init =1 ; -for (accel_name = accfg_basenames; *accel_name !=NULL ; - accel_name++) { -if (asprintf (&path,"/sys/bus/%s/devices" , *accel_name) <0 ) { -err (ctx,"devices_init set path failed\n" ); -continue ; +for (bus_type = accfg_bus_types; *bus_type !=NULL ; bus_type++) { +sprintf (path,"/sys/bus/%s/devices" , *bus_type); +for (accel_name = accfg_basenames; *accel_name !=NULL ; + accel_name++) { +set_filename_prefix (*accel_name); +device_parse (ctx, path, *accel_name, *bus_type, + filter_file_name_prefix, ctx, + add_device); } -set_filename_prefix (*accel_name); -device_parse (ctx, path, *accel_name, - filter_file_name_prefix, ctx, add_device); -free (path); } accfg_device_foreach(ctx, device) {
@@ -974,7 +984,7 @@ static void engines_init(struct accfg_device *device) }set_filename_prefix ("engine" );device_parse (ctx, device->device_path,"engine" , - filter_file_name_prefix, device, + device->bus_type_str, filter_file_name_prefix, device, add_engine); }
@@ -1705,7 +1715,7 @@ static void wqs_init(struct accfg_device *device) group->wqs_init =1 ; }set_filename_prefix ("wq" ); -device_parse (ctx, device->device_path,"wq" , +device_parse (ctx, device->device_path,"wq" , device->bus_type_str, filter_file_name_prefix, device, add_wq); }
accfg/lib/private.h +1 -0
@@ -32,6 +32,7 @@ struct accfg_device {char *device_path;char *mdev_path;char *device_buf; +char *bus_type_str;char *device_type_str;enum accfg_device_type type;size_t buf_len;
util/sysfs.c +3 -2
@@ -75,7 +75,8 @@ int __sysfs_write_attr_quiet(struct log_ctx *ctx, const char *path,return write_attr (ctx, path, buf,1 ); } -int __sysfs_device_parse (struct log_ctx *ctx,const char *base_path,char *dev_prefix, +int __sysfs_device_parse (struct log_ctx *ctx,const char *base_path, +char *dev_prefix,char *bus_type,int (*filter)(const struct dirent *),void *parent,add_dev_fn add_dev) {
@@ -104,7 +105,7 @@ int __sysfs_device_parse(struct log_ctx *ctx, const char *base_path, char *dev_p de->d_name, id);continue ; } - dev =add_dev (parent, id, dev_path, dev_prefix); + dev =add_dev (parent, id, dev_path, dev_prefix, bus_type);free (dev_path);if (!dev) { add_errors++;
util/sysfs.h +7 -6
@@ -8,7 +8,7 @@#include <dirent.h> typedef void *(*add_dev_fn )(void *parent,int id,const char *dev_path, -char *dev_prefix); +char *dev_prefix,char *bus_type);#define SYSFS_ATTR_SIZE 1024
@@ -17,15 +17,16 @@ int __sysfs_read_attr(struct log_ctx *ctx, const char *path, char *buf);int __sysfs_write_attr (struct log_ctx *ctx,const char *path,const char *buf);int __sysfs_write_attr_quiet (struct log_ctx *ctx,const char *path,const char *buf); -int __sysfs_device_parse (struct log_ctx *ctx,const char *base_path,char *dev_prefix, -int (*filter)(const struct dirent *), -void *parent,add_dev_fn add_dev); +int __sysfs_device_parse (struct log_ctx *ctx,const char *base_path, +char *dev_prefix,char *bus_type, +int (*filter)(const struct dirent *), +void *parent,add_dev_fn add_dev);#define sysfs_read_attr (c, p, b) __sysfs_read_attr(&(c)->ctx, (p), (b))#define sysfs_write_attr (c, p, b) __sysfs_write_attr(&(c)->ctx, (p), (b))#define sysfs_write_attr_quiet (c, p, b) __sysfs_write_attr_quiet(&(c)->ctx, (p), (b)) -#define sysfs_device_parse (c, b, d, m, p, fn) __sysfs_device_parse(&(c)->ctx, \ - (b), (d), (m), (p), (fn)) +#define sysfs_device_parse (c, b, d, bt, m, p, fn) __sysfs_device_parse(&(c)->ctx, \ + (b), (d), (bt), (m), (p), (fn))static inline const char *devpath_to_devname (const char *devpath) {
Signature · 1 line
2.26.2
ramesh.thomas at intel.com
PATCH v3 4/4 accel-config: Add support for new device bind paths
In reply to ramesh.thomas at intel.comFrom: Ramesh Thomas <ramesh.thomas(a)intel.com>
Use the per wq-type device portals to construct driver bind paths if not in compat mode. If in compat mode, use the bus type stored in driver context.
Driver bind paths in compat mode -
/sys/bus/dsa/drivers/dsa/<bind|unbind>
/sys/bus/iax/drivers/iax/<bind|unbind>
Driver bind paths in new ABI:
/sys/bus/dsa/drivers/idxd/<bind|unbind> (devices) /sys/bus/dsa/drivers/<device portal>/<bind|unbind> (wqs)
--- accfg/lib/libaccfg.c | 57 +++++++++++++++++++++++++++++++++++------ accfg/libaccel_config.h | 3 ++- 2 files changed, 51 insertions(+), 9 deletions(-)
accfg/lib/libaccfg.c +49 -8
@@ -29,6 +29,17 @@#define MDEV_POSTFIX "mdev_supported_types"#define IDXD_DRIVER_BIND_PATH "/sys/bus/dsa/drivers/idxd" +#define IDXD_DRIVER (d) ((d)->ctx->compat ? \ + (d)->bus_type_str : "idxd") +#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[] = { + [ACCFG_WQT_KERNEL ] ="idxd-kernel-portal" , + [ACCFG_WQT_USER ] ="idxd-user-portal" , + [ACCFG_WQT_MDEV ] ="idxd-mdev-portal" , +NULL +};char *accfg_bus_types[] = {"dsa" ,
@@ -640,6 +651,8 @@ static int wq_parse_type(struct accfg_wq *wq, char *wq_type) wq->type =ACCFG_WQT_KERNEL ; else if (strcmp(ptype, "user") == 0) wq->type = ACCFG_WQT_USER; + else if (strcmp(ptype, "mdev") == 0) + wq->type = ACCFG_WQT_MDEV; else wq->type = ACCFG_WQT_NONE;
@@ -1519,6 +1532,34 @@ ACCFG_EXPORT char *accfg_device_get_type_str(struct accfg_device *device)return device->device_type_str; } +static int get_driver_bind_path (char *bus_name,const char *drv_name, +char **path) +{ +char p[PATH_MAX ]; + +sprintf (p,"/sys/bus/%s/drivers/%s/bind" , bus_name, drv_name); + + *path =strdup (p); +if (!*path) +return -errno; + +return 0 ; +} + +static int get_driver_unbind_path (char *bus_name,const char *dev_name, +char **path) +{ +char p[PATH_MAX ]; + +sprintf (p,"/sys/bus/%s/devices/%s/driver/unbind" , bus_name, dev_name); + + *path =realpath (p,NULL ); +if (!*path) +return -errno; + +return 0 ; +} +/* Helper function to parse the device enable flag */ static int accfg_device_control (struct accfg_device *device,enum accfg_control_flag flag,bool force)
@@ -1533,15 +1574,15 @@ static int accfg_device_control(struct accfg_device *device, ctx =accfg_device_get_ctx (device);if (flag ==ACCFG_DEVICE_ENABLE ) { - rc =asprintf (&path,"/sys/bus/%s/drivers/%s/bind" , - device->device_type_str, device->device_type_str); + rc =get_driver_bind_path (device->bus_type_str, +IDXD_DRIVER (device), &path);if (rc <0 )return rc; }else if (flag ==ACCFG_DEVICE_DISABLE ) {int clients; - rc =asprintf (&path,"/sys/bus/%s/drivers/%s/unbind" , - device->device_type_str, device->device_type_str); + rc =get_driver_unbind_path (device->bus_type_str, +accfg_device_get_devname (device), &path);if (rc <0 )return rc;
@@ -1943,15 +1984,15 @@ static int accfg_wq_control(struct accfg_wq *wq, enum accfg_control_flag flag,const char *wq_name =accfg_wq_get_devname (wq);if (flag ==ACCFG_WQ_ENABLE ) { - rc =asprintf (&path,"/sys/bus/%s/drivers/%s/bind" , - device->device_type_str, device->device_type_str); + rc =get_driver_bind_path (device->bus_type_str, +IDXD_WQ_DEVICE_PORTAL (device, wq), &path);if (rc <0 )return rc; }else if (flag ==ACCFG_WQ_DISABLE ) {int clients; - rc =asprintf (&path,"/sys/bus/%s/drivers/%s/unbind" , - device->device_type_str, device->device_type_str); + rc =get_driver_unbind_path (device->bus_type_str, wq_name, + &path);if (rc <0 )return rc;
accfg/libaccel_config.h +2 -1
@@ -58,7 +58,8 @@ enum accfg_wq_state {enum accfg_wq_type {ACCFG_WQT_NONE =0 ,ACCFG_WQT_KERNEL , -ACCFG_WQT_USER +ACCFG_WQT_USER , +ACCFG_WQT_MDEV , };enum accfg_control_flag {
Signature · 1 line
2.26.2
Dave Jiang
Reviewed-by on the v3 seriesQuoted 54 lines · ramesh.thomas(a)intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
v3:
- Get driver unbind path from symlink in device/driver to support cases where devices get auto-boundv2:
- Fixed naming of driver bind paths to not incorrectly use "portal"
- Reworded commit messages correcting use of "portal"v1: (reworded)
The new ABI changes the way devices are enumerated in sysfs and the device portals used to bind and unbind wqs to driver. These patches add support for the new ABI as well as compatibility with the ones in older kernels.Following are the modes that are supported.
1. New ABI:
- Both iax and dsa devices will be in same bus
/sys/bus/dsa
- Different device portals for "user", "kernel" and "mdev" type wqs2. Kernel 5.11 and 5.12:
- iax and dsa will be in 2 separate buses
- Bus, device and device portal names are same3. Older kernels :
- Has only dsa bus
4. OSV having kernel with
CONFIG_INTEL_IDXD_COMPATenabled:- Only one dsa bus
- Both iax and dsa devices will be on dsa bus.
- Only one device portal for all wq typesFollowing are the changes added.
- Detect compatibility mode during init and store bus type in device contexts.
- Currently enumeration assumes device, bus and driver have the same name and relies on that to construct driver bind paths. Change it to dynamically construct the paths based on compatibility mode that was detected during init.
Ramesh Thomas (4):
accel-config: Fix some indentation and coding style issues
accel-config: Add compatibility mode detection
accel-config: Store bus type in device context
accel-config: Add support for new device bind paths
Quoted 6 lines
accfg/lib/libaccfg.c | 109 ++++++++++++++++++++++++++++++---------- accfg/lib/private.h | 70 +++++++++++++------------- accfg/libaccel_config.h | 37 +++++++------- util/sysfs.c | 5 +- util/sysfs.h | 13 ++--- 5 files changed, 147 insertions(+), 87 deletions(-)