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

Welty, Brian brian.welty at intel.com
Tue Jan 9 21:52:06 UTC 2024



On 1/9/2024 9:28 AM, Matthew Brost wrote:
> If NUM_PF_QUEUE % PF_MSG_LEN_DW != 0 then the page fault queue logic
> does not work when wrapping occurs. Add a build bug on to assert
> NUM_PF_QUEUE % PF_MSG_LEN_DW == 0 to enforce this restriction and
> document the code.

I'm a bit confused.   Number of queues is independent.

Don't you mean to test against size of queue in DWs?
So this for the check?
    BUILD_BUG_ON(PF_QUEUE_NUM_DW % PF_MSG_LEN_DW);


> 
> 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..16cea47d9e15 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 NUM_PF_QUEUE % PF_MSG_LEN_DW == 0
> +	 */
> +	BUILD_BUG_ON(NUM_PF_QUEUE % PF_MSG_LEN_DW);
> +
>   	if (unlikely(len != PF_MSG_LEN_DW))
>   		return -EPROTO;
>   


More information about the Intel-xe mailing list