Skip to content

Commit fde212e

Browse files
davejiangvinodkoul
authored andcommitted
dmaengine: idxd: deprecate token sysfs attributes for read buffers
The following sysfs attributes will be obsolete due to the name change of tokens to read buffers: max_tokens token_limit group/tokens_allowed group/tokens_reserved group/use_token_limit Create new entries and have old entry print warning of deprecation. New attributes to replace the token ones: max_read_buffers read_buffer_limit group/read_buffers_allowed group/read_buffers_reserved group/use_read_buffer_limit Signed-off-by: Dave Jiang <[email protected]> Link: https://lore.kernel.org/r/163951339488.2988321.2424012059911316373.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul <[email protected]>
1 parent 7ed6f1b commit fde212e

File tree

2 files changed

+153
-39
lines changed

2 files changed

+153
-39
lines changed

Documentation/ABI/stable/sysfs-driver-dma-idxd

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ KernelVersion: 5.6.0
4141
4242
Description: The maximum number of groups can be created under this device.
4343

44-
What: /sys/bus/dsa/devices/dsa<m>/max_tokens
45-
Date: Oct 25, 2019
46-
KernelVersion: 5.6.0
44+
What: /sys/bus/dsa/devices/dsa<m>/max_read_buffers
45+
Date: Dec 10, 2021
46+
KernelVersion: 5.17.0
4747
48-
Description: The total number of bandwidth tokens supported by this device.
49-
The bandwidth tokens represent resources within the DSA
48+
Description: The total number of read buffers supported by this device.
49+
The read buffers represent resources within the DSA
5050
implementation, and these resources are allocated by engines to
51-
support operations.
51+
support operations. See DSA spec v1.2 9.2.4 Total Read Buffers.
5252

5353
What: /sys/bus/dsa/devices/dsa<m>/max_transfer_size
5454
Date: Oct 25, 2019
@@ -115,13 +115,13 @@ KernelVersion: 5.6.0
115115
116116
Description: To indicate if this device is configurable or not.
117117

118-
What: /sys/bus/dsa/devices/dsa<m>/token_limit
119-
Date: Oct 25, 2019
120-
KernelVersion: 5.6.0
118+
What: /sys/bus/dsa/devices/dsa<m>/read_buffer_limit
119+
Date: Dec 10, 2021
120+
KernelVersion: 5.17.0
121121
122-
Description: The maximum number of bandwidth tokens that may be in use at
122+
Description: The maximum number of read buffers that may be in use at
123123
one time by operations that access low bandwidth memory in the
124-
device.
124+
device. See DSA spec v1.2 9.2.8 GENCFG on Global Read Buffer Limit.
125125

126126
What: /sys/bus/dsa/devices/dsa<m>/cmd_status
127127
Date: Aug 28, 2020
@@ -224,11 +224,34 @@ What: /sys/bus/dsa/devices/wq<m>.<n>/enqcmds_retries
224224
Date Oct 29, 2021
225225
KernelVersion: 5.17.0
226226
227-
Description: Indicate the number of retires for an enqcmds submission on a shared wq.
227+
Description: Indicate the number of retires for an enqcmds submission on a sharedwq.
228228
A max value to set attribute is capped at 64.
229229

230230
What: /sys/bus/dsa/devices/engine<m>.<n>/group_id
231231
Date: Oct 25, 2019
232232
KernelVersion: 5.6.0
233233
234234
Description: The group that this engine belongs to.
235+
236+
What: /sys/bus/dsa/devices/group<m>.<n>/use_read_buffer_limit
237+
Date: Dec 10, 2021
238+
KernelVersion: 5.17.0
239+
240+
Description: Enable the use of global read buffer limit for the group. See DSA
241+
spec v1.2 9.2.18 GRPCFG Use Global Read Buffer Limit.
242+
243+
What: /sys/bus/dsa/devices/group<m>.<n>/read_buffers_allowed
244+
Date: Dec 10, 2021
245+
KernelVersion: 5.17.0
246+
247+
Description: Indicates max number of read buffers that may be in use at one time
248+
by all engines in the group. See DSA spec v1.2 9.2.18 GRPCFG Read
249+
Buffers Allowed.
250+
251+
What: /sys/bus/dsa/devices/group<m>.<n>/read_buffers_reserved
252+
Date: Dec 10, 2021
253+
KernelVersion: 5.17.0
254+
255+
Description: Indicates the number of Read Buffers reserved for the use of
256+
engines in the group. See DSA spec v1.2 9.2.18 GRPCFG Read Buffers
257+
Reserved.

drivers/dma/idxd/sysfs.c

Lines changed: 118 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,26 @@ static void idxd_set_free_rdbufs(struct idxd_device *idxd)
112112
idxd->nr_rdbufs = idxd->max_rdbufs - rdbufs;
113113
}
114114

115-
static ssize_t group_tokens_reserved_show(struct device *dev,
116-
struct device_attribute *attr,
117-
char *buf)
115+
static ssize_t group_read_buffers_reserved_show(struct device *dev,
116+
struct device_attribute *attr,
117+
char *buf)
118118
{
119119
struct idxd_group *group = confdev_to_group(dev);
120120

121121
return sysfs_emit(buf, "%u\n", group->rdbufs_reserved);
122122
}
123123

124-
static ssize_t group_tokens_reserved_store(struct device *dev,
125-
struct device_attribute *attr,
126-
const char *buf, size_t count)
124+
static ssize_t group_tokens_reserved_show(struct device *dev,
125+
struct device_attribute *attr,
126+
char *buf)
127+
{
128+
dev_warn_once(dev, "attribute deprecated, see read_buffers_reserved.\n");
129+
return group_read_buffers_reserved_show(dev, attr, buf);
130+
}
131+
132+
static ssize_t group_read_buffers_reserved_store(struct device *dev,
133+
struct device_attribute *attr,
134+
const char *buf, size_t count)
127135
{
128136
struct idxd_group *group = confdev_to_group(dev);
129137
struct idxd_device *idxd = group->idxd;
@@ -154,22 +162,42 @@ static ssize_t group_tokens_reserved_store(struct device *dev,
154162
return count;
155163
}
156164

165+
static ssize_t group_tokens_reserved_store(struct device *dev,
166+
struct device_attribute *attr,
167+
const char *buf, size_t count)
168+
{
169+
dev_warn_once(dev, "attribute deprecated, see read_buffers_reserved.\n");
170+
return group_read_buffers_reserved_store(dev, attr, buf, count);
171+
}
172+
157173
static struct device_attribute dev_attr_group_tokens_reserved =
158174
__ATTR(tokens_reserved, 0644, group_tokens_reserved_show,
159175
group_tokens_reserved_store);
160176

161-
static ssize_t group_tokens_allowed_show(struct device *dev,
162-
struct device_attribute *attr,
163-
char *buf)
177+
static struct device_attribute dev_attr_group_read_buffers_reserved =
178+
__ATTR(read_buffers_reserved, 0644, group_read_buffers_reserved_show,
179+
group_read_buffers_reserved_store);
180+
181+
static ssize_t group_read_buffers_allowed_show(struct device *dev,
182+
struct device_attribute *attr,
183+
char *buf)
164184
{
165185
struct idxd_group *group = confdev_to_group(dev);
166186

167187
return sysfs_emit(buf, "%u\n", group->rdbufs_allowed);
168188
}
169189

170-
static ssize_t group_tokens_allowed_store(struct device *dev,
171-
struct device_attribute *attr,
172-
const char *buf, size_t count)
190+
static ssize_t group_tokens_allowed_show(struct device *dev,
191+
struct device_attribute *attr,
192+
char *buf)
193+
{
194+
dev_warn_once(dev, "attribute deprecated, see read_buffers_allowed.\n");
195+
return group_read_buffers_allowed_show(dev, attr, buf);
196+
}
197+
198+
static ssize_t group_read_buffers_allowed_store(struct device *dev,
199+
struct device_attribute *attr,
200+
const char *buf, size_t count)
173201
{
174202
struct idxd_group *group = confdev_to_group(dev);
175203
struct idxd_device *idxd = group->idxd;
@@ -197,22 +225,42 @@ static ssize_t group_tokens_allowed_store(struct device *dev,
197225
return count;
198226
}
199227

228+
static ssize_t group_tokens_allowed_store(struct device *dev,
229+
struct device_attribute *attr,
230+
const char *buf, size_t count)
231+
{
232+
dev_warn_once(dev, "attribute deprecated, see read_buffers_allowed.\n");
233+
return group_read_buffers_allowed_store(dev, attr, buf, count);
234+
}
235+
200236
static struct device_attribute dev_attr_group_tokens_allowed =
201237
__ATTR(tokens_allowed, 0644, group_tokens_allowed_show,
202238
group_tokens_allowed_store);
203239

204-
static ssize_t group_use_token_limit_show(struct device *dev,
205-
struct device_attribute *attr,
206-
char *buf)
240+
static struct device_attribute dev_attr_group_read_buffers_allowed =
241+
__ATTR(read_buffers_allowed, 0644, group_read_buffers_allowed_show,
242+
group_read_buffers_allowed_store);
243+
244+
static ssize_t group_use_read_buffer_limit_show(struct device *dev,
245+
struct device_attribute *attr,
246+
char *buf)
207247
{
208248
struct idxd_group *group = confdev_to_group(dev);
209249

210250
return sysfs_emit(buf, "%u\n", group->use_rdbuf_limit);
211251
}
212252

213-
static ssize_t group_use_token_limit_store(struct device *dev,
214-
struct device_attribute *attr,
215-
const char *buf, size_t count)
253+
static ssize_t group_use_token_limit_show(struct device *dev,
254+
struct device_attribute *attr,
255+
char *buf)
256+
{
257+
dev_warn_once(dev, "attribute deprecated, see use_read_buffer_limit.\n");
258+
return group_use_read_buffer_limit_show(dev, attr, buf);
259+
}
260+
261+
static ssize_t group_use_read_buffer_limit_store(struct device *dev,
262+
struct device_attribute *attr,
263+
const char *buf, size_t count)
216264
{
217265
struct idxd_group *group = confdev_to_group(dev);
218266
struct idxd_device *idxd = group->idxd;
@@ -239,10 +287,22 @@ static ssize_t group_use_token_limit_store(struct device *dev,
239287
return count;
240288
}
241289

290+
static ssize_t group_use_token_limit_store(struct device *dev,
291+
struct device_attribute *attr,
292+
const char *buf, size_t count)
293+
{
294+
dev_warn_once(dev, "attribute deprecated, see use_read_buffer_limit.\n");
295+
return group_use_read_buffer_limit_store(dev, attr, buf, count);
296+
}
297+
242298
static struct device_attribute dev_attr_group_use_token_limit =
243299
__ATTR(use_token_limit, 0644, group_use_token_limit_show,
244300
group_use_token_limit_store);
245301

302+
static struct device_attribute dev_attr_group_use_read_buffer_limit =
303+
__ATTR(use_read_buffer_limit, 0644, group_use_read_buffer_limit_show,
304+
group_use_read_buffer_limit_store);
305+
246306
static ssize_t group_engines_show(struct device *dev,
247307
struct device_attribute *attr, char *buf)
248308
{
@@ -387,8 +447,11 @@ static struct attribute *idxd_group_attributes[] = {
387447
&dev_attr_group_work_queues.attr,
388448
&dev_attr_group_engines.attr,
389449
&dev_attr_group_use_token_limit.attr,
450+
&dev_attr_group_use_read_buffer_limit.attr,
390451
&dev_attr_group_tokens_allowed.attr,
452+
&dev_attr_group_read_buffers_allowed.attr,
391453
&dev_attr_group_tokens_reserved.attr,
454+
&dev_attr_group_read_buffers_reserved.attr,
392455
&dev_attr_group_traffic_class_a.attr,
393456
&dev_attr_group_traffic_class_b.attr,
394457
NULL,
@@ -1192,26 +1255,42 @@ static ssize_t errors_show(struct device *dev,
11921255
}
11931256
static DEVICE_ATTR_RO(errors);
11941257

1195-
static ssize_t max_tokens_show(struct device *dev,
1196-
struct device_attribute *attr, char *buf)
1258+
static ssize_t max_read_buffers_show(struct device *dev,
1259+
struct device_attribute *attr, char *buf)
11971260
{
11981261
struct idxd_device *idxd = confdev_to_idxd(dev);
11991262

12001263
return sysfs_emit(buf, "%u\n", idxd->max_rdbufs);
12011264
}
1202-
static DEVICE_ATTR_RO(max_tokens);
12031265

1204-
static ssize_t token_limit_show(struct device *dev,
1205-
struct device_attribute *attr, char *buf)
1266+
static ssize_t max_tokens_show(struct device *dev,
1267+
struct device_attribute *attr, char *buf)
1268+
{
1269+
dev_warn_once(dev, "attribute deprecated, see max_read_buffers.\n");
1270+
return max_read_buffers_show(dev, attr, buf);
1271+
}
1272+
1273+
static DEVICE_ATTR_RO(max_tokens); /* deprecated */
1274+
static DEVICE_ATTR_RO(max_read_buffers);
1275+
1276+
static ssize_t read_buffer_limit_show(struct device *dev,
1277+
struct device_attribute *attr, char *buf)
12061278
{
12071279
struct idxd_device *idxd = confdev_to_idxd(dev);
12081280

12091281
return sysfs_emit(buf, "%u\n", idxd->rdbuf_limit);
12101282
}
12111283

1212-
static ssize_t token_limit_store(struct device *dev,
1213-
struct device_attribute *attr,
1214-
const char *buf, size_t count)
1284+
static ssize_t token_limit_show(struct device *dev,
1285+
struct device_attribute *attr, char *buf)
1286+
{
1287+
dev_warn_once(dev, "attribute deprecated, see read_buffer_limit.\n");
1288+
return read_buffer_limit_show(dev, attr, buf);
1289+
}
1290+
1291+
static ssize_t read_buffer_limit_store(struct device *dev,
1292+
struct device_attribute *attr,
1293+
const char *buf, size_t count)
12151294
{
12161295
struct idxd_device *idxd = confdev_to_idxd(dev);
12171296
unsigned long val;
@@ -1236,7 +1315,17 @@ static ssize_t token_limit_store(struct device *dev,
12361315
idxd->rdbuf_limit = val;
12371316
return count;
12381317
}
1239-
static DEVICE_ATTR_RW(token_limit);
1318+
1319+
static ssize_t token_limit_store(struct device *dev,
1320+
struct device_attribute *attr,
1321+
const char *buf, size_t count)
1322+
{
1323+
dev_warn_once(dev, "attribute deprecated, see read_buffer_limit\n");
1324+
return read_buffer_limit_store(dev, attr, buf, count);
1325+
}
1326+
1327+
static DEVICE_ATTR_RW(token_limit); /* deprecated */
1328+
static DEVICE_ATTR_RW(read_buffer_limit);
12401329

12411330
static ssize_t cdev_major_show(struct device *dev,
12421331
struct device_attribute *attr, char *buf)
@@ -1282,7 +1371,9 @@ static struct attribute *idxd_device_attributes[] = {
12821371
&dev_attr_state.attr,
12831372
&dev_attr_errors.attr,
12841373
&dev_attr_max_tokens.attr,
1374+
&dev_attr_max_read_buffers.attr,
12851375
&dev_attr_token_limit.attr,
1376+
&dev_attr_read_buffer_limit.attr,
12861377
&dev_attr_cdev_major.attr,
12871378
&dev_attr_cmd_status.attr,
12881379
NULL,

0 commit comments

Comments
 (0)