Loading...
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(struct xe_guc_ct *ct);
15int xe_guc_ct_enable(struct xe_guc_ct *ct);
16void xe_guc_ct_disable(struct xe_guc_ct *ct);
17void xe_guc_ct_stop(struct xe_guc_ct *ct);
18void xe_guc_ct_fast_path(struct xe_guc_ct *ct);
19
20struct xe_guc_ct_snapshot *xe_guc_ct_snapshot_capture(struct xe_guc_ct *ct);
21void xe_guc_ct_snapshot_print(struct xe_guc_ct_snapshot *snapshot, struct drm_printer *p);
22void xe_guc_ct_snapshot_free(struct xe_guc_ct_snapshot *snapshot);
23void xe_guc_ct_print(struct xe_guc_ct *ct, struct drm_printer *p, bool want_ctb);
24
25static inline bool xe_guc_ct_enabled(struct xe_guc_ct *ct)
26{
27 return ct->state == XE_GUC_CT_STATE_ENABLED;
28}
29
30static inline void xe_guc_ct_irq_handler(struct xe_guc_ct *ct)
31{
32 if (!xe_guc_ct_enabled(ct))
33 return;
34
35 wake_up_all(&ct->wq);
36 queue_work(ct->g2h_wq, &ct->g2h_worker);
37 xe_guc_ct_fast_path(ct);
38}
39
40/* Basic CT send / receives */
41int xe_guc_ct_send(struct xe_guc_ct *ct, const u32 *action, u32 len,
42 u32 g2h_len, u32 num_g2h);
43int xe_guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action, u32 len,
44 u32 g2h_len, u32 num_g2h);
45int xe_guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
46 u32 *response_buffer);
47static inline int
48xe_guc_ct_send_block(struct xe_guc_ct *ct, const u32 *action, u32 len)
49{
50 return xe_guc_ct_send_recv(ct, action, len, NULL);
51}
52
53/* This is only version of the send CT you can call from a G2H handler */
54int xe_guc_ct_send_g2h_handler(struct xe_guc_ct *ct, const u32 *action,
55 u32 len);
56
57/* Can't fail because a GT reset is in progress */
58int xe_guc_ct_send_recv_no_fail(struct xe_guc_ct *ct, const u32 *action,
59 u32 len, u32 *response_buffer);
60static inline int
61xe_guc_ct_send_block_no_fail(struct xe_guc_ct *ct, const u32 *action, u32 len)
62{
63 return xe_guc_ct_send_recv_no_fail(ct, action, len, NULL);
64}
65
66long xe_guc_ct_queue_proc_time_jiffies(struct xe_guc_ct *ct);
67
68#endif
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;
12
13int xe_guc_ct_init(struct xe_guc_ct *ct);
14int xe_guc_ct_enable(struct xe_guc_ct *ct);
15void xe_guc_ct_disable(struct xe_guc_ct *ct);
16void xe_guc_ct_stop(struct xe_guc_ct *ct);
17void xe_guc_ct_fast_path(struct xe_guc_ct *ct);
18
19struct xe_guc_ct_snapshot *
20xe_guc_ct_snapshot_capture(struct xe_guc_ct *ct, bool atomic);
21void xe_guc_ct_snapshot_print(struct xe_guc_ct_snapshot *snapshot,
22 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 atomic);
25
26static inline bool xe_guc_ct_enabled(struct xe_guc_ct *ct)
27{
28 return ct->state == XE_GUC_CT_STATE_ENABLED;
29}
30
31static inline void xe_guc_ct_irq_handler(struct xe_guc_ct *ct)
32{
33 if (!xe_guc_ct_enabled(ct))
34 return;
35
36 wake_up_all(&ct->wq);
37 queue_work(ct->g2h_wq, &ct->g2h_worker);
38 xe_guc_ct_fast_path(ct);
39}
40
41/* Basic CT send / receives */
42int xe_guc_ct_send(struct xe_guc_ct *ct, const u32 *action, u32 len,
43 u32 g2h_len, u32 num_g2h);
44int xe_guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action, u32 len,
45 u32 g2h_len, u32 num_g2h);
46int xe_guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
47 u32 *response_buffer);
48static inline int
49xe_guc_ct_send_block(struct xe_guc_ct *ct, const u32 *action, u32 len)
50{
51 return xe_guc_ct_send_recv(ct, action, len, NULL);
52}
53
54/* This is only version of the send CT you can call from a G2H handler */
55int xe_guc_ct_send_g2h_handler(struct xe_guc_ct *ct, const u32 *action,
56 u32 len);
57
58/* Can't fail because a GT reset is in progress */
59int xe_guc_ct_send_recv_no_fail(struct xe_guc_ct *ct, const u32 *action,
60 u32 len, u32 *response_buffer);
61static inline int
62xe_guc_ct_send_block_no_fail(struct xe_guc_ct *ct, const u32 *action, u32 len)
63{
64 return xe_guc_ct_send_recv_no_fail(ct, action, len, NULL);
65}
66
67#endif