Skip to content

Commit 274186f

Browse files
lukaszlagunamwiniars
authored andcommitted
drm/xe/pf: Add helper to retrieve VF's LMEM object
Instead of accessing VF's lmem_obj directly, introduce a helper function to make the access more convenient. Signed-off-by: Lukasz Laguna <lukasz.laguna@intel.com> Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Link: https://patch.msgid.link/20251112132220.516975-21-michal.winiarski@intel.com Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
1 parent b7c1b99 commit 274186f

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,32 @@ int xe_gt_sriov_pf_config_bulk_set_lmem(struct xe_gt *gt, unsigned int vfid,
16921692
"LMEM", n, err);
16931693
}
16941694

1695+
static struct xe_bo *pf_get_vf_config_lmem_obj(struct xe_gt *gt, unsigned int vfid)
1696+
{
1697+
struct xe_gt_sriov_config *config = pf_pick_vf_config(gt, vfid);
1698+
1699+
return config->lmem_obj;
1700+
}
1701+
1702+
/**
1703+
* xe_gt_sriov_pf_config_get_lmem_obj() - Take a reference to the struct &xe_bo backing VF LMEM.
1704+
* @gt: the &xe_gt
1705+
* @vfid: the VF identifier (can't be 0)
1706+
*
1707+
* This function can only be called on PF.
1708+
* The caller is responsible for calling xe_bo_put() on the returned object.
1709+
*
1710+
* Return: pointer to struct &xe_bo backing VF LMEM (if any).
1711+
*/
1712+
struct xe_bo *xe_gt_sriov_pf_config_get_lmem_obj(struct xe_gt *gt, unsigned int vfid)
1713+
{
1714+
xe_gt_assert(gt, vfid);
1715+
1716+
guard(mutex)(xe_gt_sriov_pf_master_mutex(gt));
1717+
1718+
return xe_bo_get(pf_get_vf_config_lmem_obj(gt, vfid));
1719+
}
1720+
16951721
static u64 pf_query_free_lmem(struct xe_gt *gt)
16961722
{
16971723
struct xe_tile *tile = gt->tile;

drivers/gpu/drm/xe/xe_gt_sriov_pf_config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ int xe_gt_sriov_pf_config_set_lmem(struct xe_gt *gt, unsigned int vfid, u64 size
3636
int xe_gt_sriov_pf_config_set_fair_lmem(struct xe_gt *gt, unsigned int vfid, unsigned int num_vfs);
3737
int xe_gt_sriov_pf_config_bulk_set_lmem(struct xe_gt *gt, unsigned int vfid, unsigned int num_vfs,
3838
u64 size);
39+
struct xe_bo *xe_gt_sriov_pf_config_get_lmem_obj(struct xe_gt *gt, unsigned int vfid);
3940

4041
u32 xe_gt_sriov_pf_config_get_exec_quantum(struct xe_gt *gt, unsigned int vfid);
4142
int xe_gt_sriov_pf_config_set_exec_quantum(struct xe_gt *gt, unsigned int vfid, u32 exec_quantum);

0 commit comments

Comments
 (0)