Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: MIT */
2/*
3 * Copyright © 2022 Intel Corporation
4 */
5
6#ifndef _XE_GUC_CT_H_
7#define _XE_GUC_CT_H_
8
9#include "xe_guc_ct_types.h"
10
11struct drm_printer;
12struct xe_device;
13
14int xe_guc_ct_init_noalloc(struct xe_guc_ct *ct);
15int xe_guc_ct_init(struct xe_guc_ct *ct);
16int xe_guc_ct_enable(struct xe_guc_ct *ct);
17void xe_guc_ct_disable(struct xe_guc_ct *ct);
18void xe_guc_ct_stop(struct xe_guc_ct *ct);
19void xe_guc_ct_fast_path(struct xe_guc_ct *ct);
20
21struct xe_guc_ct_snapshot *xe_guc_ct_snapshot_capture(struct xe_guc_ct *ct);
22void xe_guc_ct_snapshot_print(struct xe_guc_ct_snapshot *snapshot, struct drm_printer *p);
23void xe_guc_ct_snapshot_free(struct xe_guc_ct_snapshot *snapshot);
24void xe_guc_ct_print(struct xe_guc_ct *ct, struct drm_printer *p, bool want_ctb);
25
26void xe_guc_ct_fixup_messages_with_ggtt(struct xe_guc_ct *ct, s64 ggtt_shift);
27
28static inline bool xe_guc_ct_initialized(struct xe_guc_ct *ct)
29{
30 return ct->state != XE_GUC_CT_STATE_NOT_INITIALIZED;
31}
32
33static inline bool xe_guc_ct_enabled(struct xe_guc_ct *ct)
34{
35 return ct->state == XE_GUC_CT_STATE_ENABLED;
36}
37
38static inline void xe_guc_ct_irq_handler(struct xe_guc_ct *ct)
39{
40 if (!xe_guc_ct_enabled(ct))
41 return;
42
43 wake_up_all(&ct->wq);
44 queue_work(ct->g2h_wq, &ct->g2h_worker);
45 xe_guc_ct_fast_path(ct);
46}
47
48/* Basic CT send / receives */
49int xe_guc_ct_send(struct xe_guc_ct *ct, const u32 *action, u32 len,
50 u32 g2h_len, u32 num_g2h);
51int xe_guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action, u32 len,
52 u32 g2h_len, u32 num_g2h);
53int xe_guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
54 u32 *response_buffer);
55static inline int
56xe_guc_ct_send_block(struct xe_guc_ct *ct, const u32 *action, u32 len)
57{
58 return xe_guc_ct_send_recv(ct, action, len, NULL);
59}
60
61/* This is only version of the send CT you can call from a G2H handler */
62int xe_guc_ct_send_g2h_handler(struct xe_guc_ct *ct, const u32 *action,
63 u32 len);
64
65/* Can't fail because a GT reset is in progress */
66int xe_guc_ct_send_recv_no_fail(struct xe_guc_ct *ct, const u32 *action,
67 u32 len, u32 *response_buffer);
68static inline int
69xe_guc_ct_send_block_no_fail(struct xe_guc_ct *ct, const u32 *action, u32 len)
70{
71 return xe_guc_ct_send_recv_no_fail(ct, action, len, NULL);
72}
73
74long xe_guc_ct_queue_proc_time_jiffies(struct xe_guc_ct *ct);
75
76#endif