Skip to content

Commit ce2ae1b

Browse files
committed
drm/xe/vf: Introduce helpers to access GGTT configuration
In upcoming patch we want to separate tile-oriented VF functions from GT-oriented functions and to allow the former access a GGTT configuration stored at GT level we need to provide some helpers. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Tomasz Lis <tomasz.lis@intel.com> Reviewed-by: Tomasz Lis<tomasz.lis@intel.com> Link: https://lore.kernel.org/r/20250602103325.549-2-michal.wajdeczko@intel.com
1 parent 28b996c commit ce2ae1b

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

drivers/gpu/drm/xe/xe_gt_sriov_vf.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,40 @@ u64 xe_gt_sriov_vf_lmem(struct xe_gt *gt)
561561
return gt->sriov.vf.self_config.lmem_size;
562562
}
563563

564+
/**
565+
* xe_gt_sriov_vf_ggtt - VF GGTT configuration.
566+
* @gt: the &xe_gt
567+
*
568+
* This function is for VF use only.
569+
*
570+
* Return: size of the GGTT assigned to VF.
571+
*/
572+
u64 xe_gt_sriov_vf_ggtt(struct xe_gt *gt)
573+
{
574+
xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));
575+
xe_gt_assert(gt, gt->sriov.vf.guc_version.major);
576+
xe_gt_assert(gt, gt->sriov.vf.self_config.ggtt_size);
577+
578+
return gt->sriov.vf.self_config.ggtt_size;
579+
}
580+
581+
/**
582+
* xe_gt_sriov_vf_ggtt_base - VF GGTT base offset.
583+
* @gt: the &xe_gt
584+
*
585+
* This function is for VF use only.
586+
*
587+
* Return: base offset of the GGTT assigned to VF.
588+
*/
589+
u64 xe_gt_sriov_vf_ggtt_base(struct xe_gt *gt)
590+
{
591+
xe_gt_assert(gt, IS_SRIOV_VF(gt_to_xe(gt)));
592+
xe_gt_assert(gt, gt->sriov.vf.guc_version.major);
593+
xe_gt_assert(gt, gt->sriov.vf.self_config.ggtt_size);
594+
595+
return gt->sriov.vf.self_config.ggtt_base;
596+
}
597+
564598
/**
565599
* xe_gt_sriov_vf_ggtt_shift - Return shift in GGTT range due to VF migration
566600
* @gt: the &xe_gt struct instance

drivers/gpu/drm/xe/xe_gt_sriov_vf.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ int xe_gt_sriov_vf_query_runtime(struct xe_gt *gt);
2020
int xe_gt_sriov_vf_prepare_ggtt(struct xe_gt *gt);
2121
int xe_gt_sriov_vf_balloon_ggtt_locked(struct xe_gt *gt);
2222
void xe_gt_sriov_vf_deballoon_ggtt_locked(struct xe_gt *gt);
23-
s64 xe_gt_sriov_vf_ggtt_shift(struct xe_gt *gt);
2423
void xe_gt_sriov_vf_fixup_ggtt_nodes(struct xe_gt *gt, s64 shift);
2524
int xe_gt_sriov_vf_notify_resfix_done(struct xe_gt *gt);
2625
void xe_gt_sriov_vf_migrated_event_handler(struct xe_gt *gt);
2726

2827
u32 xe_gt_sriov_vf_gmdid(struct xe_gt *gt);
2928
u16 xe_gt_sriov_vf_guc_ids(struct xe_gt *gt);
3029
u64 xe_gt_sriov_vf_lmem(struct xe_gt *gt);
30+
u64 xe_gt_sriov_vf_ggtt(struct xe_gt *gt);
31+
u64 xe_gt_sriov_vf_ggtt_base(struct xe_gt *gt);
32+
s64 xe_gt_sriov_vf_ggtt_shift(struct xe_gt *gt);
33+
3134
u32 xe_gt_sriov_vf_read32(struct xe_gt *gt, struct xe_reg reg);
3235
void xe_gt_sriov_vf_write32(struct xe_gt *gt, struct xe_reg reg, u32 val);
3336

0 commit comments

Comments
 (0)