Skip to content

Commit 7f640d9

Browse files
Jonathan-Cavittintel-lab-lkp
authored andcommitted
drm/xe/xe_pagefault: Track address precision per pagefault
Add an address precision field to the pagefault consumer. This captures the fact that pagefaults are reported on a SZ_4K granularity by GuC, meaning the reported pagefault address is only the address of the page where the faulting access occurred rather than the exact address of the fault. This field is necessary in case more reporters are added where the granularity can be different. v2: - Keep u8 values together (Matt Brost) Suggested-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
1 parent d6f8afc commit 7f640d9

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

drivers/gpu/drm/xe/xe_guc_pagefault.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ int xe_guc_pagefault_handler(struct xe_guc *guc, u32 *msg, u32 len)
7575
<< PFD_VIRTUAL_ADDR_HI_SHIFT) |
7676
(FIELD_GET(PFD_VIRTUAL_ADDR_LO, msg[2]) <<
7777
PFD_VIRTUAL_ADDR_LO_SHIFT);
78+
pf.consumer.addr_precision = 12;
7879
pf.consumer.asid = FIELD_GET(PFD_ASID, msg[1]);
7980
pf.consumer.access_type = FIELD_GET(PFD_ACCESS_TYPE, msg[2]);
8081
if (FIELD_GET(XE2_PFD_TRVA_FAULT, msg[0]))

drivers/gpu/drm/xe/xe_pagefault.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ static void xe_pagefault_print(struct xe_pagefault *pf)
233233
pf->consumer.engine_class_instance);
234234
xe_gt_info(pf->gt, "\n\tASID: %d\n"
235235
"\tFaulted Address: 0x%08x%08x\n"
236+
"\tAddress Precision: %lu\n"
236237
"\tFaultType: %lu\n"
237238
"\tAccessType: %d\n"
238239
"\tFaultLevel: %lu\n"
@@ -241,6 +242,7 @@ static void xe_pagefault_print(struct xe_pagefault *pf)
241242
pf->consumer.asid,
242243
upper_32_bits(pf->consumer.page_addr),
243244
lower_32_bits(pf->consumer.page_addr),
245+
BIT(pf->consumer.addr_precision),
244246
FIELD_GET(XE_PAGEFAULT_TYPE_MASK,
245247
pf->consumer.fault_type_level),
246248
pf->consumer.access_type,

drivers/gpu/drm/xe/xe_pagefault_types.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ struct xe_pagefault {
6767
u64 page_addr;
6868
/** @consumer.asid: address space ID */
6969
u32 asid;
70+
/**
71+
* @consumer.addr_precision: precision of the page fault address.
72+
* u8 rather than u32 to keep compact - actual precision is
73+
* BIT(consumer.addr_precision). Currently only 12
74+
*/
75+
u8 addr_precision;
7076
/**
7177
* @consumer.access_type: access type, u8 rather than enum to
7278
* keep size compact
@@ -87,11 +93,6 @@ struct xe_pagefault {
8793
u8 engine_class_instance;
8894
#define XE_PAGEFAULT_ENGINE_CLASS_MASK GENMASK(3, 0)
8995
#define XE_PAGEFAULT_ENGINE_INSTANCE_MASK GENMASK(7, 4)
90-
/**
91-
* consumer.align: buffer u8 to keep struct aligned to u64.
92-
* Will be used later to store data.
93-
*/
94-
u8 align;
9596
/** consumer.reserved: reserved bits for future expansion */
9697
u64 reserved;
9798
} consumer;

0 commit comments

Comments
 (0)