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 #include <linux/mutex.h> 11 #include <linux/types.h> 12 13 /** 14 * VFID - Virtual Function Identifier 15 * @n: VF number 16 * 17 * Helper macro to represent Virtual Function (VF) Identifier. 18 * VFID(0) is used as alias to the PFID that represents Physical Function. 19 * 20 * Note: According to PCI spec, SR-IOV VF's numbers are 1-based (VF1, VF2, ...). 21 */ 22 #define VFID(n) (n) 23 #define PFID VFID(0) 24 25 /** 26 * enum xe_sriov_mode - SR-IOV mode 27 * @XE_SRIOV_MODE_NONE: bare-metal mode (non-virtualized) 28 * @XE_SRIOV_MODE_PF: SR-IOV Physical Function (PF) mode 29 * @XE_SRIOV_MODE_VF: SR-IOV Virtual Function (VF) mode 30 */ 31 enum xe_sriov_mode { 32 /* 33 * Note: We don't use default enum value 0 to allow catch any too early 34 * attempt of checking the SR-IOV mode prior to the actual mode probe. 35 */ 36 XE_SRIOV_MODE_NONE = 1, 37 XE_SRIOV_MODE_PF, 38 XE_SRIOV_MODE_VF, 39 }; 40 static_assert(XE_SRIOV_MODE_NONE); 41 42 /** 43 * struct xe_device_pf - Xe PF related data 44 * 45 * The data in this structure is valid only if driver is running in the 46 * @XE_SRIOV_MODE_PF mode. 47 */ 48 struct xe_device_pf { 49 /** @device_total_vfs: Maximum number of VFs supported by the device. */ 50 u16 device_total_vfs; 51 52 /** @driver_max_vfs: Maximum number of VFs supported by the driver. */ 53 u16 driver_max_vfs; 54 55 /** @master_lock: protects all VFs configurations across GTs */ 56 struct mutex master_lock; 57 }; 58 59 #endif 60