[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z9OP0F43CboAIxrJ@ysun46-mobl1.sh.intel.com>
Date: Fri, 14 Mar 2025 10:09:20 +0800
From: Yi Sun <yi.sun@...ux.intel.com>
To: Vinicius Costa Gomes <vinicius.gomes@...el.com>
Cc: Vinod Koul <vkoul@...nel.org>, dmaengine@...r.kernel.org,
linux-kernel@...r.kernel.org, Dave Jiang <dave.jiang@...el.com>,
Anil Keshavamurthy <anil.s.keshavamurthy@...el.com>
Subject: Re: [PATCH v1] dmaengine: idxd: Narrow the restriction on BATCH to
ver. 1 only
On 12.03.2025 15:18, Dave Jiang wrote:
>
>
>On 3/12/25 3:15 PM, Vinicius Costa Gomes wrote:
>> 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@...el.com>
>> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@...el.com>
Reported-by: Yi Sun <yi.sun@...el.com>
Tested-by: Yi Sun <yi.sun@...el.com>
>
>Reviewed-by: Dave Jiang <dave.jiang@...el.com>
>> ---
>> drivers/dma/idxd/cdev.c | 6 ++++--
>> drivers/dma/idxd/sysfs.c | 6 ++++--
>> 2 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c
>> index ff94ee892339..6a1dc15ee485 100644
>> --- a/drivers/dma/idxd/cdev.c
>> +++ b/drivers/dma/idxd/cdev.c
>> @@ -439,10 +439,12 @@ static int idxd_submit_user_descriptor(struct idxd_user_context *ctx,
>> * DSA devices are capable of indirect ("batch") command submission.
>> * On devices where direct user submissions are not safe, we cannot
>> * allow this since there is no good way for us to verify these
>> - * indirect commands.
>> + * indirect commands. Narrow the restriction of operations with the
>> + * BATCH opcode to only DSA version 1 devices.
>> */
>> if (is_dsa_dev(idxd_dev) && descriptor.opcode == DSA_OPCODE_BATCH &&
>> - !wq->idxd->user_submission_safe)
>> + wq->idxd->hw.version == DEVICE_VERSION_1 &&
>> + !wq->idxd->user_submission_safe)
>> return -EINVAL;
>> /*
>> * As per the programming specification, the completion address must be
>> diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
>> index 6af493f6ba77..9f0701021af0 100644
>> --- a/drivers/dma/idxd/sysfs.c
>> +++ b/drivers/dma/idxd/sysfs.c
>> @@ -1208,9 +1208,11 @@ static ssize_t op_cap_show_common(struct device *dev, char *buf, unsigned long *
>>
>> /* On systems where direct user submissions are not safe, we need to clear out
>> * the BATCH capability from the capability mask in sysfs since we cannot support
>> - * that command on such systems.
>> + * that command on such systems. Narrow the restriction of operations with the
>> + * BATCH opcode to only DSA version 1 devices.
>> */
>> - if (i == DSA_OPCODE_BATCH/64 && !confdev_to_idxd(dev)->user_submission_safe)
>> + if (i == DSA_OPCODE_BATCH/64 && !confdev_to_idxd(dev)->user_submission_safe &&
>> + confdev_to_idxd(dev)->hw.version == DEVICE_VERSION_1)
>> clear_bit(DSA_OPCODE_BATCH % 64, &val);
>>
>> pos += sysfs_emit_at(buf, pos, "%*pb", 64, &val);
>
>
Powered by blists - more mailing lists