From: ramesh.thomas at intel.com
To: accel-config@lists.01.org
Subject: [Accel-config] [PATCH v2 4/4] accel-config: Add support for new device bind paths
Date: Thu, 11 Mar 2021 18:16:43 -0500 [thread overview]
Message-ID: <20210311231643.312090-5-ramesh.thomas@intel.com> (raw)
In-Reply-To: 20210311231643.312090-1-ramesh.thomas@intel.com
[-- Attachment #1: Type: text/plain, Size: 3299 bytes --]
From: 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)
Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
accfg/lib/libaccfg.c | 25 +++++++++++++++++++++----
accfg/libaccel_config.h | 3 ++-
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c
index c1b27b3..477a074 100644
--- a/accfg/lib/libaccfg.c
+++ b/accfg/lib/libaccfg.c
@@ -29,6 +29,17 @@
#define MDEV_POSTFIX "mdev_supported_types"
#define IDXD_DRIVER_BIND_PATH "/sys/bus/dsa/drivers/idxd"
+#define IDXD_DRIVER(c, d) ((c)->compat ? \
+ (d)->bus_type_str : "idxd")
+#define IDXD_WQ_DEVICE_PORTAL(c, d, w) ((c)->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;
@@ -1534,14 +1547,16 @@ static int accfg_device_control(struct accfg_device *device,
if (flag == ACCFG_DEVICE_ENABLE) {
rc = asprintf(&path, "/sys/bus/%s/drivers/%s/bind",
- device->device_type_str, device->device_type_str);
+ device->bus_type_str,
+ IDXD_DRIVER(ctx, device));
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);
+ device->bus_type_str,
+ IDXD_DRIVER(ctx, device));
if (rc < 0)
return rc;
@@ -1944,14 +1959,16 @@ static int accfg_wq_control(struct accfg_wq *wq, enum accfg_control_flag flag,
if (flag == ACCFG_WQ_ENABLE) {
rc = asprintf(&path, "/sys/bus/%s/drivers/%s/bind",
- device->device_type_str, device->device_type_str);
+ device->bus_type_str,
+ IDXD_WQ_DEVICE_PORTAL(ctx, device, wq));
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);
+ device->bus_type_str,
+ IDXD_WQ_DEVICE_PORTAL(ctx, device, wq));
if (rc < 0)
return rc;
diff --git a/accfg/libaccel_config.h b/accfg/libaccel_config.h
index 091c388..b7b64c4 100644
--- a/accfg/libaccel_config.h
+++ b/accfg/libaccel_config.h
@@ -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 {
--
2.26.2
reply other threads:[~2021-03-11 23:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210311231643.312090-5-ramesh.thomas@intel.com \
--to=accel-config@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.