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: Add debug prints for command submission

Add debug prints to help diagnose issues with incoming command submissions.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260316175642.1451749-1-lizhi.hou@amd.com

Lizhi Hou 8ed8b023 6955d6bc

+29 -5
+29 -5
drivers/accel/amdxdna/aie2_message.c
··· 1002 1002 struct amdxdna_cmd_chain *payload; 1003 1003 struct xdna_mailbox_msg msg; 1004 1004 union exec_chain_req req; 1005 - u32 payload_len; 1005 + u32 payload_len, ccnt; 1006 1006 u32 offset = 0; 1007 1007 size_t size; 1008 1008 int ret; ··· 1011 1011 1012 1012 op = amdxdna_cmd_get_op(cmd_abo); 1013 1013 payload = amdxdna_cmd_get_payload(cmd_abo, &payload_len); 1014 - if (op != ERT_CMD_CHAIN || !payload || 1015 - payload_len < struct_size(payload, data, payload->command_count)) 1014 + if (op != ERT_CMD_CHAIN) { 1015 + XDNA_DBG(xdna, "Invalid op code %d", op); 1016 1016 return -EINVAL; 1017 + } 1018 + 1019 + if (!payload) { 1020 + XDNA_DBG(xdna, "Failed to get command payload"); 1021 + return -EINVAL; 1022 + } 1023 + 1024 + ccnt = payload->command_count; 1025 + if (payload_len < struct_size(payload, data, ccnt)) { 1026 + XDNA_DBG(xdna, "Invalid command count %d", ccnt); 1027 + return -EINVAL; 1028 + } 1017 1029 1018 1030 op = ERT_INVALID_CMD; 1019 - for (i = 0; i < payload->command_count; i++) { 1031 + for (i = 0; i < ccnt; i++) { 1020 1032 u32 boh = (u32)(payload->data[i]); 1021 1033 struct amdxdna_gem_obj *abo; 1022 1034 ··· 1047 1035 1048 1036 offset += size; 1049 1037 } 1038 + 1039 + XDNA_DBG(xdna, "Total %d commands:", ccnt); 1040 + print_hex_dump_debug("cmdbufs: ", DUMP_PREFIX_OFFSET, 16, 4, 1041 + cmdbuf_abo->mem.kva, offset, false); 1042 + 1050 1043 msg.opcode = EXEC_MSG_OPS(xdna)->get_chain_msg_op(op); 1051 1044 if (msg.opcode == MSG_OP_MAX_OPCODE) 1052 1045 return -EOPNOTSUPP; 1053 1046 1054 1047 /* The offset is the accumulated total size of the cmd buffer */ 1055 1048 EXEC_MSG_OPS(xdna)->init_chain_req(&req, cmdbuf_abo->mem.dev_addr, 1056 - offset, payload->command_count); 1049 + offset, ccnt); 1057 1050 drm_clflush_virt_range(cmdbuf_abo->mem.kva, offset); 1058 1051 1059 1052 msg.handle = job; 1060 1053 msg.notify_cb = notify_cb; 1061 1054 msg.send_data = (u8 *)&req; 1062 1055 msg.send_size = sizeof(req); 1056 + print_hex_dump_debug("cmdlist msg: ", DUMP_PREFIX_OFFSET, 16, 4, 1057 + &req, msg.send_size, false); 1063 1058 ret = xdna_mailbox_send_msg(chann, &msg, TX_TIMEOUT); 1064 1059 if (ret) { 1065 1060 XDNA_ERR(xdna, "Send message failed"); ··· 1095 1076 if (ret) 1096 1077 return ret; 1097 1078 1079 + print_hex_dump_debug("cmdbuf: ", DUMP_PREFIX_OFFSET, 16, 4, 1080 + cmdbuf_abo->mem.kva, size, false); 1081 + 1098 1082 msg.opcode = EXEC_MSG_OPS(xdna)->get_chain_msg_op(op); 1099 1083 if (msg.opcode == MSG_OP_MAX_OPCODE) 1100 1084 return -EOPNOTSUPP; ··· 1110 1088 msg.notify_cb = notify_cb; 1111 1089 msg.send_data = (u8 *)&req; 1112 1090 msg.send_size = sizeof(req); 1091 + print_hex_dump_debug("cmdlist msg: ", DUMP_PREFIX_OFFSET, 16, 4, 1092 + &req, msg.send_size, false); 1113 1093 ret = xdna_mailbox_send_msg(chann, &msg, TX_TIMEOUT); 1114 1094 if (ret) { 1115 1095 XDNA_ERR(hwctx->client->xdna, "Send message failed");