Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <anil.s.keshavamurthy@intel.com>
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reported-by: Yi Sun <yi.sun@intel.com>
Tested-by: Yi Sun <yi.sun@intel.com>
Link: https://lore.kernel.org/r/20250312221511.277954-1-vinicius.gomes@intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Vinicius Costa Gomes and committed by
Vinod Koul
31f04b53 fd447415

+8 -4
+4 -2
drivers/dma/idxd/cdev.c
··· 441 441 * DSA devices are capable of indirect ("batch") command submission. 442 442 * On devices where direct user submissions are not safe, we cannot 443 443 * 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. 445 446 */ 446 447 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) 448 450 return -EINVAL; 449 451 /* 450 452 * As per the programming specification, the completion address must be
+4 -2
drivers/dma/idxd/sysfs.c
··· 1208 1208 1209 1209 /* On systems where direct user submissions are not safe, we need to clear out 1210 1210 * 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. 1212 1213 */ 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) 1214 1216 clear_bit(DSA_OPCODE_BATCH % 64, &val); 1215 1217 1216 1218 pos += sysfs_emit_at(buf, pos, "%*pb", 64, &val);