Skip to content

Commit 9a8ddb3

Browse files
xiaochenshenvinodkoul
authored andcommitted
dmaengine: idxd: Make read buffer sysfs attributes invisible for Intel IAA
In current code, the following sysfs attributes are exposed to user to show or update the values: max_read_buffers (max_tokens) read_buffer_limit (token_limit) group/read_buffers_allowed (group/tokens_allowed) group/read_buffers_reserved (group/tokens_reserved) group/use_read_buffer_limit (group/use_token_limit) >From Intel IAA spec [1], Intel IAA does not support Read Buffer allocation control. So these sysfs attributes should not be supported on IAA device. Fix this issue by making these sysfs attributes invisible through is_visible() filter when the device is IAA. Add description in the ABI documentation to mention that these attributes are not visible when the device does not support Read Buffer allocation control. [1]: https://cdrdv2.intel.com/v1/dl/getContent/721858 Fixes: fde212e ("dmaengine: idxd: deprecate token sysfs attributes for read buffers") Fixes: c52ca47 ("dmaengine: idxd: add configuration component of driver") Signed-off-by: Xiaochen Shen <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 3e98b9b commit 9a8ddb3

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Description: The total number of read buffers supported by this device.
5050
The read buffers represent resources within the DSA
5151
implementation, and these resources are allocated by engines to
5252
support operations. See DSA spec v1.2 9.2.4 Total Read Buffers.
53+
It's not visible when the device does not support Read Buffer
54+
allocation control.
5355

5456
What: /sys/bus/dsa/devices/dsa<m>/max_transfer_size
5557
Date: Oct 25, 2019
@@ -123,6 +125,8 @@ Contact: [email protected]
123125
Description: The maximum number of read buffers that may be in use at
124126
one time by operations that access low bandwidth memory in the
125127
device. See DSA spec v1.2 9.2.8 GENCFG on Global Read Buffer Limit.
128+
It's not visible when the device does not support Read Buffer
129+
allocation control.
126130

127131
What: /sys/bus/dsa/devices/dsa<m>/cmd_status
128132
Date: Aug 28, 2020
@@ -252,6 +256,8 @@ KernelVersion: 5.17.0
252256
253257
Description: Enable the use of global read buffer limit for the group. See DSA
254258
spec v1.2 9.2.18 GRPCFG Use Global Read Buffer Limit.
259+
It's not visible when the device does not support Read Buffer
260+
allocation control.
255261

256262
What: /sys/bus/dsa/devices/group<m>.<n>/read_buffers_allowed
257263
Date: Dec 10, 2021
@@ -260,6 +266,8 @@ Contact: [email protected]
260266
Description: Indicates max number of read buffers that may be in use at one time
261267
by all engines in the group. See DSA spec v1.2 9.2.18 GRPCFG Read
262268
Buffers Allowed.
269+
It's not visible when the device does not support Read Buffer
270+
allocation control.
263271

264272
What: /sys/bus/dsa/devices/group<m>.<n>/read_buffers_reserved
265273
Date: Dec 10, 2021
@@ -268,6 +276,8 @@ Contact: [email protected]
268276
Description: Indicates the number of Read Buffers reserved for the use of
269277
engines in the group. See DSA spec v1.2 9.2.18 GRPCFG Read Buffers
270278
Reserved.
279+
It's not visible when the device does not support Read Buffer
280+
allocation control.
271281

272282
What: /sys/bus/dsa/devices/group<m>.<n>/desc_progress_limit
273283
Date: Sept 14, 2022

drivers/dma/idxd/sysfs.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,22 @@ static bool idxd_group_attr_progress_limit_invisible(struct attribute *attr,
528528
!idxd->hw.group_cap.progress_limit;
529529
}
530530

531+
static bool idxd_group_attr_read_buffers_invisible(struct attribute *attr,
532+
struct idxd_device *idxd)
533+
{
534+
/*
535+
* Intel IAA does not support Read Buffer allocation control,
536+
* make these attributes invisible.
537+
*/
538+
return (attr == &dev_attr_group_use_token_limit.attr ||
539+
attr == &dev_attr_group_use_read_buffer_limit.attr ||
540+
attr == &dev_attr_group_tokens_allowed.attr ||
541+
attr == &dev_attr_group_read_buffers_allowed.attr ||
542+
attr == &dev_attr_group_tokens_reserved.attr ||
543+
attr == &dev_attr_group_read_buffers_reserved.attr) &&
544+
idxd->data->type == IDXD_TYPE_IAX;
545+
}
546+
531547
static umode_t idxd_group_attr_visible(struct kobject *kobj,
532548
struct attribute *attr, int n)
533549
{
@@ -538,6 +554,9 @@ static umode_t idxd_group_attr_visible(struct kobject *kobj,
538554
if (idxd_group_attr_progress_limit_invisible(attr, idxd))
539555
return 0;
540556

557+
if (idxd_group_attr_read_buffers_invisible(attr, idxd))
558+
return 0;
559+
541560
return attr->mode;
542561
}
543562

@@ -1552,6 +1571,20 @@ static bool idxd_device_attr_max_batch_size_invisible(struct attribute *attr,
15521571
idxd->data->type == IDXD_TYPE_IAX;
15531572
}
15541573

1574+
static bool idxd_device_attr_read_buffers_invisible(struct attribute *attr,
1575+
struct idxd_device *idxd)
1576+
{
1577+
/*
1578+
* Intel IAA does not support Read Buffer allocation control,
1579+
* make these attributes invisible.
1580+
*/
1581+
return (attr == &dev_attr_max_tokens.attr ||
1582+
attr == &dev_attr_max_read_buffers.attr ||
1583+
attr == &dev_attr_token_limit.attr ||
1584+
attr == &dev_attr_read_buffer_limit.attr) &&
1585+
idxd->data->type == IDXD_TYPE_IAX;
1586+
}
1587+
15551588
static umode_t idxd_device_attr_visible(struct kobject *kobj,
15561589
struct attribute *attr, int n)
15571590
{
@@ -1561,6 +1594,9 @@ static umode_t idxd_device_attr_visible(struct kobject *kobj,
15611594
if (idxd_device_attr_max_batch_size_invisible(attr, idxd))
15621595
return 0;
15631596

1597+
if (idxd_device_attr_read_buffers_invisible(attr, idxd))
1598+
return 0;
1599+
15641600
return attr->mode;
15651601
}
15661602

0 commit comments

Comments
 (0)