4646*/
4747#ifndef ADF_ACCEL_DEVICES_H_
4848#define ADF_ACCEL_DEVICES_H_
49+ #include <linux/interrupt.h>
4950#include <linux/module.h>
5051#include <linux/list.h>
5152#include <linux/io.h>
53+ #include <linux/ratelimit.h>
5254#include "adf_cfg_common.h"
5355
5456#define ADF_DH895XCC_DEVICE_NAME "dh895xcc"
57+ #define ADF_DH895XCCVF_DEVICE_NAME "dh895xccvf"
5558#define ADF_DH895XCC_PCI_DEVICE_ID 0x435
59+ #define ADF_DH895XCCIOV_PCI_DEVICE_ID 0x443
5660#define ADF_PCI_MAX_BARS 3
5761#define ADF_DEVICE_NAME_LENGTH 32
5862#define ADF_ETR_MAX_RINGS_PER_BANK 16
@@ -79,6 +83,7 @@ struct adf_bar {
7983struct adf_accel_msix {
8084 struct msix_entry * entries ;
8185 char * * names ;
86+ u32 num_entries ;
8287} __packed ;
8388
8489struct adf_accel_pci {
@@ -99,6 +104,7 @@ enum dev_sku_info {
99104 DEV_SKU_2 ,
100105 DEV_SKU_3 ,
101106 DEV_SKU_4 ,
107+ DEV_SKU_VF ,
102108 DEV_SKU_UNKNOWN ,
103109};
104110
@@ -113,6 +119,8 @@ static inline const char *get_sku_info(enum dev_sku_info info)
113119 return "SKU3" ;
114120 case DEV_SKU_4 :
115121 return "SKU4" ;
122+ case DEV_SKU_VF :
123+ return "SKUVF" ;
116124 case DEV_SKU_UNKNOWN :
117125 default :
118126 break ;
@@ -140,6 +148,8 @@ struct adf_hw_device_data {
140148 uint32_t (* get_etr_bar_id )(struct adf_hw_device_data * self );
141149 uint32_t (* get_num_aes )(struct adf_hw_device_data * self );
142150 uint32_t (* get_num_accels )(struct adf_hw_device_data * self );
151+ uint32_t (* get_pf2vf_offset )(uint32_t i );
152+ uint32_t (* get_vintmsk_offset )(uint32_t i );
143153 enum dev_sku_info (* get_sku )(struct adf_hw_device_data * self );
144154 int (* alloc_irq )(struct adf_accel_dev * accel_dev );
145155 void (* free_irq )(struct adf_accel_dev * accel_dev );
@@ -151,7 +161,9 @@ struct adf_hw_device_data {
151161 void (* exit_arb )(struct adf_accel_dev * accel_dev );
152162 void (* get_arb_mapping )(struct adf_accel_dev * accel_dev ,
153163 const uint32_t * * cfg );
164+ void (* disable_iov )(struct adf_accel_dev * accel_dev );
154165 void (* enable_ints )(struct adf_accel_dev * accel_dev );
166+ int (* enable_vf2pf_comms )(struct adf_accel_dev * accel_dev );
155167 const char * fw_name ;
156168 const char * fw_mmp_name ;
157169 uint32_t fuses ;
@@ -165,6 +177,7 @@ struct adf_hw_device_data {
165177 uint8_t num_accel ;
166178 uint8_t num_logical_accel ;
167179 uint8_t num_engines ;
180+ uint8_t min_iov_compat_ver ;
168181} __packed ;
169182
170183/* CSR write macro */
@@ -189,6 +202,15 @@ struct adf_fw_loader_data {
189202 const struct firmware * mmp_fw ;
190203};
191204
205+ struct adf_accel_vf_info {
206+ struct adf_accel_dev * accel_dev ;
207+ struct tasklet_struct vf2pf_bh_tasklet ;
208+ struct mutex pf2vf_lock ; /* protect CSR access for PF2VF messages */
209+ struct ratelimit_state vf2pf_ratelimit ;
210+ u32 vf_nr ;
211+ bool init ;
212+ };
213+
192214struct adf_accel_dev {
193215 struct adf_etr_data * transport ;
194216 struct adf_hw_device_data * hw_device ;
@@ -202,6 +224,21 @@ struct adf_accel_dev {
202224 struct list_head list ;
203225 struct module * owner ;
204226 struct adf_accel_pci accel_pci_dev ;
227+ union {
228+ struct {
229+ /* vf_info is non-zero when SR-IOV is init'ed */
230+ struct adf_accel_vf_info * vf_info ;
231+ } pf ;
232+ struct {
233+ char * irq_name ;
234+ struct tasklet_struct pf2vf_bh_tasklet ;
235+ struct mutex vf2pf_lock ; /* protect CSR access */
236+ struct completion iov_msg_completion ;
237+ uint8_t compatible ;
238+ uint8_t pf_version ;
239+ } vf ;
240+ };
241+ bool is_vf ;
205242 uint8_t accel_id ;
206243} __packed ;
207244#endif
0 commit comments