Skip to content

Commit 601bdad

Browse files
Fenghua Yuvinodkoul
authored andcommitted
dmaengine: idxd: Fix default allowed read buffers value in group
Currently default read buffers that is allowed in a group is 0. grpcfg will be configured to max read buffers that IDXD can support if the group's allowed read buffers value is 0. But 0 is an invalid read buffers value and user may get confused when seeing the invalid initial value 0 through sysfs interface. To show only valid allowed read buffers value and eliminate confusion, directly initialize the allowed read buffers to IDXD's max read buffers. User still can change the value through sysfs interface. Suggested-by: Ramesh Thomas <[email protected]> Signed-off-by: Fenghua Yu <[email protected]> Reviewed-by: Nikhil Rao <[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 b02e070 commit 601bdad

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

drivers/dma/idxd/device.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,11 @@ static void idxd_groups_clear_state(struct idxd_device *idxd)
699699
group->num_engines = 0;
700700
group->num_wqs = 0;
701701
group->use_rdbuf_limit = false;
702-
group->rdbufs_allowed = 0;
702+
/*
703+
* The default value is the same as the value of
704+
* total read buffers in GRPCAP.
705+
*/
706+
group->rdbufs_allowed = idxd->max_rdbufs;
703707
group->rdbufs_reserved = 0;
704708
if (idxd->hw.version <= DEVICE_VERSION_2 && !tc_override) {
705709
group->tc_a = 1;
@@ -934,11 +938,7 @@ static void idxd_group_flags_setup(struct idxd_device *idxd)
934938
group->grpcfg.flags.tc_b = group->tc_b;
935939
group->grpcfg.flags.use_rdbuf_limit = group->use_rdbuf_limit;
936940
group->grpcfg.flags.rdbufs_reserved = group->rdbufs_reserved;
937-
if (group->rdbufs_allowed)
938-
group->grpcfg.flags.rdbufs_allowed = group->rdbufs_allowed;
939-
else
940-
group->grpcfg.flags.rdbufs_allowed = idxd->max_rdbufs;
941-
941+
group->grpcfg.flags.rdbufs_allowed = group->rdbufs_allowed;
942942
group->grpcfg.flags.desc_progress_limit = group->desc_progress_limit;
943943
group->grpcfg.flags.batch_progress_limit = group->batch_progress_limit;
944944
}

drivers/dma/idxd/init.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,11 @@ static int idxd_setup_groups(struct idxd_device *idxd)
302302
group->tc_a = -1;
303303
group->tc_b = -1;
304304
}
305+
/*
306+
* The default value is the same as the value of
307+
* total read buffers in GRPCAP.
308+
*/
309+
group->rdbufs_allowed = idxd->max_rdbufs;
305310
}
306311

307312
return 0;

0 commit comments

Comments
 (0)