drivers/gpu/drm/xe/xe_sriov_pf_migration.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_sriov_pf_migration.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/xe_sriov_pf_migration.c- Extension
.c- Size
- 9221 bytes
- Lines
- 367
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/drm_managed.hxe_device.hxe_gt_sriov_pf_control.hxe_gt_sriov_pf_migration.hxe_pm.hxe_sriov.hxe_sriov_packet.hxe_sriov_packet_types.hxe_sriov_pf_helpers.hxe_sriov_pf_migration.hxe_sriov_printk.h
Detected Declarations
function xe_sriov_pf_migration_waitqueuefunction xe_sriov_pf_migration_supportedfunction xe_sriov_pf_migration_disablefunction pf_migration_check_supportfunction pf_migration_cleanupfunction xe_sriov_pf_migration_initfunction pf_migration_data_readyfunction for_each_gtfunction pf_migration_consumefunction for_each_gtfunction xe_sriov_pf_migration_save_consumefunction pf_handle_descriptorfunction pf_handle_trailerfunction xe_sriov_pf_migration_restore_producefunction xe_sriov_pf_migration_readfunction scoped_cond_guardfunction xe_sriov_pf_migration_writefunction scoped_cond_guardfunction xe_sriov_pf_migration_sizefunction for_each_gt
Annotated Snippet
while (consumed < len) {
ret = xe_sriov_packet_read_single(xe, vfid, buf, len - consumed);
if (ret == -ENODATA)
break;
if (ret < 0)
return ret;
consumed += ret;
buf += ret;
}
}
return consumed;
}
/**
* xe_sriov_pf_migration_write() - Write migration data to the device.
* @xe: the &xe_device
* @vfid: the VF identifier
* @buf: start address of userspace buffer
* @len: requested write size from userspace
*
* Return: number of bytes that has been successfully written,
* -errno on failure.
*/
ssize_t xe_sriov_pf_migration_write(struct xe_device *xe, unsigned int vfid,
const char __user *buf, size_t len)
{
struct xe_sriov_migration_state *migration = pf_pick_migration(xe, vfid);
ssize_t ret, produced = 0;
xe_assert(xe, IS_SRIOV_PF(xe));
scoped_cond_guard(mutex_intr, return -EINTR, &migration->lock) {
while (produced < len) {
ret = xe_sriov_packet_write_single(xe, vfid, buf, len - produced);
if (ret < 0)
return ret;
produced += ret;
buf += ret;
}
}
return produced;
}
/**
* xe_sriov_pf_migration_size() - Total size of migration data from all components within a device
* @xe: the &xe_device
* @vfid: the VF identifier (can't be 0)
*
* This function is for PF only.
*
* Return: total migration data size in bytes or a negative error code on failure.
*/
ssize_t xe_sriov_pf_migration_size(struct xe_device *xe, unsigned int vfid)
{
size_t size = 0;
struct xe_gt *gt;
ssize_t ret;
u8 gt_id;
xe_assert(xe, IS_SRIOV_PF(xe));
xe_assert(xe, vfid);
for_each_gt(gt, xe, gt_id) {
ret = xe_gt_sriov_pf_migration_size(gt, vfid);
if (ret < 0)
return ret;
size += ret;
}
return size;
}
Annotation
- Immediate include surface: `drm/drm_managed.h`, `xe_device.h`, `xe_gt_sriov_pf_control.h`, `xe_gt_sriov_pf_migration.h`, `xe_pm.h`, `xe_sriov.h`, `xe_sriov_packet.h`, `xe_sriov_packet_types.h`.
- Detected declarations: `function xe_sriov_pf_migration_waitqueue`, `function xe_sriov_pf_migration_supported`, `function xe_sriov_pf_migration_disable`, `function pf_migration_check_support`, `function pf_migration_cleanup`, `function xe_sriov_pf_migration_init`, `function pf_migration_data_ready`, `function for_each_gt`, `function pf_migration_consume`, `function for_each_gt`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.