History

drm/amdkfd: range check cp bad op exception interrupts

Due to a CP interrupt bug, bad packet garbage exception codes are raised. Do a range check so that the debugger and runtime do not receive garbage codes. Update the user api to guard exception code type checking as well.

Jonathan Kim committed 2 years ago

Commit 0cac1831 parent 78aca9e4 files · +20 −6Browse files

Showing the changes to include/uapi/linux (1 of 4 files). Show all

Unified · Split

include/uapi/linux/kfd_ioctl.h+14−3
@@ -913,14 +913,25 @@ enum kfd_dbg_trap_exception_code { · 912 unmodified lines
913913 KFD_EC_MASK(EC_DEVICE_NEW))
914914 #define KFD_EC_MASK_PROCESS (KFD_EC_MASK(EC_PROCESS_RUNTIME) | \
915915 KFD_EC_MASK(EC_PROCESS_DEVICE_REMOVE))
916+#define KFD_EC_MASK_PACKET (KFD_EC_MASK(EC_QUEUE_PACKET_DISPATCH_DIM_INVALID) | \
917+ KFD_EC_MASK(EC_QUEUE_PACKET_DISPATCH_GROUP_SEGMENT_SIZE_INVALID) | \
918+ KFD_EC_MASK(EC_QUEUE_PACKET_DISPATCH_CODE_INVALID) | \
919+ KFD_EC_MASK(EC_QUEUE_PACKET_RESERVED) | \
920+ KFD_EC_MASK(EC_QUEUE_PACKET_UNSUPPORTED) | \
921+ KFD_EC_MASK(EC_QUEUE_PACKET_DISPATCH_WORK_GROUP_SIZE_INVALID) | \
922+ KFD_EC_MASK(EC_QUEUE_PACKET_DISPATCH_REGISTER_INVALID) | \
923+ KFD_EC_MASK(EC_QUEUE_PACKET_VENDOR_UNSUPPORTED))
916924
917925 /* Checks for exception code types for KFD search */
926+#define KFD_DBG_EC_IS_VALID(ecode) (ecode > EC_NONE && ecode < EC_MAX)
918927 #define KFD_DBG_EC_TYPE_IS_QUEUE(ecode) \
919− (!!(KFD_EC_MASK(ecode) & KFD_EC_MASK_QUEUE))
928+ (KFD_DBG_EC_IS_VALID(ecode) && !!(KFD_EC_MASK(ecode) & KFD_EC_MASK_QUEUE))
920929 #define KFD_DBG_EC_TYPE_IS_DEVICE(ecode) \
921− (!!(KFD_EC_MASK(ecode) & KFD_EC_MASK_DEVICE))
930+ (KFD_DBG_EC_IS_VALID(ecode) && !!(KFD_EC_MASK(ecode) & KFD_EC_MASK_DEVICE))
922931 #define KFD_DBG_EC_TYPE_IS_PROCESS(ecode) \
923− (!!(KFD_EC_MASK(ecode) & KFD_EC_MASK_PROCESS))
932+ (KFD_DBG_EC_IS_VALID(ecode) && !!(KFD_EC_MASK(ecode) & KFD_EC_MASK_PROCESS))
933+#define KFD_DBG_EC_TYPE_IS_PACKET(ecode) \
934+ (KFD_DBG_EC_IS_VALID(ecode) && !!(KFD_EC_MASK(ecode) & KFD_EC_MASK_PACKET))
924935
925936
926937 /* Runtime enable states */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t