mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
drm/xe/vf: Remove memory allocations from VF post migration recovery
VF post migration recovery is the path of dma-fence signaling / reclaim, avoid memory allocations in this path. v3: - s/lrc_wa_bb/scratch (Tomasz) Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Tomasz Lis <tomasz.lis@intel.com> Link: https://lore.kernel.org/r/20251008214532.3442967-12-matthew.brost@intel.com
This commit is contained in:
parent
489d890a39
commit
98e78e0c8b
|
|
@ -1165,17 +1165,13 @@ static size_t post_migration_scratch_size(struct xe_device *xe)
|
|||
|
||||
static int vf_post_migration_fixups(struct xe_gt *gt)
|
||||
{
|
||||
void *buf = gt->sriov.vf.migration.scratch;
|
||||
s64 shift;
|
||||
void *buf;
|
||||
int err;
|
||||
|
||||
buf = kmalloc(post_migration_scratch_size(gt_to_xe(gt)), GFP_ATOMIC);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
err = xe_gt_sriov_vf_query_config(gt);
|
||||
if (err)
|
||||
goto out;
|
||||
return err;
|
||||
|
||||
shift = xe_gt_sriov_vf_ggtt_shift(gt);
|
||||
if (shift) {
|
||||
|
|
@ -1183,12 +1179,10 @@ static int vf_post_migration_fixups(struct xe_gt *gt)
|
|||
xe_gt_sriov_vf_default_lrcs_hwsp_rebase(gt);
|
||||
err = xe_guc_contexts_hwsp_rebase(>->uc.guc, buf);
|
||||
if (err)
|
||||
goto out;
|
||||
return err;
|
||||
}
|
||||
|
||||
out:
|
||||
kfree(buf);
|
||||
return err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void vf_post_migration_kickstart(struct xe_gt *gt)
|
||||
|
|
@ -1273,9 +1267,18 @@ static void migration_worker_func(struct work_struct *w)
|
|||
*/
|
||||
int xe_gt_sriov_vf_init_early(struct xe_gt *gt)
|
||||
{
|
||||
void *buf;
|
||||
|
||||
if (!xe_sriov_vf_migration_supported(gt_to_xe(gt)))
|
||||
return 0;
|
||||
|
||||
buf = drmm_kmalloc(>_to_xe(gt)->drm,
|
||||
post_migration_scratch_size(gt_to_xe(gt)),
|
||||
GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
gt->sriov.vf.migration.scratch = buf;
|
||||
spin_lock_init(>->sriov.vf.migration.lock);
|
||||
INIT_WORK(>->sriov.vf.migration.worker, migration_worker_func);
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ struct xe_gt_sriov_vf_migration {
|
|||
struct work_struct worker;
|
||||
/** @lock: Protects recovery_queued */
|
||||
spinlock_t lock;
|
||||
/** @scratch: Scratch memory for VF recovery */
|
||||
void *scratch;
|
||||
/** @recovery_queued: VF post migration recovery in queued */
|
||||
bool recovery_queued;
|
||||
/** @recovery_inprogress: VF post migration recovery in progress */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user