Skip to content

Commit fe16ece

Browse files
SruChallaherbertx
authored andcommitted
crypto: octeontx2 - enable SR-IOV and mailbox communication with VF
Adds 'sriov_configure' to enable/disable virtual functions (VFs). Also Initializes VF<=>PF mailbox IRQs, register handlers for processing these mailbox messages. Admin function (AF) handles resource allocation and configuration for PFs and their VFs. PFs request the AF directly, via mailboxes. Unlike PFs, VFs cannot send a mailbox request directly. A VF sends mailbox messages to its parent PF, with which it shares a mailbox region. The PF then forwards these messages to the AF. After handling the request, the AF sends a response back to the VF, through the PF. This patch adds support for this 'VF <=> PF <=> AF' mailbox communication. Signed-off-by: Suheil Chandran <schandran@marvell.com> Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com> Signed-off-by: Srujana Challa <schalla@marvell.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 83ffcf7 commit fe16ece

File tree

4 files changed

+583
-2
lines changed

4 files changed

+583
-2
lines changed

drivers/crypto/marvell/octeontx2/otx2_cpt_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "rvu.h"
1515
#include "mbox.h"
1616

17+
#define OTX2_CPT_MAX_VFS_NUM 128
1718
#define OTX2_CPT_RVU_FUNC_ADDR_S(blk, slot, offs) \
1819
(((blk) << 20) | ((slot) << 12) | (offs))
1920

drivers/crypto/marvell/octeontx2/otx2_cptpf.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,46 @@
77

88
#include "otx2_cpt_common.h"
99

10+
struct otx2_cptpf_dev;
11+
struct otx2_cptvf_info {
12+
struct otx2_cptpf_dev *cptpf; /* PF pointer this VF belongs to */
13+
struct work_struct vfpf_mbox_work;
14+
struct pci_dev *vf_dev;
15+
int vf_id;
16+
int intr_idx;
17+
};
18+
19+
struct cptpf_flr_work {
20+
struct work_struct work;
21+
struct otx2_cptpf_dev *pf;
22+
};
23+
1024
struct otx2_cptpf_dev {
1125
void __iomem *reg_base; /* CPT PF registers start address */
1226
void __iomem *afpf_mbox_base; /* PF-AF mbox start address */
27+
void __iomem *vfpf_mbox_base; /* VF-PF mbox start address */
1328
struct pci_dev *pdev; /* PCI device handle */
29+
struct otx2_cptvf_info vf[OTX2_CPT_MAX_VFS_NUM];
1430
/* AF <=> PF mbox */
1531
struct otx2_mbox afpf_mbox;
1632
struct work_struct afpf_mbox_work;
1733
struct workqueue_struct *afpf_mbox_wq;
1834

35+
/* VF <=> PF mbox */
36+
struct otx2_mbox vfpf_mbox;
37+
struct workqueue_struct *vfpf_mbox_wq;
38+
39+
struct workqueue_struct *flr_wq;
40+
struct cptpf_flr_work *flr_work;
41+
1942
u8 pf_id; /* RVU PF number */
43+
u8 max_vfs; /* Maximum number of VFs supported by CPT */
44+
u8 enabled_vfs; /* Number of enabled VFs */
2045
};
2146

2247
irqreturn_t otx2_cptpf_afpf_mbox_intr(int irq, void *arg);
2348
void otx2_cptpf_afpf_mbox_handler(struct work_struct *work);
49+
irqreturn_t otx2_cptpf_vfpf_mbox_intr(int irq, void *arg);
50+
void otx2_cptpf_vfpf_mbox_handler(struct work_struct *work);
2451

2552
#endif /* __OTX2_CPTPF_H */

0 commit comments

Comments
 (0)