#include "xe_guc_ct.h"
#include <linux/bitfield.h>
#include <linux/circ_buf.h>
#include <linux/delay.h>
#include <kunit/static_stub.h>
#include <drm/drm_managed.h>
#include "abi/guc_actions_abi.h"
#include "abi/guc_actions_sriov_abi.h"
#include "abi/guc_klvs_abi.h"
#include "xe_bo.h"
#include "xe_device.h"
#include "xe_gt.h"
#include "xe_gt_pagefault.h"
#include "xe_gt_printk.h"
#include "xe_gt_sriov_pf_control.h"
#include "xe_gt_sriov_pf_monitor.h"
#include "xe_gt_tlb_invalidation.h"
#include "xe_guc.h"
#include "xe_guc_relay.h"
#include "xe_guc_submit.h"
#include "xe_map.h"
#include "xe_pm.h"
#include "xe_trace_guc.h"
struct g2h_fence { … };
static void g2h_fence_init(struct g2h_fence *g2h_fence, u32 *response_buffer)
{ … }
static bool g2h_fence_needs_alloc(struct g2h_fence *g2h_fence)
{ … }
static struct xe_guc *
ct_to_guc(struct xe_guc_ct *ct)
{ … }
static struct xe_gt *
ct_to_gt(struct xe_guc_ct *ct)
{ … }
static struct xe_device *
ct_to_xe(struct xe_guc_ct *ct)
{ … }
#define CTB_DESC_SIZE …
#define CTB_H2G_BUFFER_SIZE …
#define CTB_G2H_BUFFER_SIZE …
#define G2H_ROOM_BUFFER_SIZE …
long xe_guc_ct_queue_proc_time_jiffies(struct xe_guc_ct *ct)
{ … }
static size_t guc_ct_size(void)
{ … }
static void guc_ct_fini(struct drm_device *drm, void *arg)
{ … }
static void receive_g2h(struct xe_guc_ct *ct);
static void g2h_worker_func(struct work_struct *w);
static void safe_mode_worker_func(struct work_struct *w);
static void primelockdep(struct xe_guc_ct *ct)
{ … }
int xe_guc_ct_init(struct xe_guc_ct *ct)
{ … }
#define desc_read(xe_, guc_ctb__, field_) …
#define desc_write(xe_, guc_ctb__, field_, val_) …
static void guc_ct_ctb_h2g_init(struct xe_device *xe, struct guc_ctb *h2g,
struct iosys_map *map)
{ … }
static void guc_ct_ctb_g2h_init(struct xe_device *xe, struct guc_ctb *g2h,
struct iosys_map *map)
{ … }
static int guc_ct_ctb_h2g_register(struct xe_guc_ct *ct)
{ … }
static int guc_ct_ctb_g2h_register(struct xe_guc_ct *ct)
{ … }
static int guc_ct_control_toggle(struct xe_guc_ct *ct, bool enable)
{ … }
static void xe_guc_ct_set_state(struct xe_guc_ct *ct,
enum xe_guc_ct_state state)
{ … }
static bool ct_needs_safe_mode(struct xe_guc_ct *ct)
{ … }
static bool ct_restart_safe_mode_worker(struct xe_guc_ct *ct)
{ … }
static void safe_mode_worker_func(struct work_struct *w)
{ … }
static void ct_enter_safe_mode(struct xe_guc_ct *ct)
{ … }
static void ct_exit_safe_mode(struct xe_guc_ct *ct)
{ … }
int xe_guc_ct_enable(struct xe_guc_ct *ct)
{ … }
static void stop_g2h_handler(struct xe_guc_ct *ct)
{ … }
void xe_guc_ct_disable(struct xe_guc_ct *ct)
{ … }
void xe_guc_ct_stop(struct xe_guc_ct *ct)
{ … }
static bool h2g_has_room(struct xe_guc_ct *ct, u32 cmd_len)
{ … }
static bool g2h_has_room(struct xe_guc_ct *ct, u32 g2h_len)
{ … }
static int has_room(struct xe_guc_ct *ct, u32 cmd_len, u32 g2h_len)
{ … }
static void h2g_reserve_space(struct xe_guc_ct *ct, u32 cmd_len)
{ … }
static void __g2h_reserve_space(struct xe_guc_ct *ct, u32 g2h_len, u32 num_g2h)
{ … }
static void __g2h_release_space(struct xe_guc_ct *ct, u32 g2h_len)
{ … }
static void g2h_release_space(struct xe_guc_ct *ct, u32 g2h_len)
{ … }
#define H2G_CT_HEADERS …
static int h2g_write(struct xe_guc_ct *ct, const u32 *action, u32 len,
u32 ct_fence_value, bool want_response)
{ … }
#define CT_SEQNO_MASK …
#define CT_SEQNO_UNTRACKED …
static u16 next_ct_seqno(struct xe_guc_ct *ct, bool is_g2h_fence)
{ … }
static int __guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action,
u32 len, u32 g2h_len, u32 num_g2h,
struct g2h_fence *g2h_fence)
{ … }
static void kick_reset(struct xe_guc_ct *ct)
{ … }
static int dequeue_one_g2h(struct xe_guc_ct *ct);
static int guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action, u32 len,
u32 g2h_len, u32 num_g2h,
struct g2h_fence *g2h_fence)
{ … }
static int guc_ct_send(struct xe_guc_ct *ct, const u32 *action, u32 len,
u32 g2h_len, u32 num_g2h, struct g2h_fence *g2h_fence)
{ … }
int xe_guc_ct_send(struct xe_guc_ct *ct, const u32 *action, u32 len,
u32 g2h_len, u32 num_g2h)
{ … }
int xe_guc_ct_send_locked(struct xe_guc_ct *ct, const u32 *action, u32 len,
u32 g2h_len, u32 num_g2h)
{ … }
int xe_guc_ct_send_g2h_handler(struct xe_guc_ct *ct, const u32 *action, u32 len)
{ … }
static bool retry_failure(struct xe_guc_ct *ct, int ret)
{ … }
static int guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
u32 *response_buffer, bool no_fail)
{ … }
int xe_guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
u32 *response_buffer)
{ … }
int xe_guc_ct_send_recv_no_fail(struct xe_guc_ct *ct, const u32 *action,
u32 len, u32 *response_buffer)
{ … }
static u32 *msg_to_hxg(u32 *msg)
{ … }
static u32 msg_len_to_hxg_len(u32 len)
{ … }
static int parse_g2h_event(struct xe_guc_ct *ct, u32 *msg, u32 len)
{ … }
static int parse_g2h_response(struct xe_guc_ct *ct, u32 *msg, u32 len)
{ … }
static int parse_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)
{ … }
static int process_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)
{ … }
static int g2h_read(struct xe_guc_ct *ct, u32 *msg, bool fast_path)
{ … }
static void g2h_fast_path(struct xe_guc_ct *ct, u32 *msg, u32 len)
{ … }
void xe_guc_ct_fast_path(struct xe_guc_ct *ct)
{ … }
static int dequeue_one_g2h(struct xe_guc_ct *ct)
{ … }
static void receive_g2h(struct xe_guc_ct *ct)
{ … }
static void g2h_worker_func(struct work_struct *w)
{ … }
static void guc_ctb_snapshot_capture(struct xe_device *xe, struct guc_ctb *ctb,
struct guc_ctb_snapshot *snapshot,
bool atomic)
{ … }
static void guc_ctb_snapshot_print(struct guc_ctb_snapshot *snapshot,
struct drm_printer *p)
{ … }
static void guc_ctb_snapshot_free(struct guc_ctb_snapshot *snapshot)
{ … }
struct xe_guc_ct_snapshot *xe_guc_ct_snapshot_capture(struct xe_guc_ct *ct,
bool atomic)
{ … }
void xe_guc_ct_snapshot_print(struct xe_guc_ct_snapshot *snapshot,
struct drm_printer *p)
{ … }
void xe_guc_ct_snapshot_free(struct xe_guc_ct_snapshot *snapshot)
{ … }
void xe_guc_ct_print(struct xe_guc_ct *ct, struct drm_printer *p, bool atomic)
{ … }