Lines Matching refs:rvu

20 static int lmtst_map_table_ops(struct rvu *rvu, u32 index, u64 *val,  in lmtst_map_table_ops()  argument
26 tbl_base = rvu_read64(rvu, BLKADDR_APR, APR_AF_LMT_MAP_BASE); in lmtst_map_table_ops()
30 dev_err(rvu->dev, "Failed to setup lmt map table mapping!!\n"); in lmtst_map_table_ops()
43 rvu_write64(rvu, BLKADDR_APR, APR_AF_LMT_CTL, BIT_ULL(0)); in lmtst_map_table_ops()
44 rvu_read64(rvu, BLKADDR_APR, APR_AF_LMT_CTL); in lmtst_map_table_ops()
45 rvu_write64(rvu, BLKADDR_APR, APR_AF_LMT_CTL, 0x00); in lmtst_map_table_ops()
53 static u32 rvu_get_lmtst_tbl_index(struct rvu *rvu, u16 pcifunc) in rvu_get_lmtst_tbl_index() argument
55 return ((rvu_get_pf(pcifunc) * rvu->hw->total_vfs) + in rvu_get_lmtst_tbl_index()
59 static int rvu_get_lmtaddr(struct rvu *rvu, u16 pcifunc, in rvu_get_lmtaddr() argument
66 dev_err(rvu->dev, "%s Requested Null address for transulation\n", __func__); in rvu_get_lmtaddr()
70 rvu_write64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_ADDR_REQ, iova); in rvu_get_lmtaddr()
74 rvu_write64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_TXN_REQ, val); in rvu_get_lmtaddr()
76 err = rvu_poll_reg(rvu, BLKADDR_RVUM, RVU_AF_SMMU_ADDR_RSP_STS, BIT_ULL(0), false); in rvu_get_lmtaddr()
78 dev_err(rvu->dev, "%s LMTLINE iova transulation failed\n", __func__); in rvu_get_lmtaddr()
81 val = rvu_read64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_ADDR_RSP_STS); in rvu_get_lmtaddr()
83 dev_err(rvu->dev, "%s LMTLINE iova transulation failed err:%llx\n", __func__, val); in rvu_get_lmtaddr()
89 pa = rvu_read64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_TLN_FLIT0) >> 18; in rvu_get_lmtaddr()
96 static int rvu_update_lmtaddr(struct rvu *rvu, u16 pcifunc, u64 lmt_addr) in rvu_update_lmtaddr() argument
98 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_update_lmtaddr()
104 tbl_idx = rvu_get_lmtst_tbl_index(rvu, pcifunc); in rvu_update_lmtaddr()
105 err = lmtst_map_table_ops(rvu, tbl_idx, &val, LMT_TBL_OP_READ); in rvu_update_lmtaddr()
107 dev_err(rvu->dev, in rvu_update_lmtaddr()
121 err = lmtst_map_table_ops(rvu, tbl_idx, &lmt_addr, LMT_TBL_OP_WRITE); in rvu_update_lmtaddr()
123 dev_err(rvu->dev, in rvu_update_lmtaddr()
131 int rvu_mbox_handler_lmtst_tbl_setup(struct rvu *rvu, in rvu_mbox_handler_lmtst_tbl_setup() argument
135 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, req->hdr.pcifunc); in rvu_mbox_handler_lmtst_tbl_setup()
146 err = rvu_get_lmtaddr(rvu, req->hdr.pcifunc, in rvu_mbox_handler_lmtst_tbl_setup()
152 err = rvu_update_lmtaddr(rvu, req->hdr.pcifunc, lmt_addr); in rvu_mbox_handler_lmtst_tbl_setup()
167 pri_tbl_idx = rvu_get_lmtst_tbl_index(rvu, req->base_pcifunc); in rvu_mbox_handler_lmtst_tbl_setup()
170 err = lmtst_map_table_ops(rvu, pri_tbl_idx, &val, in rvu_mbox_handler_lmtst_tbl_setup()
173 dev_err(rvu->dev, in rvu_mbox_handler_lmtst_tbl_setup()
182 err = rvu_update_lmtaddr(rvu, req->hdr.pcifunc, val); in rvu_mbox_handler_lmtst_tbl_setup()
192 tbl_idx = rvu_get_lmtst_tbl_index(rvu, req->hdr.pcifunc); in rvu_mbox_handler_lmtst_tbl_setup()
193 err = lmtst_map_table_ops(rvu, tbl_idx + LMT_MAP_TBL_W1_OFF, in rvu_mbox_handler_lmtst_tbl_setup()
196 dev_err(rvu->dev, in rvu_mbox_handler_lmtst_tbl_setup()
222 err = lmtst_map_table_ops(rvu, tbl_idx + LMT_MAP_TBL_W1_OFF, in rvu_mbox_handler_lmtst_tbl_setup()
225 dev_err(rvu->dev, in rvu_mbox_handler_lmtst_tbl_setup()
237 void rvu_reset_lmt_map_tbl(struct rvu *rvu, u16 pcifunc) in rvu_reset_lmt_map_tbl() argument
239 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_reset_lmt_map_tbl()
243 if (is_rvu_otx2(rvu)) in rvu_reset_lmt_map_tbl()
248 tbl_idx = rvu_get_lmtst_tbl_index(rvu, pcifunc); in rvu_reset_lmt_map_tbl()
253 err = lmtst_map_table_ops(rvu, tbl_idx, in rvu_reset_lmt_map_tbl()
257 dev_err(rvu->dev, in rvu_reset_lmt_map_tbl()
266 err = lmtst_map_table_ops(rvu, in rvu_reset_lmt_map_tbl()
271 dev_err(rvu->dev, in rvu_reset_lmt_map_tbl()
279 int rvu_set_channels_base(struct rvu *rvu) in rvu_set_channels_base() argument
283 struct rvu_hwinfo *hw = rvu->hw; in rvu_set_channels_base()
287 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, 0); in rvu_set_channels_base()
291 nix_const = rvu_read64(rvu, blkaddr, NIX_AF_CONST); in rvu_set_channels_base()
292 nix_const1 = rvu_read64(rvu, blkaddr, NIX_AF_CONST1); in rvu_set_channels_base()
340 dev_err(rvu->dev, in rvu_set_channels_base()
350 static void __rvu_lbk_set_chans(struct rvu *rvu, void __iomem *base, in __rvu_lbk_set_chans() argument
353 struct rvu_hwinfo *hw = rvu->hw; in __rvu_lbk_set_chans()
366 static void rvu_lbk_set_channels(struct rvu *rvu) in rvu_lbk_set_channels() argument
405 __rvu_lbk_set_chans(rvu, base, LBK_LINK_CFG_X2P, in rvu_lbk_set_channels()
407 __rvu_lbk_set_chans(rvu, base, LBK_LINK_CFG_P2X, in rvu_lbk_set_channels()
410 __rvu_lbk_set_chans(rvu, base, LBK_LINK_CFG_X2P, in rvu_lbk_set_channels()
412 __rvu_lbk_set_chans(rvu, base, LBK_LINK_CFG_P2X, in rvu_lbk_set_channels()
417 __rvu_lbk_set_chans(rvu, base, LBK_LINK_CFG_X2P, in rvu_lbk_set_channels()
419 __rvu_lbk_set_chans(rvu, base, LBK_LINK_CFG_P2X, in rvu_lbk_set_channels()
422 __rvu_lbk_set_chans(rvu, base, LBK_LINK_CFG_X2P, in rvu_lbk_set_channels()
424 __rvu_lbk_set_chans(rvu, base, LBK_LINK_CFG_P2X, in rvu_lbk_set_channels()
434 static void __rvu_nix_set_channels(struct rvu *rvu, int blkaddr) in __rvu_nix_set_channels() argument
436 u64 nix_const1 = rvu_read64(rvu, blkaddr, NIX_AF_CONST1); in __rvu_nix_set_channels()
437 u64 nix_const = rvu_read64(rvu, blkaddr, NIX_AF_CONST); in __rvu_nix_set_channels()
439 struct rvu_hwinfo *hw = rvu->hw; in __rvu_nix_set_channels()
451 cfg = rvu_read64(rvu, blkaddr, NIX_AF_LINKX_CFG(nix_link)); in __rvu_nix_set_channels()
455 rvu_write64(rvu, blkaddr, NIX_AF_LINKX_CFG(nix_link), cfg); in __rvu_nix_set_channels()
461 cfg = rvu_read64(rvu, blkaddr, NIX_AF_LINKX_CFG(nix_link)); in __rvu_nix_set_channels()
465 rvu_write64(rvu, blkaddr, NIX_AF_LINKX_CFG(nix_link), cfg); in __rvu_nix_set_channels()
471 cfg = rvu_read64(rvu, blkaddr, NIX_AF_LINKX_CFG(nix_link)); in __rvu_nix_set_channels()
475 rvu_write64(rvu, blkaddr, NIX_AF_LINKX_CFG(nix_link), cfg); in __rvu_nix_set_channels()
481 cfg = rvu_read64(rvu, blkaddr, NIX_AF_LINKX_CFG(nix_link)); in __rvu_nix_set_channels()
485 rvu_write64(rvu, blkaddr, NIX_AF_LINKX_CFG(nix_link), cfg); in __rvu_nix_set_channels()
490 static void rvu_nix_set_channels(struct rvu *rvu) in rvu_nix_set_channels() argument
494 blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr); in rvu_nix_set_channels()
496 __rvu_nix_set_channels(rvu, blkaddr); in rvu_nix_set_channels()
497 blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr); in rvu_nix_set_channels()
516 static void rvu_rpm_set_channels(struct rvu *rvu) in rvu_rpm_set_channels() argument
518 struct rvu_hwinfo *hw = rvu->hw; in rvu_rpm_set_channels()
522 for (cgx = 0; cgx < rvu->cgx_cnt_max; cgx++) { in rvu_rpm_set_channels()
530 void rvu_program_channels(struct rvu *rvu) in rvu_program_channels() argument
532 struct rvu_hwinfo *hw = rvu->hw; in rvu_program_channels()
537 rvu_nix_set_channels(rvu); in rvu_program_channels()
538 rvu_lbk_set_channels(rvu); in rvu_program_channels()
539 rvu_rpm_set_channels(rvu); in rvu_program_channels()
542 void rvu_nix_block_cn10k_init(struct rvu *rvu, struct nix_hw *nix_hw) in rvu_nix_block_cn10k_init() argument
550 rvu_write64(rvu, blkaddr, NIX_AF_VWQE_TIMER, 0x3FULL); in rvu_nix_block_cn10k_init()
555 cfg = rvu_read64(rvu, blkaddr, NIX_AF_CFG); in rvu_nix_block_cn10k_init()
557 rvu_write64(rvu, blkaddr, NIX_AF_CFG, cfg); in rvu_nix_block_cn10k_init()