mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
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
This commit is contained in:
parent
2882094e0d
commit
68be2bfe4b
|
|
@ -76,11 +76,14 @@ int xe_guc_pagefault_handler(struct xe_guc *guc, u32 *msg, u32 len)
|
|||
PFD_VIRTUAL_ADDR_LO_SHIFT);
|
||||
pf.consumer.asid = FIELD_GET(PFD_ASID, msg[1]);
|
||||
pf.consumer.access_type = FIELD_GET(PFD_ACCESS_TYPE, msg[2]);
|
||||
pf.consumer.fault_type = FIELD_GET(PFD_FAULT_TYPE, msg[2]);
|
||||
if (FIELD_GET(XE2_PFD_TRVA_FAULT, msg[0]))
|
||||
pf.consumer.fault_level = XE_PAGEFAULT_LEVEL_NACK;
|
||||
pf.consumer.fault_type_level = XE_PAGEFAULT_TYPE_LEVEL_NACK;
|
||||
else
|
||||
pf.consumer.fault_level = FIELD_GET(PFD_FAULT_LEVEL, msg[0]);
|
||||
pf.consumer.fault_type_level =
|
||||
FIELD_PREP(XE_PAGEFAULT_LEVEL_MASK,
|
||||
FIELD_GET(PFD_FAULT_LEVEL, msg[0])) |
|
||||
FIELD_PREP(XE_PAGEFAULT_TYPE_MASK,
|
||||
FIELD_GET(PFD_FAULT_TYPE, msg[2]));
|
||||
pf.consumer.engine_class = FIELD_GET(PFD_ENG_CLASS, msg[0]);
|
||||
pf.consumer.engine_instance = FIELD_GET(PFD_ENG_INSTANCE, msg[0]);
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ static int xe_pagefault_service(struct xe_pagefault *pf)
|
|||
bool atomic;
|
||||
|
||||
/* Producer flagged this fault to be nacked */
|
||||
if (pf->consumer.fault_level == XE_PAGEFAULT_LEVEL_NACK)
|
||||
if (pf->consumer.fault_type_level == XE_PAGEFAULT_TYPE_LEVEL_NACK)
|
||||
return -EFAULT;
|
||||
|
||||
vm = xe_pagefault_asid_to_vm(xe, pf->consumer.asid);
|
||||
|
|
@ -225,17 +225,19 @@ static void xe_pagefault_print(struct xe_pagefault *pf)
|
|||
{
|
||||
xe_gt_info(pf->gt, "\n\tASID: %d\n"
|
||||
"\tFaulted Address: 0x%08x%08x\n"
|
||||
"\tFaultType: %d\n"
|
||||
"\tFaultType: %lu\n"
|
||||
"\tAccessType: %d\n"
|
||||
"\tFaultLevel: %d\n"
|
||||
"\tFaultLevel: %lu\n"
|
||||
"\tEngineClass: %d %s\n"
|
||||
"\tEngineInstance: %d\n",
|
||||
pf->consumer.asid,
|
||||
upper_32_bits(pf->consumer.page_addr),
|
||||
lower_32_bits(pf->consumer.page_addr),
|
||||
pf->consumer.fault_type,
|
||||
FIELD_GET(XE_PAGEFAULT_TYPE_MASK,
|
||||
pf->consumer.fault_type_level),
|
||||
pf->consumer.access_type,
|
||||
pf->consumer.fault_level,
|
||||
FIELD_GET(XE_PAGEFAULT_LEVEL_MASK,
|
||||
pf->consumer.fault_type_level),
|
||||
pf->consumer.engine_class,
|
||||
xe_hw_engine_class_to_str(pf->consumer.engine_class),
|
||||
pf->consumer.engine_instance);
|
||||
|
|
|
|||
|
|
@ -73,19 +73,19 @@ struct xe_pagefault {
|
|||
*/
|
||||
u8 access_type;
|
||||
/**
|
||||
* @consumer.fault_type: fault type, u8 rather than enum to
|
||||
* keep size compact
|
||||
* @consumer.fault_type_level: fault type and level, u8 rather
|
||||
* than enum to keep size compact
|
||||
*/
|
||||
u8 fault_type;
|
||||
#define XE_PAGEFAULT_LEVEL_NACK 0xff /* Producer indicates nack fault */
|
||||
/** @consumer.fault_level: fault level */
|
||||
u8 fault_level;
|
||||
u8 fault_type_level;
|
||||
#define XE_PAGEFAULT_TYPE_LEVEL_NACK 0xff /* Producer indicates nack fault */
|
||||
#define XE_PAGEFAULT_LEVEL_MASK GENMASK(3, 0)
|
||||
#define XE_PAGEFAULT_TYPE_MASK GENMASK(7, 4)
|
||||
/** @consumer.engine_class: engine class */
|
||||
u8 engine_class;
|
||||
/** @consumer.engine_instance: engine instance */
|
||||
u8 engine_instance;
|
||||
/** consumer.reserved: reserved bits for future expansion */
|
||||
u8 reserved[7];
|
||||
u64 reserved;
|
||||
} consumer;
|
||||
/**
|
||||
* @producer: State for the producer (i.e., HW/FW interface). Populated
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user