Skip to content

Commit 31f04b5

Browse files
vcgomesvinodkoul
authored andcommitted
dmaengine: idxd: Narrow the restriction on BATCH to ver. 1 only
Allow BATCH operations to be submitted and the capability to be exposed for DSA version 2 (or later) devices. DSA version 2 devices allow safe submission of BATCH operations. Signed-off-by: Anil Keshavamurthy <[email protected]> Signed-off-by: Vinicius Costa Gomes <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Reported-by: Yi Sun <[email protected]> Tested-by: Yi Sun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent fd44741 commit 31f04b5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

drivers/dma/idxd/cdev.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,12 @@ static int idxd_submit_user_descriptor(struct idxd_user_context *ctx,
441441
* DSA devices are capable of indirect ("batch") command submission.
442442
* On devices where direct user submissions are not safe, we cannot
443443
* allow this since there is no good way for us to verify these
444-
* indirect commands.
444+
* indirect commands. Narrow the restriction of operations with the
445+
* BATCH opcode to only DSA version 1 devices.
445446
*/
446447
if (is_dsa_dev(idxd_dev) && descriptor.opcode == DSA_OPCODE_BATCH &&
447-
!wq->idxd->user_submission_safe)
448+
wq->idxd->hw.version == DEVICE_VERSION_1 &&
449+
!wq->idxd->user_submission_safe)
448450
return -EINVAL;
449451
/*
450452
* As per the programming specification, the completion address must be

drivers/dma/idxd/sysfs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,9 +1208,11 @@ static ssize_t op_cap_show_common(struct device *dev, char *buf, unsigned long *
12081208

12091209
/* On systems where direct user submissions are not safe, we need to clear out
12101210
* the BATCH capability from the capability mask in sysfs since we cannot support
1211-
* that command on such systems.
1211+
* that command on such systems. Narrow the restriction of operations with the
1212+
* BATCH opcode to only DSA version 1 devices.
12121213
*/
1213-
if (i == DSA_OPCODE_BATCH/64 && !confdev_to_idxd(dev)->user_submission_safe)
1214+
if (i == DSA_OPCODE_BATCH/64 && !confdev_to_idxd(dev)->user_submission_safe &&
1215+
confdev_to_idxd(dev)->hw.version == DEVICE_VERSION_1)
12141216
clear_bit(DSA_OPCODE_BATCH % 64, &val);
12151217

12161218
pos += sysfs_emit_at(buf, pos, "%*pb", 64, &val);

0 commit comments

Comments
 (0)