linux/drivers/gpu/drm/xe/xe_gt_sriov_pf_service.c

// SPDX-License-Identifier: MIT
/*
 * Copyright © 2023-2024 Intel Corporation
 */

#include <drm/drm_managed.h>

#include "abi/guc_actions_sriov_abi.h"
#include "abi/guc_relay_actions_abi.h"

#include "regs/xe_gt_regs.h"
#include "regs/xe_guc_regs.h"
#include "regs/xe_regs.h"

#include "xe_mmio.h"
#include "xe_gt_sriov_printk.h"
#include "xe_gt_sriov_pf_helpers.h"
#include "xe_gt_sriov_pf_service.h"
#include "xe_gt_sriov_pf_service_types.h"
#include "xe_guc_ct.h"
#include "xe_guc_hxg_helpers.h"

static void pf_init_versions(struct xe_gt *gt)
{}

/* Return: 0 on success or a negative error code on failure. */
static int pf_negotiate_version(struct xe_gt *gt,
				u32 wanted_major, u32 wanted_minor,
				u32 *major, u32 *minor)
{}

static void pf_connect(struct xe_gt *gt, u32 vfid, u32 major, u32 minor)
{}

static void pf_disconnect(struct xe_gt *gt, u32 vfid)
{}

static bool pf_is_negotiated(struct xe_gt *gt, u32 vfid, u32 major, u32 minor)
{}

static const struct xe_reg tgl_runtime_regs[] =;

static const struct xe_reg ats_m_runtime_regs[] =;

static const struct xe_reg pvc_runtime_regs[] =;

static const struct xe_reg ver_1270_runtime_regs[] =;

static const struct xe_reg ver_2000_runtime_regs[] =;

static const struct xe_reg *pick_runtime_regs(struct xe_device *xe, unsigned int *count)
{}

static int pf_alloc_runtime_info(struct xe_gt *gt)
{}

static void read_many(struct xe_gt *gt, unsigned int count,
		      const struct xe_reg *regs, u32 *values)
{}

static void pf_prepare_runtime_info(struct xe_gt *gt)
{}

/**
 * xe_gt_sriov_pf_service_init - Early initialization of the GT SR-IOV PF services.
 * @gt: the &xe_gt to initialize
 *
 * Performs early initialization of the GT SR-IOV PF services, including preparation
 * of the runtime info that will be shared with VFs.
 *
 * This function can only be called on PF.
 */
int xe_gt_sriov_pf_service_init(struct xe_gt *gt)
{}

/**
 * xe_gt_sriov_pf_service_update - Update PF SR-IOV services.
 * @gt: the &xe_gt to update
 *
 * Updates runtime data shared with VFs.
 *
 * This function can be called more than once.
 * This function can only be called on PF.
 */
void xe_gt_sriov_pf_service_update(struct xe_gt *gt)
{}

/**
 * xe_gt_sriov_pf_service_reset - Reset a connection with the VF.
 * @gt: the &xe_gt
 * @vfid: the VF identifier
 *
 * Reset a VF driver negotiated VF/PF ABI version.
 * After that point, the VF driver will have to perform new version handshake
 * to continue use of the PF services again.
 *
 * This function can only be called on PF.
 */
void xe_gt_sriov_pf_service_reset(struct xe_gt *gt, unsigned int vfid)
{}

/* Return: 0 on success or a negative error code on failure. */
static int pf_process_handshake(struct xe_gt *gt, u32 vfid,
				u32 wanted_major, u32 wanted_minor,
				u32 *major, u32 *minor)
{}

/* Return: length of the response message or a negative error code on failure. */
static int pf_process_handshake_msg(struct xe_gt *gt, u32 origin,
				    const u32 *request, u32 len, u32 *response, u32 size)
{}

struct reg_data {} __packed;
static_assert();

/* Return: number of entries copied or negative error code on failure. */
static int pf_service_runtime_query(struct xe_gt *gt, u32 start, u32 limit,
				    struct reg_data *data, u32 *remaining)
{}

/* Return: length of the response message or a negative error code on failure. */
static int pf_process_runtime_query_msg(struct xe_gt *gt, u32 origin,
					const u32 *msg, u32 msg_len, u32 *response, u32 resp_size)
{}

/**
 * xe_gt_sriov_pf_service_process_request - Service GT level SR-IOV request message from the VF.
 * @gt: the &xe_gt that provides the service
 * @origin: VF number that is requesting the service
 * @msg: request message
 * @msg_len: length of the request message (in dwords)
 * @response: placeholder for the response message
 * @resp_size: length of the response message buffer (in dwords)
 *
 * This function processes `Relay Message`_ request from the VF.
 *
 * Return: length of the response message or a negative error code on failure.
 */
int xe_gt_sriov_pf_service_process_request(struct xe_gt *gt, u32 origin,
					   const u32 *msg, u32 msg_len,
					   u32 *response, u32 resp_size)
{}

/**
 * xe_gt_sriov_pf_service_print_runtime - Print PF runtime data shared with VFs.
 * @gt: the &xe_gt
 * @p: the &drm_printer
 *
 * This function is for PF use only.
 */
int xe_gt_sriov_pf_service_print_runtime(struct xe_gt *gt, struct drm_printer *p)
{}

/**
 * xe_gt_sriov_pf_service_print_version - Print ABI versions negotiated with VFs.
 * @gt: the &xe_gt
 * @p: the &drm_printer
 *
 * This function is for PF use only.
 */
int xe_gt_sriov_pf_service_print_version(struct xe_gt *gt, struct drm_printer *p)
{}

#if IS_BUILTIN(CONFIG_DRM_XE_KUNIT_TEST)
#include "tests/xe_gt_sriov_pf_service_test.c"
#endif