From: Aravind Iddamsetty <aravind.iddamsetty@linux.intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [Intel-xe] [PATCH v3 1/3] drm/xe: Get GT clock to nanosecs
Date: Wed, 30 Aug 2023 10:45:42 +0530 [thread overview]
Message-ID: <20230830051544.369643-2-aravind.iddamsetty@linux.intel.com> (raw)
In-Reply-To: <20230830051544.369643-1-aravind.iddamsetty@linux.intel.com>
Helper to convert GT clock cycles to nanoseconds.
v2: Use DIV_ROUND_CLOSEST_ULL helper(Ashutosh)
v3: rename xe_gt_clock_interval_to_ns to xe_gt_clock_cycles_to_ns
Reviewed-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Aravind Iddamsetty <aravind.iddamsetty@linux.intel.com>
---
drivers/gpu/drm/xe/xe_gt_clock.c | 5 +++++
drivers/gpu/drm/xe/xe_gt_clock.h | 4 +++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_gt_clock.c b/drivers/gpu/drm/xe/xe_gt_clock.c
index 2f77b8bbcf53..c67080ce1593 100644
--- a/drivers/gpu/drm/xe/xe_gt_clock.c
+++ b/drivers/gpu/drm/xe/xe_gt_clock.c
@@ -78,3 +78,8 @@ int xe_gt_clock_init(struct xe_gt *gt)
gt->info.clock_freq = freq;
return 0;
}
+
+u64 xe_gt_clock_cycles_to_ns(const struct xe_gt *gt, u64 count)
+{
+ return DIV_ROUND_CLOSEST_ULL(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..aa162722f859 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_cycles_to_ns(const struct xe_gt *gt, u64 count);
#endif
--
2.25.1
next prev parent reply other threads:[~2023-08-30 5:07 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-30 5:15 [Intel-xe] [PATCH v5 0/3] drm/xe/pmu: Enable PMU interface Aravind Iddamsetty
2023-08-30 5:10 ` [Intel-xe] ✓ CI.Patch_applied: success for drm/xe/pmu: Enable PMU interface (rev5) Patchwork
2023-08-30 5:10 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-08-30 5:12 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-08-30 5:15 ` Aravind Iddamsetty [this message]
2023-08-30 5:15 ` [Intel-xe] [PATCH 2/3] drm/xe: Use spinlock in forcewake instead of mutex Aravind Iddamsetty
2023-08-30 5:33 ` Dixit, Ashutosh
2023-08-30 20:56 ` Rodrigo Vivi
2023-08-30 22:19 ` Dixit, Ashutosh
2023-08-31 4:13 ` Aravind Iddamsetty
2023-08-30 5:15 ` [Intel-xe] [PATCH v5 3/3] drm/xe/pmu: Enable PMU interface Aravind Iddamsetty
2023-08-30 20:58 ` Rodrigo Vivi
2023-08-31 20:45 ` Dixit, Ashutosh
2023-08-31 22:14 ` Aravind Iddamsetty
2023-08-31 4:48 ` Dixit, Ashutosh
2023-08-31 10:29 ` Aravind Iddamsetty
2023-08-31 16:58 ` Dixit, Ashutosh
2023-08-31 22:11 ` Aravind Iddamsetty
2023-08-31 22:21 ` Belgaumkar, Vinay
2023-08-31 23:11 ` Aravind Iddamsetty
2023-08-31 23:22 ` Belgaumkar, Vinay
2023-08-31 23:16 ` Dixit, Ashutosh
2023-08-31 23:57 ` Belgaumkar, Vinay
2023-08-31 23:58 ` Dixit, Ashutosh
2023-09-01 3:34 ` Aravind Iddamsetty
2023-08-30 5:19 ` [Intel-xe] ✓ CI.Build: success for drm/xe/pmu: Enable PMU interface (rev5) Patchwork
2023-08-30 5:19 ` [Intel-xe] ✗ CI.Hooks: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2023-09-01 7:06 [Intel-xe] [PATCH v6 0/3] drm/xe/pmu: Enable PMU interface Aravind Iddamsetty
2023-09-01 7:06 ` [Intel-xe] [PATCH v3 1/3] drm/xe: Get GT clock to nanosecs Aravind Iddamsetty
2023-09-14 6:13 [Intel-xe] [PATCH v7 0/3] drm/xe/pmu: Enable PMU interface Aravind Iddamsetty
2023-09-14 6:13 ` [Intel-xe] [PATCH v3 1/3] drm/xe: Get GT clock to nanosecs Aravind Iddamsetty
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230830051544.369643-2-aravind.iddamsetty@linux.intel.com \
--to=aravind.iddamsetty@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox