xref: /linux/drivers/gpu/drm/xe/xe_gt_sriov_pf_helpers.h (revision db5d28c0bfe566908719bec8e25443aabecbb802)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2023-2024 Intel Corporation
4  */
5 
6 #ifndef _XE_GT_SRIOV_PF_HELPERS_H_
7 #define _XE_GT_SRIOV_PF_HELPERS_H_
8 
9 #include "xe_gt_types.h"
10 #include "xe_sriov_pf_helpers.h"
11 
12 /**
13  * xe_gt_sriov_pf_assert_vfid() - warn if &id is not a supported VF number when debugging.
14  * @gt: the PF &xe_gt to assert on
15  * @vfid: the VF number to assert
16  *
17  * Assert that &gt belongs to the Physical Function (PF) device and provided &vfid
18  * is within a range of supported VF numbers (up to maximum number of VFs that
19  * driver can support, including VF0 that represents the PF itself).
20  *
21  * Note: Effective only on debug builds. See `Xe ASSERTs`_ for more information.
22  */
23 #define xe_gt_sriov_pf_assert_vfid(gt, vfid)	xe_sriov_pf_assert_vfid(gt_to_xe(gt), (vfid))
24 
xe_gt_sriov_pf_get_totalvfs(struct xe_gt * gt)25 static inline int xe_gt_sriov_pf_get_totalvfs(struct xe_gt *gt)
26 {
27 	return xe_sriov_pf_get_totalvfs(gt_to_xe(gt));
28 }
29 
xe_gt_sriov_pf_master_mutex(struct xe_gt * gt)30 static inline struct mutex *xe_gt_sriov_pf_master_mutex(struct xe_gt *gt)
31 {
32 	return xe_sriov_pf_master_mutex(gt_to_xe(gt));
33 }
34 
35 #endif
36