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.

drm/xe: Pack fault type and level into a u8

Pack the fault type and level fields into a single u8 to save space in
struct xe_pagefault. This also makes future extensions easier.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Francois Dugast <francois.dugast@intel.com>
Link: https://patch.msgid.link/20260212204227.2764054-2-matthew.brost@intel.com

+20 -15
+6 -3
drivers/gpu/drm/xe/xe_guc_pagefault.c
··· 76 76 PFD_VIRTUAL_ADDR_LO_SHIFT); 77 77 pf.consumer.asid = FIELD_GET(PFD_ASID, msg[1]); 78 78 pf.consumer.access_type = FIELD_GET(PFD_ACCESS_TYPE, msg[2]); 79 - pf.consumer.fault_type = FIELD_GET(PFD_FAULT_TYPE, msg[2]); 80 79 if (FIELD_GET(XE2_PFD_TRVA_FAULT, msg[0])) 81 - pf.consumer.fault_level = XE_PAGEFAULT_LEVEL_NACK; 80 + pf.consumer.fault_type_level = XE_PAGEFAULT_TYPE_LEVEL_NACK; 82 81 else 83 - pf.consumer.fault_level = FIELD_GET(PFD_FAULT_LEVEL, msg[0]); 82 + pf.consumer.fault_type_level = 83 + FIELD_PREP(XE_PAGEFAULT_LEVEL_MASK, 84 + FIELD_GET(PFD_FAULT_LEVEL, msg[0])) | 85 + FIELD_PREP(XE_PAGEFAULT_TYPE_MASK, 86 + FIELD_GET(PFD_FAULT_TYPE, msg[2])); 84 87 pf.consumer.engine_class = FIELD_GET(PFD_ENG_CLASS, msg[0]); 85 88 pf.consumer.engine_instance = FIELD_GET(PFD_ENG_INSTANCE, msg[0]); 86 89
+7 -5
drivers/gpu/drm/xe/xe_pagefault.c
··· 164 164 bool atomic; 165 165 166 166 /* Producer flagged this fault to be nacked */ 167 - if (pf->consumer.fault_level == XE_PAGEFAULT_LEVEL_NACK) 167 + if (pf->consumer.fault_type_level == XE_PAGEFAULT_TYPE_LEVEL_NACK) 168 168 return -EFAULT; 169 169 170 170 vm = xe_pagefault_asid_to_vm(xe, pf->consumer.asid); ··· 225 225 { 226 226 xe_gt_info(pf->gt, "\n\tASID: %d\n" 227 227 "\tFaulted Address: 0x%08x%08x\n" 228 - "\tFaultType: %d\n" 228 + "\tFaultType: %lu\n" 229 229 "\tAccessType: %d\n" 230 - "\tFaultLevel: %d\n" 230 + "\tFaultLevel: %lu\n" 231 231 "\tEngineClass: %d %s\n" 232 232 "\tEngineInstance: %d\n", 233 233 pf->consumer.asid, 234 234 upper_32_bits(pf->consumer.page_addr), 235 235 lower_32_bits(pf->consumer.page_addr), 236 - pf->consumer.fault_type, 236 + FIELD_GET(XE_PAGEFAULT_TYPE_MASK, 237 + pf->consumer.fault_type_level), 237 238 pf->consumer.access_type, 238 - pf->consumer.fault_level, 239 + FIELD_GET(XE_PAGEFAULT_LEVEL_MASK, 240 + pf->consumer.fault_type_level), 239 241 pf->consumer.engine_class, 240 242 xe_hw_engine_class_to_str(pf->consumer.engine_class), 241 243 pf->consumer.engine_instance);
+7 -7
drivers/gpu/drm/xe/xe_pagefault_types.h
··· 73 73 */ 74 74 u8 access_type; 75 75 /** 76 - * @consumer.fault_type: fault type, u8 rather than enum to 77 - * keep size compact 76 + * @consumer.fault_type_level: fault type and level, u8 rather 77 + * than enum to keep size compact 78 78 */ 79 - u8 fault_type; 80 - #define XE_PAGEFAULT_LEVEL_NACK 0xff /* Producer indicates nack fault */ 81 - /** @consumer.fault_level: fault level */ 82 - u8 fault_level; 79 + u8 fault_type_level; 80 + #define XE_PAGEFAULT_TYPE_LEVEL_NACK 0xff /* Producer indicates nack fault */ 81 + #define XE_PAGEFAULT_LEVEL_MASK GENMASK(3, 0) 82 + #define XE_PAGEFAULT_TYPE_MASK GENMASK(7, 4) 83 83 /** @consumer.engine_class: engine class */ 84 84 u8 engine_class; 85 85 /** @consumer.engine_instance: engine instance */ 86 86 u8 engine_instance; 87 87 /** consumer.reserved: reserved bits for future expansion */ 88 - u8 reserved[7]; 88 + u64 reserved; 89 89 } consumer; 90 90 /** 91 91 * @producer: State for the producer (i.e., HW/FW interface). Populated