public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lizhi Hou <lizhi.hou@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
	<ogabbay@kernel.org>, <quic_jhugo@quicinc.com>,
	<jacek.lawrynowicz@linux.intel.com>,
	<dri-devel@lists.freedesktop.org>
Cc: <linux-kernel@vger.kernel.org>, <min.ma@amd.com>,
	<max.zhen@amd.com>, <sonal.santan@amd.com>, <king.tam@amd.com>
Subject: Re: [PATCH V1] accel/amdxdna: Support submit commands without arguments
Date: Wed, 7 May 2025 10:31:25 -0700	[thread overview]
Message-ID: <670ccea1-5315-bbe5-995f-10aefabf9c28@amd.com> (raw)
In-Reply-To: <4534597b-70a0-4c6b-9ff5-950e69ca7b37@amd.com>


On 5/7/25 09:29, Mario Limonciello wrote:
> On 5/7/2025 11:15 AM, Lizhi Hou wrote:
>> The latest userspace runtime allows generating commands which do not
>> have any argument. Remove the corresponding check in driver IOCTL to
>> enable this use case.
>>
>> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
>
> Can the userspace handle discovery of the difference?  Or does this 
> need any sort of ABI discovery command introduced too?
>
> The code change itself below looks good to me though.

Runtime will capture and handle the error with current driver.

Even if runtime have a way to explicitly discovery the different, it 
will just report an error and fail the case.


Thanks,

Lizhi

>
> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
>
>> ---
>>   drivers/accel/amdxdna/amdxdna_ctx.c | 22 ++++++++++++----------
>>   1 file changed, 12 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/accel/amdxdna/amdxdna_ctx.c 
>> b/drivers/accel/amdxdna/amdxdna_ctx.c
>> index 43442b9e273b..be073224bd69 100644
>> --- a/drivers/accel/amdxdna/amdxdna_ctx.c
>> +++ b/drivers/accel/amdxdna/amdxdna_ctx.c
>> @@ -496,11 +496,11 @@ static int amdxdna_drm_submit_execbuf(struct 
>> amdxdna_client *client,
>>                         struct amdxdna_drm_exec_cmd *args)
>>   {
>>       struct amdxdna_dev *xdna = client->xdna;
>> -    u32 *arg_bo_hdls;
>> +    u32 *arg_bo_hdls = NULL;
>>       u32 cmd_bo_hdl;
>>       int ret;
>>   -    if (!args->arg_count || args->arg_count > MAX_ARG_COUNT) {
>> +    if (args->arg_count > MAX_ARG_COUNT) {
>>           XDNA_ERR(xdna, "Invalid arg bo count %d", args->arg_count);
>>           return -EINVAL;
>>       }
>> @@ -512,14 +512,16 @@ static int amdxdna_drm_submit_execbuf(struct 
>> amdxdna_client *client,
>>       }
>>         cmd_bo_hdl = (u32)args->cmd_handles;
>> -    arg_bo_hdls = kcalloc(args->arg_count, sizeof(u32), GFP_KERNEL);
>> -    if (!arg_bo_hdls)
>> -        return -ENOMEM;
>> -    ret = copy_from_user(arg_bo_hdls, u64_to_user_ptr(args->args),
>> -                 args->arg_count * sizeof(u32));
>> -    if (ret) {
>> -        ret = -EFAULT;
>> -        goto free_cmd_bo_hdls;
>> +    if (args->arg_count) {
>> +        arg_bo_hdls = kcalloc(args->arg_count, sizeof(u32), 
>> GFP_KERNEL);
>> +        if (!arg_bo_hdls)
>> +            return -ENOMEM;
>> +        ret = copy_from_user(arg_bo_hdls, u64_to_user_ptr(args->args),
>> +                     args->arg_count * sizeof(u32));
>> +        if (ret) {
>> +            ret = -EFAULT;
>> +            goto free_cmd_bo_hdls;
>> +        }
>>       }
>>         ret = amdxdna_cmd_submit(client, cmd_bo_hdl, arg_bo_hdls,
>

  reply	other threads:[~2025-05-07 17:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07 16:15 [PATCH V1] accel/amdxdna: Support submit commands without arguments Lizhi Hou
2025-05-07 16:29 ` Mario Limonciello
2025-05-07 17:31   ` Lizhi Hou [this message]
2025-05-08 17:09     ` Lizhi Hou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=670ccea1-5315-bbe5-995f-10aefabf9c28@amd.com \
    --to=lizhi.hou@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jacek.lawrynowicz@linux.intel.com \
    --cc=king.tam@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=max.zhen@amd.com \
    --cc=min.ma@amd.com \
    --cc=ogabbay@kernel.org \
    --cc=quic_jhugo@quicinc.com \
    --cc=sonal.santan@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox