Skip to content

Commit 5c84985

Browse files
committed
drm/xe/query: Move timestamp reg to hwe_read_timestamp()
__read_timestamps() is actually reading the timestamp from a certain hwe. Use it as parameter, move register declarations to be inside that function and rename it. Reviewed-by: Sai Teja Pottumuttu <[email protected]> Reviewed-by: Matt Roper <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 9d559cd commit 5c84985

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

drivers/gpu/drm/xe/xe_query.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,13 @@ static __ktime_func_t __clock_id_to_func(clockid_t clk_id)
8585
}
8686

8787
static void
88-
__read_timestamps(struct xe_gt *gt,
89-
struct xe_reg lower_reg,
90-
struct xe_reg upper_reg,
91-
u64 *engine_ts,
92-
u64 *cpu_ts,
93-
u64 *cpu_delta,
94-
__ktime_func_t cpu_clock)
88+
hwe_read_timestamp(struct xe_hw_engine *hwe, u64 *engine_ts, u64 *cpu_ts,
89+
u64 *cpu_delta, __ktime_func_t cpu_clock)
9590
{
96-
struct xe_mmio *mmio = &gt->mmio;
91+
struct xe_mmio *mmio = &hwe->gt->mmio;
9792
u32 upper, lower, old_upper, loop = 0;
93+
struct xe_reg upper_reg = RING_TIMESTAMP_UDW(hwe->mmio_base),
94+
lower_reg = RING_TIMESTAMP(hwe->mmio_base);
9895

9996
upper = xe_mmio_read32(mmio, upper_reg);
10097
do {
@@ -155,13 +152,8 @@ query_engine_cycles(struct xe_device *xe,
155152
if (xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL))
156153
return -EIO;
157154

158-
__read_timestamps(gt,
159-
RING_TIMESTAMP(hwe->mmio_base),
160-
RING_TIMESTAMP_UDW(hwe->mmio_base),
161-
&resp.engine_cycles,
162-
&resp.cpu_timestamp,
163-
&resp.cpu_delta,
164-
cpu_clock);
155+
hwe_read_timestamp(hwe, &resp.engine_cycles, &resp.cpu_timestamp,
156+
&resp.cpu_delta, cpu_clock);
165157

166158
xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
167159

0 commit comments

Comments
 (0)