[PATCH v4 1/5] drm/xe/topology: Add a function to find the index of the last DSS in a mask
Matt Roper
matthew.d.roper at intel.com
Fri Oct 18 21:26:54 UTC 2024
On Sun, Oct 13, 2024 at 11:00:32PM -0700, Harish Chegondi wrote:
> Signed-off-by: Harish Chegondi <harish.chegondi at intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_topology.c | 9 +++++++++
> drivers/gpu/drm/xe/xe_gt_topology.h | 3 +++
> 2 files changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_topology.c b/drivers/gpu/drm/xe/xe_gt_topology.c
> index df2042db7ee6..1e7476f71906 100644
> --- a/drivers/gpu/drm/xe/xe_gt_topology.c
> +++ b/drivers/gpu/drm/xe/xe_gt_topology.c
> @@ -278,6 +278,15 @@ xe_dss_mask_group_ffs(const xe_dss_mask_t mask, int groupsize, int groupnum)
> return find_next_bit(mask, XE_MAX_DSS_FUSE_BITS, groupnum * groupsize);
> }
>
> +/*
> + * Used to obtain the index of the last DSS.
> + */
We should probably have a true kerneldoc comment here. And indicate
what happens if the mask is empty, since it isn't obvious without
looking at the implementation here.
> +unsigned int
> +xe_dss_mask_last_dss(const xe_dss_mask_t mask)
We're not 100% successful, but usually we try to prefix non-static
functions with the same name as the file they're defined in. So this
would be better as something along the lines of
xe_gt_topology_mask_last_dss .
> +{
> + return find_last_bit(mask, XE_MAX_DSS_FUSE_BITS);
Since this is just a 1-liner, it might be fine to just put it in the
header file as a static inline.
Matt
> +}
> +
> bool xe_dss_mask_empty(const xe_dss_mask_t mask)
> {
> return bitmap_empty(mask, XE_MAX_DSS_FUSE_BITS);
> diff --git a/drivers/gpu/drm/xe/xe_gt_topology.h b/drivers/gpu/drm/xe/xe_gt_topology.h
> index 746b325bbf6e..7ee022784397 100644
> --- a/drivers/gpu/drm/xe/xe_gt_topology.h
> +++ b/drivers/gpu/drm/xe/xe_gt_topology.h
> @@ -28,6 +28,9 @@ void xe_gt_topology_dump(struct xe_gt *gt, struct drm_printer *p);
> unsigned int
> xe_dss_mask_group_ffs(const xe_dss_mask_t mask, int groupsize, int groupnum);
>
> +unsigned int
> +xe_dss_mask_last_dss(const xe_dss_mask_t mask);
> +
> bool xe_dss_mask_empty(const xe_dss_mask_t mask);
>
> bool
> --
> 2.45.1
>
--
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
More information about the Intel-xe
mailing list