Lines Matching refs:rvu
15 static int npa_aq_enqueue_wait(struct rvu *rvu, struct rvu_block *block, in npa_aq_enqueue_wait() argument
26 reg = rvu_read64(rvu, block->addr, NPA_AF_AQ_STATUS); in npa_aq_enqueue_wait()
36 rvu_write64(rvu, block->addr, NPA_AF_AQ_DOOR, 1); in npa_aq_enqueue_wait()
52 int rvu_npa_aq_enq_inst(struct rvu *rvu, struct npa_aq_enq_req *req, in rvu_npa_aq_enq_inst() argument
55 struct rvu_hwinfo *hw = rvu->hw; in rvu_npa_aq_enq_inst()
65 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_npa_aq_enq_inst()
69 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPA, pcifunc); in rvu_npa_aq_enq_inst()
76 dev_warn(rvu->dev, "%s: NPA AQ not initialized\n", __func__); in rvu_npa_aq_enq_inst()
80 npalf = rvu_get_lf(rvu, block, pcifunc, 0); in rvu_npa_aq_enq_inst()
149 rc = npa_aq_enqueue_wait(rvu, block, &inst); in rvu_npa_aq_enq_inst()
201 static int npa_lf_hwctx_disable(struct rvu *rvu, struct hwctx_disable_req *req) in npa_lf_hwctx_disable() argument
203 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, req->hdr.pcifunc); in npa_lf_hwctx_disable()
236 rc = rvu_npa_aq_enq_inst(rvu, &aq_req, NULL); in npa_lf_hwctx_disable()
239 dev_err(rvu->dev, "Failed to disable %s:%d context\n", in npa_lf_hwctx_disable()
249 static int npa_lf_hwctx_lockdown(struct rvu *rvu, struct npa_aq_enq_req *req) in npa_lf_hwctx_lockdown() argument
262 err = rvu_npa_aq_enq_inst(rvu, &lock_ctx_req, NULL); in npa_lf_hwctx_lockdown()
264 dev_err(rvu->dev, in npa_lf_hwctx_lockdown()
272 int rvu_mbox_handler_npa_aq_enq(struct rvu *rvu, in rvu_mbox_handler_npa_aq_enq() argument
278 err = rvu_npa_aq_enq_inst(rvu, req, rsp); in rvu_mbox_handler_npa_aq_enq()
280 err = npa_lf_hwctx_lockdown(rvu, req); in rvu_mbox_handler_npa_aq_enq()
285 int rvu_mbox_handler_npa_aq_enq(struct rvu *rvu, in rvu_mbox_handler_npa_aq_enq() argument
289 return rvu_npa_aq_enq_inst(rvu, req, rsp); in rvu_mbox_handler_npa_aq_enq()
293 int rvu_mbox_handler_npa_hwctx_disable(struct rvu *rvu, in rvu_mbox_handler_npa_hwctx_disable() argument
297 return npa_lf_hwctx_disable(rvu, req); in rvu_mbox_handler_npa_hwctx_disable()
300 static void npa_ctx_free(struct rvu *rvu, struct rvu_pfvf *pfvf) in npa_ctx_free() argument
305 qmem_free(rvu->dev, pfvf->aura_ctx); in npa_ctx_free()
311 qmem_free(rvu->dev, pfvf->pool_ctx); in npa_ctx_free()
314 qmem_free(rvu->dev, pfvf->npa_qints_ctx); in npa_ctx_free()
318 int rvu_mbox_handler_npa_lf_alloc(struct rvu *rvu, in rvu_mbox_handler_npa_lf_alloc() argument
323 struct rvu_hwinfo *hw = rvu->hw; in rvu_mbox_handler_npa_lf_alloc()
337 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_npa_lf_alloc()
338 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPA, pcifunc); in rvu_mbox_handler_npa_lf_alloc()
343 npalf = rvu_get_lf(rvu, block, pcifunc, 0); in rvu_mbox_handler_npa_lf_alloc()
348 err = rvu_lf_reset(rvu, block, npalf); in rvu_mbox_handler_npa_lf_alloc()
350 dev_err(rvu->dev, "Failed to reset NPALF%d\n", npalf); in rvu_mbox_handler_npa_lf_alloc()
354 ctx_cfg = rvu_read64(rvu, blkaddr, NPA_AF_CONST1); in rvu_mbox_handler_npa_lf_alloc()
358 err = qmem_alloc(rvu->dev, &pfvf->aura_ctx, in rvu_mbox_handler_npa_lf_alloc()
370 err = qmem_alloc(rvu->dev, &pfvf->pool_ctx, req->nr_pools, hwctx_size); in rvu_mbox_handler_npa_lf_alloc()
380 cfg = rvu_read64(rvu, blkaddr, NPA_AF_CONST); in rvu_mbox_handler_npa_lf_alloc()
385 err = qmem_alloc(rvu->dev, &pfvf->npa_qints_ctx, qints, hwctx_size); in rvu_mbox_handler_npa_lf_alloc()
389 cfg = rvu_read64(rvu, blkaddr, NPA_AF_LFX_AURAS_CFG(npalf)); in rvu_mbox_handler_npa_lf_alloc()
395 rvu_write64(rvu, blkaddr, NPA_AF_LFX_AURAS_CFG(npalf), cfg); in rvu_mbox_handler_npa_lf_alloc()
398 rvu_write64(rvu, blkaddr, NPA_AF_LFX_LOC_AURAS_BASE(npalf), in rvu_mbox_handler_npa_lf_alloc()
402 rvu_write64(rvu, blkaddr, NPA_AF_LFX_QINTS_CFG(npalf), in rvu_mbox_handler_npa_lf_alloc()
404 rvu_write64(rvu, blkaddr, NPA_AF_LFX_QINTS_BASE(npalf), in rvu_mbox_handler_npa_lf_alloc()
410 npa_ctx_free(rvu, pfvf); in rvu_mbox_handler_npa_lf_alloc()
415 cfg = rvu_read64(rvu, blkaddr, NPA_AF_CONST); in rvu_mbox_handler_npa_lf_alloc()
419 if (!is_rvu_otx2(rvu)) { in rvu_mbox_handler_npa_lf_alloc()
420 cfg = rvu_read64(rvu, block->addr, NPA_AF_BATCH_CTL); in rvu_mbox_handler_npa_lf_alloc()
426 int rvu_mbox_handler_npa_lf_free(struct rvu *rvu, struct msg_req *req, in rvu_mbox_handler_npa_lf_free() argument
429 struct rvu_hwinfo *hw = rvu->hw; in rvu_mbox_handler_npa_lf_free()
436 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_npa_lf_free()
437 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPA, pcifunc); in rvu_mbox_handler_npa_lf_free()
442 npalf = rvu_get_lf(rvu, block, pcifunc, 0); in rvu_mbox_handler_npa_lf_free()
447 err = rvu_lf_reset(rvu, block, npalf); in rvu_mbox_handler_npa_lf_free()
449 dev_err(rvu->dev, "Failed to reset NPALF%d\n", npalf); in rvu_mbox_handler_npa_lf_free()
453 npa_ctx_free(rvu, pfvf); in rvu_mbox_handler_npa_lf_free()
458 static int npa_aq_init(struct rvu *rvu, struct rvu_block *block) in npa_aq_init() argument
464 cfg = rvu_read64(rvu, block->addr, NPA_AF_GEN_CFG); in npa_aq_init()
467 rvu_write64(rvu, block->addr, NPA_AF_GEN_CFG, cfg); in npa_aq_init()
470 rvu_write64(rvu, block->addr, NPA_AF_GEN_CFG, cfg); in npa_aq_init()
474 cfg = rvu_read64(rvu, block->addr, NPA_AF_NDC_CFG); in npa_aq_init()
480 rvu_write64(rvu, block->addr, NPA_AF_NDC_CFG, cfg); in npa_aq_init()
483 if (!is_rvu_otx2(rvu)) { in npa_aq_init()
484 cfg = rvu_read64(rvu, block->addr, NPA_AF_BATCH_CTL); in npa_aq_init()
487 rvu_write64(rvu, block->addr, NPA_AF_BATCH_CTL, cfg); in npa_aq_init()
493 err = rvu_aq_alloc(rvu, &block->aq, in npa_aq_init()
499 rvu_write64(rvu, block->addr, NPA_AF_AQ_CFG, AQ_SIZE); in npa_aq_init()
500 rvu_write64(rvu, block->addr, in npa_aq_init()
505 int rvu_npa_init(struct rvu *rvu) in rvu_npa_init() argument
507 struct rvu_hwinfo *hw = rvu->hw; in rvu_npa_init()
510 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPA, 0); in rvu_npa_init()
515 return npa_aq_init(rvu, &hw->block[blkaddr]); in rvu_npa_init()
518 void rvu_npa_freemem(struct rvu *rvu) in rvu_npa_freemem() argument
520 struct rvu_hwinfo *hw = rvu->hw; in rvu_npa_freemem()
524 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPA, 0); in rvu_npa_freemem()
529 rvu_aq_free(rvu, block->aq); in rvu_npa_freemem()
532 void rvu_npa_lf_teardown(struct rvu *rvu, u16 pcifunc, int npalf) in rvu_npa_lf_teardown() argument
534 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_npa_lf_teardown()
540 npa_lf_hwctx_disable(rvu, &ctx_req); in rvu_npa_lf_teardown()
544 npa_lf_hwctx_disable(rvu, &ctx_req); in rvu_npa_lf_teardown()
546 npa_ctx_free(rvu, pfvf); in rvu_npa_lf_teardown()