mirror of
https://github.com/torvalds/linux.git
synced 2026-04-20 07:43:57 -04:00
The Guc CT has more than enabled / disables states rather it has 4. The 4 states are not initialized, disabled, stopped, and enabled. Change the code to reflect this. These states will enable proper return codes from functions and therefore enable proper error messages. v2: - s/XE_GUC_CT_STATE_DROP_MESSAGES/XE_GUC_CT_STATE_STOPPED (Michal) - Add assert for CT being initialized (Michal) - Fix kernel for CT state enum (Michal) v3: - Kernel doc (Michal) - s/reiecved/received (Michal) - assert CT state not initialized in xe_guc_ct_init (Michal) - add argument xe_guc_ct_set_state to clear g2h (Michal) v4: - Drop clear_outstanding_g2h argument (Michal) v5: - Move xa_destroy outside of fast lock (CI) Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Tejas Upadhyay <tejas.upadhyay@intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240122210156.1517444-2-matthew.brost@intel.com
68 lines
2.0 KiB
C
68 lines
2.0 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Copyright © 2022 Intel Corporation
|
|
*/
|
|
|
|
#ifndef _XE_GUC_CT_H_
|
|
#define _XE_GUC_CT_H_
|
|
|
|
#include "xe_guc_ct_types.h"
|
|
|
|
struct drm_printer;
|
|
|
|
int xe_guc_ct_init(struct xe_guc_ct *ct);
|
|
int xe_guc_ct_enable(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);
|
|
void xe_guc_ct_fast_path(struct xe_guc_ct *ct);
|
|
|
|
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);
|
|
|
|
static inline bool xe_guc_ct_enabled(struct xe_guc_ct *ct)
|
|
{
|
|
return ct->state == XE_GUC_CT_STATE_ENABLED;
|
|
}
|
|
|
|
static inline void xe_guc_ct_irq_handler(struct xe_guc_ct *ct)
|
|
{
|
|
if (!xe_guc_ct_enabled(ct))
|
|
return;
|
|
|
|
wake_up_all(&ct->wq);
|
|
queue_work(system_unbound_wq, &ct->g2h_worker);
|
|
xe_guc_ct_fast_path(ct);
|
|
}
|
|
|
|
/* Basic CT send / receives */
|
|
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_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
|
|
u32 *response_buffer);
|
|
static inline int
|
|
xe_guc_ct_send_block(struct xe_guc_ct *ct, const u32 *action, u32 len)
|
|
{
|
|
return xe_guc_ct_send_recv(ct, action, len, NULL);
|
|
}
|
|
|
|
/* This is only version of the send CT you can call from a G2H handler */
|
|
int xe_guc_ct_send_g2h_handler(struct xe_guc_ct *ct, const u32 *action,
|
|
u32 len);
|
|
|
|
/* Can't fail because a GT reset is in progress */
|
|
int xe_guc_ct_send_recv_no_fail(struct xe_guc_ct *ct, const u32 *action,
|
|
u32 len, u32 *response_buffer);
|
|
static inline int
|
|
xe_guc_ct_send_block_no_fail(struct xe_guc_ct *ct, const u32 *action, u32 len)
|
|
{
|
|
return xe_guc_ct_send_recv_no_fail(ct, action, len, NULL);
|
|
}
|
|
|
|
#endif
|