drivers/gpu/drm/xe/xe_guc_relay.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_guc_relay.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_guc_relay.c- Extension
.c- Size
- 28718 bytes
- Lines
- 967
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/delay.hlinux/fault-inject.hdrm/drm_managed.hkunit/static_stub.hkunit/test-bug.habi/guc_actions_sriov_abi.habi/guc_relay_actions_abi.habi/guc_relay_communication_abi.hxe_assert.hxe_device_types.hxe_gt_sriov_printk.hxe_gt_sriov_pf_service.hxe_guc.hxe_guc_ct.hxe_guc_hxg_helpers.hxe_guc_relay.hxe_guc_relay_types.hxe_sriov.htests/xe_guc_relay_test.c
Detected Declarations
struct relay_transactionfunction relay_get_totalvfsfunction relay_is_readyfunction relay_get_next_ridfunction prepare_pf2gucfunction prepare_vf2gucfunction __relay_get_transactionfunction relay_new_transactionfunction relay_new_incoming_transactionfunction relay_release_transactionfunction relay_send_transactionfunction __fini_relayfunction xe_guc_relay_initfunction to_relay_errorfunction from_relay_errorfunction sanitize_relay_errorfunction sanitize_relay_error_hintfunction prepare_error_replyfunction relay_testonly_nopfunction relay_send_message_and_waitfunction relay_send_tofunction xe_guc_relay_send_to_vffunction xe_guc_relay_send_to_pffunction relay_handle_replyfunction relay_handle_failurefunction relay_testloop_action_handlerfunction relay_action_handlerfunction relay_process_incoming_actionfunction relay_needs_workerfunction relay_kick_workerfunction relays_worker_fnfunction relay_queue_action_msgfunction relay_process_msgfunction xe_guc_relay_process_guc2vffunction xe_guc_relay_process_guc2pf
Annotated Snippet
struct relay_transaction {
/**
* @incoming: indicates whether this transaction represents an incoming
* request from the remote VF/PF or this transaction
* represents outgoing request to the remote VF/PF.
*/
bool incoming;
/**
* @remote: PF/VF identifier of the origin (or target) of the relay
* request message.
*/
u32 remote;
/** @rid: identifier of the VF/PF relay message. */
u32 rid;
/**
* @request: points to the inner VF/PF request message, copied to the
* #response_buf starting at #offset.
*/
u32 *request;
/** @request_len: length of the inner VF/PF request message. */
u32 request_len;
/**
* @response: points to the placeholder buffer where inner VF/PF
* response will be located, for outgoing transaction
* this could be caller's buffer (if provided) otherwise
* it points to the #response_buf starting at #offset.
*/
u32 *response;
/**
* @response_len: length of the inner VF/PF response message (only
* if #status is 0), initially set to the size of the
* placeholder buffer where response message will be
* copied.
*/
u32 response_len;
/**
* @offset: offset to the start of the inner VF/PF relay message inside
* buffers; this offset is equal the length of the outer GuC
* relay header message.
*/
u32 offset;
/**
* @request_buf: buffer with VF/PF request message including outer
* transport message.
*/
u32 request_buf[GUC_CTB_MAX_DWORDS];
/**
* @response_buf: buffer with VF/PF response message including outer
* transport message.
*/
u32 response_buf[GUC_CTB_MAX_DWORDS];
/**
* @reply: status of the reply, 0 means that data pointed by the
* #response is valid.
*/
int reply;
/** @done: completion of the outgoing transaction. */
struct completion done;
/** @link: transaction list link */
struct list_head link;
};
static u32 prepare_pf2guc(u32 *msg, u32 target, u32 rid)
{
msg[0] = FIELD_PREP(GUC_HXG_MSG_0_ORIGIN, GUC_HXG_ORIGIN_HOST) |
FIELD_PREP(GUC_HXG_MSG_0_TYPE, GUC_HXG_TYPE_REQUEST) |
FIELD_PREP(GUC_HXG_REQUEST_MSG_0_ACTION, XE_GUC_ACTION_PF2GUC_RELAY_TO_VF);
msg[1] = FIELD_PREP(PF2GUC_RELAY_TO_VF_REQUEST_MSG_1_VFID, target);
msg[2] = FIELD_PREP(PF2GUC_RELAY_TO_VF_REQUEST_MSG_2_RELAY_ID, rid);
return PF2GUC_RELAY_TO_VF_REQUEST_MSG_MIN_LEN;
}
static u32 prepare_vf2guc(u32 *msg, u32 rid)
{
msg[0] = FIELD_PREP(GUC_HXG_MSG_0_ORIGIN, GUC_HXG_ORIGIN_HOST) |
FIELD_PREP(GUC_HXG_MSG_0_TYPE, GUC_HXG_TYPE_REQUEST) |
FIELD_PREP(GUC_HXG_REQUEST_MSG_0_ACTION, XE_GUC_ACTION_VF2GUC_RELAY_TO_PF);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/delay.h`, `linux/fault-inject.h`, `drm/drm_managed.h`, `kunit/static_stub.h`, `kunit/test-bug.h`, `abi/guc_actions_sriov_abi.h`, `abi/guc_relay_actions_abi.h`.
- Detected declarations: `struct relay_transaction`, `function relay_get_totalvfs`, `function relay_is_ready`, `function relay_get_next_rid`, `function prepare_pf2guc`, `function prepare_vf2guc`, `function __relay_get_transaction`, `function relay_new_transaction`, `function relay_new_incoming_transaction`, `function relay_release_transaction`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.