drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_gt_sriov_pf_control.c- Extension
.c- Size
- 66782 bytes
- Lines
- 2204
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/drm_managed.habi/guc_actions_sriov_abi.hxe_device.hxe_gt.hxe_gt_sriov_pf.hxe_gt_sriov_pf_config.hxe_gt_sriov_pf_control.hxe_gt_sriov_pf_helpers.hxe_gt_sriov_pf_migration.hxe_gt_sriov_pf_monitor.hxe_gt_sriov_printk.hxe_guc_ct.hxe_sriov.hxe_sriov_packet.hxe_sriov_packet_types.hxe_sriov_pf_control.hxe_sriov_pf_migration.hxe_sriov_pf_service.hxe_tile.h
Detected Declarations
function guc_action_vf_control_cmdfunction pf_send_vf_control_cmdfunction pf_send_vf_pausefunction pf_send_vf_resumefunction pf_send_vf_stopfunction pf_send_vf_flr_startfunction pf_send_vf_flr_finishfunction pf_get_default_timeoutfunction pf_check_vf_statefunction pf_dump_vf_statefunction pf_expect_vf_statefunction pf_expect_vf_not_statefunction pf_track_vf_statefunction pf_enter_vf_statefunction pf_exit_vf_statefunction pf_escape_vf_statefunction pf_enter_vf_mismatchfunction pf_exit_vf_mismatchfunction pf_queue_control_workerfunction pf_queue_vffunction pf_enter_vf_wipfunction pf_exit_vf_wipfunction pf_wait_vf_wip_donefunction pf_enter_vf_readyfunction pf_exit_vf_pause_wipfunction pf_enter_vf_pausedfunction pf_enter_vf_pause_completedfunction pf_enter_vf_pause_failedfunction pf_enter_vf_pause_rejectedfunction pf_exit_vf_pause_guc_donefunction pf_enter_vf_pause_guc_donefunction pf_enter_pause_wait_gucfunction pf_exit_pause_wait_gucfunction pf_enter_vf_pause_send_pausefunction pf_exit_vf_pause_send_pausefunction pf_enter_vf_pause_wipfunction xe_gt_sriov_pf_control_pause_vffunction pf_exit_vf_resume_wipfunction pf_enter_vf_resumedfunction pf_enter_vf_resume_completedfunction pf_enter_vf_resume_failedfunction pf_enter_vf_resume_rejectedfunction pf_enter_vf_resume_send_resumefunction pf_exit_vf_resume_send_resumefunction pf_enter_vf_resume_wipfunction xe_gt_sriov_pf_control_resume_vffunction pf_exit_vf_save_wipfunction pf_enter_vf_saved
Annotated Snippet
// SPDX-License-Identifier: MIT
/*
* Copyright © 2023-2024 Intel Corporation
*/
#include <drm/drm_managed.h>
#include "abi/guc_actions_sriov_abi.h"
#include "xe_device.h"
#include "xe_gt.h"
#include "xe_gt_sriov_pf.h"
#include "xe_gt_sriov_pf_config.h"
#include "xe_gt_sriov_pf_control.h"
#include "xe_gt_sriov_pf_helpers.h"
#include "xe_gt_sriov_pf_migration.h"
#include "xe_gt_sriov_pf_monitor.h"
#include "xe_gt_sriov_printk.h"
#include "xe_guc_ct.h"
#include "xe_sriov.h"
#include "xe_sriov_packet.h"
#include "xe_sriov_packet_types.h"
#include "xe_sriov_pf_control.h"
#include "xe_sriov_pf_migration.h"
#include "xe_sriov_pf_service.h"
#include "xe_tile.h"
static const char *control_cmd_to_string(u32 cmd)
{
switch (cmd) {
case GUC_PF_TRIGGER_VF_PAUSE:
return "PAUSE";
case GUC_PF_TRIGGER_VF_RESUME:
return "RESUME";
case GUC_PF_TRIGGER_VF_STOP:
return "STOP";
case GUC_PF_TRIGGER_VF_FLR_START:
return "FLR_START";
case GUC_PF_TRIGGER_VF_FLR_FINISH:
return "FLR_FINISH";
default:
return "<unknown>";
}
}
static int guc_action_vf_control_cmd(struct xe_guc *guc, u32 vfid, u32 cmd)
{
u32 request[PF2GUC_VF_CONTROL_REQUEST_MSG_LEN] = {
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, GUC_ACTION_PF2GUC_VF_CONTROL),
FIELD_PREP(PF2GUC_VF_CONTROL_REQUEST_MSG_1_VFID, vfid),
FIELD_PREP(PF2GUC_VF_CONTROL_REQUEST_MSG_2_COMMAND, cmd),
};
int ret;
ret = xe_guc_ct_send_block(&guc->ct, request, ARRAY_SIZE(request));
return ret > 0 ? -EPROTO : ret;
}
static int pf_send_vf_control_cmd(struct xe_gt *gt, unsigned int vfid, u32 cmd)
{
int err;
xe_gt_assert(gt, vfid != PFID);
xe_gt_sriov_dbg_verbose(gt, "sending VF%u control command %s\n",
vfid, control_cmd_to_string(cmd));
err = guc_action_vf_control_cmd(>->uc.guc, vfid, cmd);
if (unlikely(err))
xe_gt_sriov_err(gt, "VF%u control command %s failed (%pe)\n",
vfid, control_cmd_to_string(cmd), ERR_PTR(err));
return err;
}
static int pf_send_vf_pause(struct xe_gt *gt, unsigned int vfid)
{
return pf_send_vf_control_cmd(gt, vfid, GUC_PF_TRIGGER_VF_PAUSE);
}
static int pf_send_vf_resume(struct xe_gt *gt, unsigned int vfid)
{
return pf_send_vf_control_cmd(gt, vfid, GUC_PF_TRIGGER_VF_RESUME);
}
static int pf_send_vf_stop(struct xe_gt *gt, unsigned int vfid)
{
return pf_send_vf_control_cmd(gt, vfid, GUC_PF_TRIGGER_VF_STOP);
}
Annotation
- Immediate include surface: `drm/drm_managed.h`, `abi/guc_actions_sriov_abi.h`, `xe_device.h`, `xe_gt.h`, `xe_gt_sriov_pf.h`, `xe_gt_sriov_pf_config.h`, `xe_gt_sriov_pf_control.h`, `xe_gt_sriov_pf_helpers.h`.
- Detected declarations: `function guc_action_vf_control_cmd`, `function pf_send_vf_control_cmd`, `function pf_send_vf_pause`, `function pf_send_vf_resume`, `function pf_send_vf_stop`, `function pf_send_vf_flr_start`, `function pf_send_vf_flr_finish`, `function pf_get_default_timeout`, `function pf_check_vf_state`, `function pf_dump_vf_state`.
- 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.