xref: /linux/drivers/gpu/drm/xe/xe_sriov_types.h (revision 260f6f4fda93c8485c8037865c941b42b9cba5d2)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2023 Intel Corporation
4  */
5 
6 #ifndef _XE_SRIOV_TYPES_H_
7 #define _XE_SRIOV_TYPES_H_
8 
9 #include <linux/build_bug.h>
10 
11 /**
12  * VFID - Virtual Function Identifier
13  * @n: VF number
14  *
15  * Helper macro to represent Virtual Function (VF) Identifier.
16  * VFID(0) is used as alias to the PFID that represents Physical Function.
17  *
18  * Note: According to PCI spec, SR-IOV VF's numbers are 1-based (VF1, VF2, ...).
19  */
20 #define VFID(n)		(n)
21 #define PFID		VFID(0)
22 
23 /**
24  * enum xe_sriov_mode - SR-IOV mode
25  * @XE_SRIOV_MODE_NONE: bare-metal mode (non-virtualized)
26  * @XE_SRIOV_MODE_PF: SR-IOV Physical Function (PF) mode
27  * @XE_SRIOV_MODE_VF: SR-IOV Virtual Function (VF) mode
28  */
29 enum xe_sriov_mode {
30 	/*
31 	 * Note: We don't use default enum value 0 to allow catch any too early
32 	 * attempt of checking the SR-IOV mode prior to the actual mode probe.
33 	 */
34 	XE_SRIOV_MODE_NONE = 1,
35 	XE_SRIOV_MODE_PF,
36 	XE_SRIOV_MODE_VF,
37 };
38 static_assert(XE_SRIOV_MODE_NONE);
39 
40 #endif
41