[Intel-xe] [PATCH v2 1/2] drm/xe: Get GT clock to nanosecs

Upadhyay, Tejas tejas.upadhyay at intel.com
Tue Jul 4 09:29:17 UTC 2023



> -----Original Message-----
> From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of
> Aravind Iddamsetty
> Sent: Tuesday, June 27, 2023 5:51 PM
> To: intel-xe at lists.freedesktop.org
> Subject: [Intel-xe] [PATCH v2 1/2] drm/xe: Get GT clock to nanosecs
> 
> Helpers to get GT clock to nanosecs
> 
> Signed-off-by: Aravind Iddamsetty <aravind.iddamsetty at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_gt_clock.c | 10 ++++++++++
> drivers/gpu/drm/xe/xe_gt_clock.h |  4 +++-
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_clock.c
> b/drivers/gpu/drm/xe/xe_gt_clock.c
> index 7cf11078ff57..3689c7d5cf53 100644
> --- a/drivers/gpu/drm/xe/xe_gt_clock.c
> +++ b/drivers/gpu/drm/xe/xe_gt_clock.c
> @@ -78,3 +78,13 @@ int xe_gt_clock_init(struct xe_gt *gt)
>  	gt->info.clock_freq = freq;
>  	return 0;
>  }
> +
> +static u64 div_u64_roundup(u64 nom, u32 den) {
> +	return div_u64(nom + den - 1, den);
> +}
> +
> +u64 xe_gt_clock_interval_to_ns(const struct xe_gt *gt, u64 count) {
> +	return div_u64_roundup(count * NSEC_PER_SEC, gt-
> >info.clock_freq); }
> diff --git a/drivers/gpu/drm/xe/xe_gt_clock.h
> b/drivers/gpu/drm/xe/xe_gt_clock.h
> index 511923afd224..91fc9b7e83f5 100644
> --- a/drivers/gpu/drm/xe/xe_gt_clock.h
> +++ b/drivers/gpu/drm/xe/xe_gt_clock.h
> @@ -6,8 +6,10 @@
>  #ifndef _XE_GT_CLOCK_H_
>  #define _XE_GT_CLOCK_H_
> 
> +#include <linux/types.h>
> +
>  struct xe_gt;
> 
>  int xe_gt_clock_init(struct xe_gt *gt);
> -
> +u64 xe_gt_clock_interval_to_ns(const struct xe_gt *gt, u64 count);
>  #endif

Looks ok to me,
Reviewed-by: Tejas Upadhyay <tejas.upadhyay at intel.com>

> --
> 2.25.1



More information about the Intel-xe mailing list