#include <linux/bitfield.h>
#include <linux/delay.h>
#include <drm/drm_managed.h>
#include <kunit/static_stub.h>
#include <kunit/test-bug.h>
#include "abi/guc_actions_sriov_abi.h"
#include "abi/guc_relay_actions_abi.h"
#include "abi/guc_relay_communication_abi.h"
#include "xe_assert.h"
#include "xe_device.h"
#include "xe_gt.h"
#include "xe_gt_sriov_printk.h"
#include "xe_gt_sriov_pf_service.h"
#include "xe_guc.h"
#include "xe_guc_ct.h"
#include "xe_guc_hxg_helpers.h"
#include "xe_guc_relay.h"
#include "xe_guc_relay_types.h"
#include "xe_sriov.h"
#define RELAY_TIMEOUT_MSEC …
static void relays_worker_fn(struct work_struct *w);
static struct xe_guc *relay_to_guc(struct xe_guc_relay *relay)
{ … }
static struct xe_guc_ct *relay_to_ct(struct xe_guc_relay *relay)
{ … }
static struct xe_gt *relay_to_gt(struct xe_guc_relay *relay)
{ … }
static struct xe_device *relay_to_xe(struct xe_guc_relay *relay)
{ … }
#define relay_assert(relay, condition) …
#define relay_notice(relay, msg...) …
#define relay_debug(relay, msg...) …
static int relay_get_totalvfs(struct xe_guc_relay *relay)
{ … }
static bool relay_is_ready(struct xe_guc_relay *relay)
{ … }
static u32 relay_get_next_rid(struct xe_guc_relay *relay)
{ … }
struct relay_transaction { … };
static u32 prepare_pf2guc(u32 *msg, u32 target, u32 rid)
{ … }
static u32 prepare_vf2guc(u32 *msg, u32 rid)
{ … }
static struct relay_transaction *
__relay_get_transaction(struct xe_guc_relay *relay, bool incoming, u32 remote, u32 rid,
const u32 *action, u32 action_len, u32 *resp, u32 resp_size)
{ … }
static struct relay_transaction *
relay_new_transaction(struct xe_guc_relay *relay, u32 target, const u32 *action, u32 len,
u32 *resp, u32 resp_size)
{ … }
static struct relay_transaction *
relay_new_incoming_transaction(struct xe_guc_relay *relay, u32 origin, u32 rid,
const u32 *action, u32 len)
{ … }
static void relay_release_transaction(struct xe_guc_relay *relay, struct relay_transaction *txn)
{ … }
static int relay_send_transaction(struct xe_guc_relay *relay, struct relay_transaction *txn)
{ … }
static void __fini_relay(struct drm_device *drm, void *arg)
{ … }
int xe_guc_relay_init(struct xe_guc_relay *relay)
{ … }
static u32 to_relay_error(int err)
{ … }
static int from_relay_error(u32 error)
{ … }
static u32 sanitize_relay_error(u32 error)
{ … }
static u32 sanitize_relay_error_hint(u32 hint)
{ … }
static u32 prepare_error_reply(u32 *msg, u32 error, u32 hint)
{ … }
static void relay_testonly_nop(struct xe_guc_relay *relay)
{ … }
static int relay_send_message_and_wait(struct xe_guc_relay *relay,
struct relay_transaction *txn,
u32 *buf, u32 buf_size)
{ … }
static int relay_send_to(struct xe_guc_relay *relay, u32 target,
const u32 *msg, u32 len, u32 *buf, u32 buf_size)
{ … }
#ifdef CONFIG_PCI_IOV
int xe_guc_relay_send_to_vf(struct xe_guc_relay *relay, u32 target,
const u32 *msg, u32 len, u32 *buf, u32 buf_size)
{ … }
#endif
int xe_guc_relay_send_to_pf(struct xe_guc_relay *relay,
const u32 *msg, u32 len, u32 *buf, u32 buf_size)
{ … }
static int relay_handle_reply(struct xe_guc_relay *relay, u32 origin,
u32 rid, int reply, const u32 *msg, u32 len)
{ … }
static int relay_handle_failure(struct xe_guc_relay *relay, u32 origin,
u32 rid, const u32 *msg, u32 len)
{ … }
static int relay_testloop_action_handler(struct xe_guc_relay *relay, u32 origin,
const u32 *msg, u32 len, u32 *response, u32 size)
{ … }
static int relay_action_handler(struct xe_guc_relay *relay, u32 origin,
const u32 *msg, u32 len, u32 *response, u32 size)
{ … }
static struct relay_transaction *relay_dequeue_transaction(struct xe_guc_relay *relay)
{ … }
static void relay_process_incoming_action(struct xe_guc_relay *relay)
{ … }
static bool relay_needs_worker(struct xe_guc_relay *relay)
{ … }
static void relay_kick_worker(struct xe_guc_relay *relay)
{ … }
static void relays_worker_fn(struct work_struct *w)
{ … }
static int relay_queue_action_msg(struct xe_guc_relay *relay, u32 origin, u32 rid,
const u32 *msg, u32 len)
{ … }
static int relay_process_msg(struct xe_guc_relay *relay, u32 origin, u32 rid,
const u32 *msg, u32 len)
{ … }
int xe_guc_relay_process_guc2vf(struct xe_guc_relay *relay, const u32 *msg, u32 len)
{ … }
#ifdef CONFIG_PCI_IOV
int xe_guc_relay_process_guc2pf(struct xe_guc_relay *relay, const u32 *msg, u32 len)
{ … }
#endif
#if IS_BUILTIN(CONFIG_DRM_XE_KUNIT_TEST)
#include "tests/xe_guc_relay_test.c"
#endif