Commit 811fe9f5 authored by Michal Wajdeczko's avatar Michal Wajdeczko

drm/xe/guc: Introduce Relay Communication for SR-IOV

There are scenarios where SR-IOV Virtual Function (VF) driver will
need to get additional data that is not available over VF MMIO BAR
nor could be queried from the GuC firmware and must be obtained
from the Physical Function (PF) driver.

To allow such communication between VF and PF drivers, GuC supports
set of H2G and G2H actions which allows relaying embedded messages,
that are otherwise opaque for the GuC.

To allow use of this communication mechanism, provide functions for
sending requests and handling replies and placeholder where we will
put handlers for incoming requests.
Reviewed-by: default avatarPiotr Piórkowski <piotr.piorkowski@intel.com>
Link: https://lore.kernel.org/r/20240104222031.277-8-michal.wajdeczko@intel.comSigned-off-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
parent fa6c12e0
......@@ -148,6 +148,7 @@ xe-$(CONFIG_HWMON) += xe_hwmon.o
# graphics virtualization (SR-IOV) support
xe-y += \
xe_guc_relay.o \
xe_memirq.o \
xe_sriov.o
......
......@@ -21,6 +21,7 @@
#include "xe_guc_hwconfig.h"
#include "xe_guc_log.h"
#include "xe_guc_pc.h"
#include "xe_guc_relay.h"
#include "xe_guc_submit.h"
#include "xe_memirq.h"
#include "xe_mmio.h"
......@@ -263,6 +264,10 @@ int xe_guc_init(struct xe_guc *guc)
if (ret)
goto out;
ret = xe_guc_relay_init(&guc->relay);
if (ret)
goto out;
ret = xe_guc_pc_init(&guc->pc);
if (ret)
goto out;
......
This diff is collapsed.
/* SPDX-License-Identifier: MIT */
/*
* Copyright © 2023 Intel Corporation
*/
#ifndef _XE_GUC_RELAY_H_
#define _XE_GUC_RELAY_H_
#include <linux/types.h>
#include <linux/errno.h>
struct xe_guc_relay;
int xe_guc_relay_init(struct xe_guc_relay *relay);
int xe_guc_relay_send_to_pf(struct xe_guc_relay *relay,
const u32 *msg, u32 len, u32 *buf, u32 buf_size);
int xe_guc_relay_process_guc2vf(struct xe_guc_relay *relay, const u32 *msg, u32 len);
#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);
int xe_guc_relay_process_guc2pf(struct xe_guc_relay *relay, const u32 *msg, u32 len);
#else
static inline int xe_guc_relay_send_to_vf(struct xe_guc_relay *relay, u32 target,
const u32 *msg, u32 len, u32 *buf, u32 buf_size)
{
return -ENODEV;
}
static inline int xe_guc_relay_process_guc2pf(struct xe_guc_relay *relay, const u32 *msg, u32 len)
{
return -ENODEV;
}
#endif
#endif
/* SPDX-License-Identifier: MIT */
/*
* Copyright © 2023 Intel Corporation
*/
#ifndef _XE_GUC_RELAY_TYPES_H_
#define _XE_GUC_RELAY_TYPES_H_
#include <linux/mempool.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>
/**
* struct xe_guc_relay - Data used by the VF-PF Relay Communication over GuC.
*/
struct xe_guc_relay {
/**@lock: protects all internal data. */
spinlock_t lock;
/** @worker: dispatches incoming action messages. */
struct work_struct worker;
/** @pending_relays: list of sent requests that await a response. */
struct list_head pending_relays;
/** @incoming_actions: list of incoming relay action messages to process. */
struct list_head incoming_actions;
/** @pool: pool of the relay message buffers. */
mempool_t pool;
/** @last_rid: last Relay-ID used while sending a message. */
u32 last_rid;
};
#endif
......@@ -15,6 +15,7 @@
#include "xe_guc_fwif.h"
#include "xe_guc_log_types.h"
#include "xe_guc_pc_types.h"
#include "xe_guc_relay_types.h"
#include "xe_uc_fw_types.h"
/**
......@@ -85,6 +86,9 @@ struct xe_guc {
u32 size;
} hwconfig;
/** @relay: GuC Relay Communication used in SR-IOV */
struct xe_guc_relay relay;
/**
* @notify_reg: Register which is written to notify GuC of H2G messages
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment