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

Configure Feed

Select the types of activity you want to include in your feed.

accel/amdxdna: Support submit commands without arguments

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.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://lore.kernel.org/r/20250507161500.2339701-1-lizhi.hou@amd.com
Link: https://lore.kernel.org/r/20250507161500.2339701-1-lizhi.hou@amd.com

+12 -10
+12 -10
drivers/accel/amdxdna/amdxdna_ctx.c
··· 496 496 struct amdxdna_drm_exec_cmd *args) 497 497 { 498 498 struct amdxdna_dev *xdna = client->xdna; 499 - u32 *arg_bo_hdls; 499 + u32 *arg_bo_hdls = NULL; 500 500 u32 cmd_bo_hdl; 501 501 int ret; 502 502 503 - if (!args->arg_count || args->arg_count > MAX_ARG_COUNT) { 503 + if (args->arg_count > MAX_ARG_COUNT) { 504 504 XDNA_ERR(xdna, "Invalid arg bo count %d", args->arg_count); 505 505 return -EINVAL; 506 506 } ··· 512 512 } 513 513 514 514 cmd_bo_hdl = (u32)args->cmd_handles; 515 - arg_bo_hdls = kcalloc(args->arg_count, sizeof(u32), GFP_KERNEL); 516 - if (!arg_bo_hdls) 517 - return -ENOMEM; 518 - ret = copy_from_user(arg_bo_hdls, u64_to_user_ptr(args->args), 519 - args->arg_count * sizeof(u32)); 520 - if (ret) { 521 - ret = -EFAULT; 522 - goto free_cmd_bo_hdls; 515 + if (args->arg_count) { 516 + arg_bo_hdls = kcalloc(args->arg_count, sizeof(u32), GFP_KERNEL); 517 + if (!arg_bo_hdls) 518 + return -ENOMEM; 519 + ret = copy_from_user(arg_bo_hdls, u64_to_user_ptr(args->args), 520 + args->arg_count * sizeof(u32)); 521 + if (ret) { 522 + ret = -EFAULT; 523 + goto free_cmd_bo_hdls; 524 + } 523 525 } 524 526 525 527 ret = amdxdna_cmd_submit(client, cmd_bo_hdl, arg_bo_hdls,