Skip to content

Commit 023ed57

Browse files
committed
Merge branch 'cn20k-silicon-with-mbox-support'
Subbaraya Sundeep says: ==================== CN20K silicon with mbox support CN20K is the next generation silicon in the Octeon series with various improvements and new features. Along with other changes the mailbox communication mechanism between RVU (Resource virtualization Unit) SRIOV PFs/VFs with Admin function (AF) has also gone through some changes. Some of those changes are - Separate IRQs for mbox request and response/ack. - Configurable mbox size, default being 64KB. - Ability for VFs to communicate with RVU AF instead of going through parent SRIOV PF. Due to more memory requirement due to configurable mbox size, mbox memory will now have to be allocated by - AF (PF0) for communicating with other PFs and all VFs in the system. - PF for communicating with it's child VFs. On previous silicons mbox memory was reserved and configured by firmware. This patch series add basic mbox support for AF (PF0) <=> PFs and PF <=> VFs. AF <=> VFs communication and variable mbox size support will come in later. Patch kernel-patches#1 Supported co-existance of bit encoding PFs and VFs in 16-bit hardware pcifunc format between CN20K silicon and older octeon series. Also exported PF,VF masks and shifts present in mailbox module to all other modules. Patch kernel-patches#2 Added basic mbox operation APIs and structures to support both CN20K and previous version of silicons. Patch kernel-patches#3 This patch adds support for basic mbox infrastructure implementation for CN20K silicon in AF perspective. There are few updates w.r.t MBOX ACK interrupt and offsets in CN20k. Patch kernel-patches#4 Added mbox implementation between NIC PF and AF for CN20K. Patch kernel-patches#5 Added mbox communication support between AF and AF's VFs. Patch kernel-patches#6 This patch adds support for MBOX communication between NIC PF and its VFs. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents b34441e + 70f8986 commit 023ed57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1570
-302
lines changed

drivers/crypto/marvell/octeontx2/otx2_cpt_common.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
#define OTX2_CPT_MAX_VFS_NUM 128
1919
#define OTX2_CPT_RVU_FUNC_ADDR_S(blk, slot, offs) \
2020
(((blk) << 20) | ((slot) << 12) | (offs))
21-
#define OTX2_CPT_RVU_PFFUNC(pf, func) \
22-
((((pf) & RVU_PFVF_PF_MASK) << RVU_PFVF_PF_SHIFT) | \
23-
(((func) & RVU_PFVF_FUNC_MASK) << RVU_PFVF_FUNC_SHIFT))
21+
22+
#define OTX2_CPT_RVU_PFFUNC(pdev, pf, func) rvu_make_pcifunc(pdev, pf, func)
2423

2524
#define OTX2_CPT_INVALID_CRYPTO_ENG_GRP 0xFF
2625
#define OTX2_CPT_NAME_LENGTH 64

drivers/crypto/marvell/octeontx2/otx2_cptpf_mbox.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static int send_inline_ipsec_inbound_msg(struct otx2_cptpf_dev *cptpf,
142142
memset(req, 0, sizeof(*req));
143143
req->hdr.id = MBOX_MSG_CPT_INLINE_IPSEC_CFG;
144144
req->hdr.sig = OTX2_MBOX_REQ_SIG;
145-
req->hdr.pcifunc = OTX2_CPT_RVU_PFFUNC(cptpf->pf_id, 0);
145+
req->hdr.pcifunc = OTX2_CPT_RVU_PFFUNC(cptpf->pdev, cptpf->pf_id, 0);
146146
req->dir = CPT_INLINE_INBOUND;
147147
req->slot = slot;
148148
req->sso_pf_func_ovrd = cptpf->sso_pf_func_ovrd;
@@ -184,7 +184,8 @@ static int rx_inline_ipsec_lf_cfg(struct otx2_cptpf_dev *cptpf, u8 egrp,
184184
nix_req->gen_cfg.opcode = cpt_inline_rx_opcode(pdev);
185185
nix_req->gen_cfg.param1 = req->param1;
186186
nix_req->gen_cfg.param2 = req->param2;
187-
nix_req->inst_qsel.cpt_pf_func = OTX2_CPT_RVU_PFFUNC(cptpf->pf_id, 0);
187+
nix_req->inst_qsel.cpt_pf_func =
188+
OTX2_CPT_RVU_PFFUNC(cptpf->pdev, cptpf->pf_id, 0);
188189
nix_req->inst_qsel.cpt_slot = 0;
189190
ret = otx2_cpt_send_mbox_msg(&cptpf->afpf_mbox, pdev);
190191
if (ret)
@@ -392,9 +393,8 @@ void otx2_cptpf_vfpf_mbox_handler(struct work_struct *work)
392393
msg = (struct mbox_msghdr *)(mdev->mbase + offset);
393394

394395
/* Set which VF sent this message based on mbox IRQ */
395-
msg->pcifunc = ((u16)cptpf->pf_id << RVU_PFVF_PF_SHIFT) |
396-
((vf->vf_id + 1) & RVU_PFVF_FUNC_MASK);
397-
396+
msg->pcifunc = rvu_make_pcifunc(cptpf->pdev, cptpf->pf_id,
397+
(vf->vf_id + 1));
398398
err = cptpf_handle_vf_req(cptpf, vf, msg,
399399
msg->next_msgoff - offset);
400400
/*
@@ -469,8 +469,7 @@ static void process_afpf_mbox_msg(struct otx2_cptpf_dev *cptpf,
469469

470470
switch (msg->id) {
471471
case MBOX_MSG_READY:
472-
cptpf->pf_id = (msg->pcifunc >> RVU_PFVF_PF_SHIFT) &
473-
RVU_PFVF_PF_MASK;
472+
cptpf->pf_id = rvu_get_pf(cptpf->pdev, msg->pcifunc);
474473
break;
475474
case MBOX_MSG_MSIX_OFFSET:
476475
rsp_msix = (struct msix_offset_rsp *) msg;

drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ static int cptx_set_ucode_base(struct otx2_cpt_eng_grp_info *eng_grp,
176176
/* Set PF number for microcode fetches */
177177
ret = otx2_cpt_write_af_reg(&cptpf->afpf_mbox, cptpf->pdev,
178178
CPT_AF_PF_FUNC,
179-
cptpf->pf_id << RVU_PFVF_PF_SHIFT, blkaddr);
179+
rvu_make_pcifunc(cptpf->pdev,
180+
cptpf->pf_id, 0),
181+
blkaddr);
180182
if (ret)
181183
return ret;
182184

drivers/crypto/marvell/octeontx2/otx2_cptvf_mbox.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ int otx2_cptvf_send_eng_grp_num_msg(struct otx2_cptvf_dev *cptvf, int eng_type)
189189
}
190190
req->hdr.id = MBOX_MSG_GET_ENG_GRP_NUM;
191191
req->hdr.sig = OTX2_MBOX_REQ_SIG;
192-
req->hdr.pcifunc = OTX2_CPT_RVU_PFFUNC(cptvf->vf_id, 0);
192+
req->hdr.pcifunc = OTX2_CPT_RVU_PFFUNC(cptvf->pdev, cptvf->vf_id, 0);
193193
req->eng_type = eng_type;
194194

195195
return otx2_cpt_send_mbox_msg(mbox, pdev);
@@ -210,7 +210,7 @@ int otx2_cptvf_send_kvf_limits_msg(struct otx2_cptvf_dev *cptvf)
210210
}
211211
req->id = MBOX_MSG_GET_KVF_LIMITS;
212212
req->sig = OTX2_MBOX_REQ_SIG;
213-
req->pcifunc = OTX2_CPT_RVU_PFFUNC(cptvf->vf_id, 0);
213+
req->pcifunc = OTX2_CPT_RVU_PFFUNC(cptvf->pdev, cptvf->vf_id, 0);
214214

215215
return otx2_cpt_send_mbox_msg(mbox, pdev);
216216
}
@@ -230,7 +230,7 @@ int otx2_cptvf_send_caps_msg(struct otx2_cptvf_dev *cptvf)
230230
}
231231
req->id = MBOX_MSG_GET_CAPS;
232232
req->sig = OTX2_MBOX_REQ_SIG;
233-
req->pcifunc = OTX2_CPT_RVU_PFFUNC(cptvf->vf_id, 0);
233+
req->pcifunc = OTX2_CPT_RVU_PFFUNC(cptvf->pdev, cptvf->vf_id, 0);
234234

235235
return otx2_cpt_send_mbox_msg(mbox, pdev);
236236
}

drivers/net/ethernet/marvell/octeontx2/af/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ rvu_af-y := cgx.o rvu.o rvu_cgx.o rvu_npa.o rvu_nix.o \
1212
rvu_reg.o rvu_npc.o rvu_debugfs.o ptp.o rvu_npc_fs.o \
1313
rvu_cpt.o rvu_devlink.o rpm.o rvu_cn10k.o rvu_switch.o \
1414
rvu_sdp.o rvu_npc_hash.o mcs.o mcs_rvu_if.o mcs_cnf10kb.o \
15-
rvu_rep.o
15+
rvu_rep.o cn20k/mbox_init.o
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/* Marvell RVU Admin Function driver
3+
*
4+
* Copyright (C) 2024 Marvell.
5+
*
6+
*/
7+
8+
#ifndef CN20K_API_H
9+
#define CN20K_API_H
10+
11+
#include "../rvu.h"
12+
13+
struct ng_rvu {
14+
struct mbox_ops *rvu_mbox_ops;
15+
struct qmem *pf_mbox_addr;
16+
struct qmem *vf_mbox_addr;
17+
};
18+
19+
/* Mbox related APIs */
20+
int cn20k_rvu_mbox_init(struct rvu *rvu, int type, int num);
21+
int cn20k_rvu_get_mbox_regions(struct rvu *rvu, void **mbox_addr,
22+
int num, int type, unsigned long *pf_bmap);
23+
void cn20k_free_mbox_memory(struct rvu *rvu);
24+
int cn20k_register_afpf_mbox_intr(struct rvu *rvu);
25+
int cn20k_register_afvf_mbox_intr(struct rvu *rvu, int pf_vec_start);
26+
void cn20k_rvu_enable_mbox_intr(struct rvu *rvu);
27+
void cn20k_rvu_unregister_interrupts(struct rvu *rvu);
28+
int cn20k_mbox_setup(struct otx2_mbox *mbox, struct pci_dev *pdev,
29+
void *reg_base, int direction, int ndevs);
30+
void cn20k_rvu_enable_afvf_intr(struct rvu *rvu, int vfs);
31+
void cn20k_rvu_disable_afvf_intr(struct rvu *rvu, int vfs);
32+
#endif /* CN20K_API_H */

0 commit comments

Comments
 (0)