[PATCH v2 1/4] drm/xe: Add build on bug to assert page fault queue works

Lucas De Marchi lucas.demarchi at intel.com
Wed Jan 10 20:10:05 UTC 2024


On Tue, Jan 09, 2024 at 05:24:36PM -0800, Matthew Brost wrote:
>If PF_QUEUE_NUM_DW % PF_MSG_LEN_DW != 0 then the page fault queue logic
>does not work when wrapping occurs. Add a build bug on to assert
>PF_QUEUE_NUM_DW % PF_MSG_LEN_DW == 0 to enforce this restriction and
>document the code.
>
>v2:
>- s/NUM_PF_QUEUE/PF_QUEUE_NUM_DW (Brian)
>
>Cc: Lucas De Marchi <lucas.demarchi at intel.com>
>Signed-off-by: Matthew Brost <matthew.brost at intel.com>
>---
> drivers/gpu/drm/xe/xe_gt_pagefault.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
>diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
>index 4489aadc7a52..0a61e4413679 100644
>--- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
>+++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
>@@ -328,6 +328,11 @@ int xe_guc_pagefault_handler(struct xe_guc *guc, u32 *msg, u32 len)
> 	u32 asid;
> 	bool full;
>
>+	/*
>+	 * The below logic doesn't work unless PF_QUEUE_NUM_DW % PF_MSG_LEN_DW == 0
>+	 */
>+	BUILD_BUG_ON(PF_QUEUE_NUM_DW % PF_MSG_LEN_DW);

at some point we may want to use either LEN or NUM, but this does what
the patch says.


Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>

thanks
Lucas De Marchi

>+
> 	if (unlikely(len != PF_MSG_LEN_DW))
> 		return -EPROTO;
>
>-- 
>2.34.1
>


More information about the Intel-xe mailing list