Lines Matching full:block

29 				struct rvu_block *block, int lf);
31 struct rvu_block *block, int lf);
59 /* Poll a RVU block's register 'offset', for a 'zero'
62 int rvu_poll_reg(struct rvu *rvu, u64 block, u64 offset, u64 mask, bool zero) in rvu_poll_reg() argument
68 reg = rvu->afreg_base + ((block << 28) | offset); in rvu_poll_reg()
164 /* Get block LF's HW index from a PF_FUNC's block slot number */
165 int rvu_get_lf(struct rvu *rvu, struct rvu_block *block, u16 pcifunc, u16 slot) in rvu_get_lf() argument
171 for (lf = 0; lf < block->lf.max; lf++) { in rvu_get_lf()
172 if (block->fn_map[lf] == pcifunc) { in rvu_get_lf()
260 struct rvu_block *block, u16 pcifunc, in rvu_update_rsrc_map() argument
267 if (lf >= block->lf.max) { in rvu_update_rsrc_map()
270 __func__, lf, block->name, block->lf.max); in rvu_update_rsrc_map()
283 block->fn_map[lf] = attach ? pcifunc : 0; in rvu_update_rsrc_map()
285 switch (block->type) { in rvu_update_rsrc_map()
312 reg = is_pf ? block->pf_lfcnt_reg : block->vf_lfcnt_reg; in rvu_update_rsrc_map()
378 struct rvu_block *block; in is_block_implemented() local
383 block = &hw->block[blkaddr]; in is_block_implemented()
384 return block->implemented; in is_block_implemented()
390 struct rvu_block *block; in rvu_check_block_implemented() local
394 /* For each block check if 'implemented' bit is set */ in rvu_check_block_implemented()
396 block = &hw->block[blkid]; in rvu_check_block_implemented()
399 block->implemented = true; in rvu_check_block_implemented()
403 int rvu_lf_reset(struct rvu *rvu, struct rvu_block *block, int lf) in rvu_lf_reset() argument
407 if (!block->implemented) in rvu_lf_reset()
410 rvu_write64(rvu, block->addr, block->lfreset_reg, lf | BIT_ULL(12)); in rvu_lf_reset()
411 err = rvu_poll_reg(rvu, block->addr, block->lfreset_reg, BIT_ULL(12), in rvu_lf_reset()
418 struct rvu_block *block = &rvu->hw->block[blkaddr]; in rvu_block_reset() local
420 if (!block->implemented) in rvu_block_reset()
441 static void rvu_scan_block(struct rvu *rvu, struct rvu_block *block) in rvu_scan_block() argument
447 for (lf = 0; lf < block->lf.max; lf++) { in rvu_scan_block()
448 cfg = rvu_read64(rvu, block->addr, in rvu_scan_block()
449 block->lfcfg_reg | (lf << block->lfshift)); in rvu_scan_block()
454 __set_bit(lf, block->lf.bmap); in rvu_scan_block()
458 rvu_update_rsrc_map(rvu, pfvf, block, in rvu_scan_block()
462 rvu_set_msix_offset(rvu, pfvf, block, lf); in rvu_scan_block()
521 /* Allocate memory for MSIX vector to RVU block LF mapping */ in rvu_setup_msix_resources()
528 * AF, block AF and PF0_INT vectors, so jump to VFs. in rvu_setup_msix_resources()
602 struct rvu_block *block; in rvu_free_hw_resources() local
611 /* Free block LF bitmaps */ in rvu_free_hw_resources()
613 block = &hw->block[id]; in rvu_free_hw_resources()
614 kfree(block->lf.bmap); in rvu_free_hw_resources()
643 struct rvu_block *block; in rvu_setup_hw_resources() local
654 block = &hw->block[BLKADDR_NPA]; in rvu_setup_hw_resources()
655 if (!block->implemented) in rvu_setup_hw_resources()
658 block->lf.max = (cfg >> 16) & 0xFFF; in rvu_setup_hw_resources()
659 block->addr = BLKADDR_NPA; in rvu_setup_hw_resources()
660 block->type = BLKTYPE_NPA; in rvu_setup_hw_resources()
661 block->lfshift = 8; in rvu_setup_hw_resources()
662 block->lookup_reg = NPA_AF_RVU_LF_CFG_DEBUG; in rvu_setup_hw_resources()
663 block->pf_lfcnt_reg = RVU_PRIV_PFX_NPA_CFG; in rvu_setup_hw_resources()
664 block->vf_lfcnt_reg = RVU_PRIV_HWVFX_NPA_CFG; in rvu_setup_hw_resources()
665 block->lfcfg_reg = NPA_PRIV_LFX_CFG; in rvu_setup_hw_resources()
666 block->msixcfg_reg = NPA_PRIV_LFX_INT_CFG; in rvu_setup_hw_resources()
667 block->lfreset_reg = NPA_AF_LF_RST; in rvu_setup_hw_resources()
668 sprintf(block->name, "NPA"); in rvu_setup_hw_resources()
669 err = rvu_alloc_bitmap(&block->lf); in rvu_setup_hw_resources()
675 block = &hw->block[BLKADDR_NIX0]; in rvu_setup_hw_resources()
676 if (!block->implemented) in rvu_setup_hw_resources()
679 block->lf.max = cfg & 0xFFF; in rvu_setup_hw_resources()
680 block->addr = BLKADDR_NIX0; in rvu_setup_hw_resources()
681 block->type = BLKTYPE_NIX; in rvu_setup_hw_resources()
682 block->lfshift = 8; in rvu_setup_hw_resources()
683 block->lookup_reg = NIX_AF_RVU_LF_CFG_DEBUG; in rvu_setup_hw_resources()
684 block->pf_lfcnt_reg = RVU_PRIV_PFX_NIX0_CFG; in rvu_setup_hw_resources()
685 block->vf_lfcnt_reg = RVU_PRIV_HWVFX_NIX0_CFG; in rvu_setup_hw_resources()
686 block->lfcfg_reg = NIX_PRIV_LFX_CFG; in rvu_setup_hw_resources()
687 block->msixcfg_reg = NIX_PRIV_LFX_INT_CFG; in rvu_setup_hw_resources()
688 block->lfreset_reg = NIX_AF_LF_RST; in rvu_setup_hw_resources()
689 sprintf(block->name, "NIX"); in rvu_setup_hw_resources()
690 err = rvu_alloc_bitmap(&block->lf); in rvu_setup_hw_resources()
696 block = &hw->block[BLKADDR_SSO]; in rvu_setup_hw_resources()
697 if (!block->implemented) in rvu_setup_hw_resources()
700 block->lf.max = cfg & 0xFFFF; in rvu_setup_hw_resources()
701 block->addr = BLKADDR_SSO; in rvu_setup_hw_resources()
702 block->type = BLKTYPE_SSO; in rvu_setup_hw_resources()
703 block->multislot = true; in rvu_setup_hw_resources()
704 block->lfshift = 3; in rvu_setup_hw_resources()
705 block->lookup_reg = SSO_AF_RVU_LF_CFG_DEBUG; in rvu_setup_hw_resources()
706 block->pf_lfcnt_reg = RVU_PRIV_PFX_SSO_CFG; in rvu_setup_hw_resources()
707 block->vf_lfcnt_reg = RVU_PRIV_HWVFX_SSO_CFG; in rvu_setup_hw_resources()
708 block->lfcfg_reg = SSO_PRIV_LFX_HWGRP_CFG; in rvu_setup_hw_resources()
709 block->msixcfg_reg = SSO_PRIV_LFX_HWGRP_INT_CFG; in rvu_setup_hw_resources()
710 block->lfreset_reg = SSO_AF_LF_HWGRP_RST; in rvu_setup_hw_resources()
711 sprintf(block->name, "SSO GROUP"); in rvu_setup_hw_resources()
712 err = rvu_alloc_bitmap(&block->lf); in rvu_setup_hw_resources()
718 block = &hw->block[BLKADDR_SSOW]; in rvu_setup_hw_resources()
719 if (!block->implemented) in rvu_setup_hw_resources()
721 block->lf.max = (cfg >> 56) & 0xFF; in rvu_setup_hw_resources()
722 block->addr = BLKADDR_SSOW; in rvu_setup_hw_resources()
723 block->type = BLKTYPE_SSOW; in rvu_setup_hw_resources()
724 block->multislot = true; in rvu_setup_hw_resources()
725 block->lfshift = 3; in rvu_setup_hw_resources()
726 block->lookup_reg = SSOW_AF_RVU_LF_HWS_CFG_DEBUG; in rvu_setup_hw_resources()
727 block->pf_lfcnt_reg = RVU_PRIV_PFX_SSOW_CFG; in rvu_setup_hw_resources()
728 block->vf_lfcnt_reg = RVU_PRIV_HWVFX_SSOW_CFG; in rvu_setup_hw_resources()
729 block->lfcfg_reg = SSOW_PRIV_LFX_HWS_CFG; in rvu_setup_hw_resources()
730 block->msixcfg_reg = SSOW_PRIV_LFX_HWS_INT_CFG; in rvu_setup_hw_resources()
731 block->lfreset_reg = SSOW_AF_LF_HWS_RST; in rvu_setup_hw_resources()
732 sprintf(block->name, "SSOWS"); in rvu_setup_hw_resources()
733 err = rvu_alloc_bitmap(&block->lf); in rvu_setup_hw_resources()
739 block = &hw->block[BLKADDR_TIM]; in rvu_setup_hw_resources()
740 if (!block->implemented) in rvu_setup_hw_resources()
743 block->lf.max = cfg & 0xFFFF; in rvu_setup_hw_resources()
744 block->addr = BLKADDR_TIM; in rvu_setup_hw_resources()
745 block->type = BLKTYPE_TIM; in rvu_setup_hw_resources()
746 block->multislot = true; in rvu_setup_hw_resources()
747 block->lfshift = 3; in rvu_setup_hw_resources()
748 block->lookup_reg = TIM_AF_RVU_LF_CFG_DEBUG; in rvu_setup_hw_resources()
749 block->pf_lfcnt_reg = RVU_PRIV_PFX_TIM_CFG; in rvu_setup_hw_resources()
750 block->vf_lfcnt_reg = RVU_PRIV_HWVFX_TIM_CFG; in rvu_setup_hw_resources()
751 block->lfcfg_reg = TIM_PRIV_LFX_CFG; in rvu_setup_hw_resources()
752 block->msixcfg_reg = TIM_PRIV_LFX_INT_CFG; in rvu_setup_hw_resources()
753 block->lfreset_reg = TIM_AF_LF_RST; in rvu_setup_hw_resources()
754 sprintf(block->name, "TIM"); in rvu_setup_hw_resources()
755 err = rvu_alloc_bitmap(&block->lf); in rvu_setup_hw_resources()
761 block = &hw->block[BLKADDR_CPT0]; in rvu_setup_hw_resources()
762 if (!block->implemented) in rvu_setup_hw_resources()
765 block->lf.max = cfg & 0xFF; in rvu_setup_hw_resources()
766 block->addr = BLKADDR_CPT0; in rvu_setup_hw_resources()
767 block->type = BLKTYPE_CPT; in rvu_setup_hw_resources()
768 block->multislot = true; in rvu_setup_hw_resources()
769 block->lfshift = 3; in rvu_setup_hw_resources()
770 block->lookup_reg = CPT_AF_RVU_LF_CFG_DEBUG; in rvu_setup_hw_resources()
771 block->pf_lfcnt_reg = RVU_PRIV_PFX_CPT0_CFG; in rvu_setup_hw_resources()
772 block->vf_lfcnt_reg = RVU_PRIV_HWVFX_CPT0_CFG; in rvu_setup_hw_resources()
773 block->lfcfg_reg = CPT_PRIV_LFX_CFG; in rvu_setup_hw_resources()
774 block->msixcfg_reg = CPT_PRIV_LFX_INT_CFG; in rvu_setup_hw_resources()
775 block->lfreset_reg = CPT_AF_LF_RST; in rvu_setup_hw_resources()
776 sprintf(block->name, "CPT"); in rvu_setup_hw_resources()
777 err = rvu_alloc_bitmap(&block->lf); in rvu_setup_hw_resources()
800 block = &hw->block[blkid]; in rvu_setup_hw_resources()
801 if (!block->lf.bmap) in rvu_setup_hw_resources()
804 /* Allocate memory for block LF/slot to pcifunc mapping info */ in rvu_setup_hw_resources()
805 block->fn_map = devm_kcalloc(rvu->dev, block->lf.max, in rvu_setup_hw_resources()
807 if (!block->fn_map) in rvu_setup_hw_resources()
813 rvu_scan_block(rvu, block); in rvu_setup_hw_resources()
886 /* Get current count of a RVU block's LF/slots
924 static int rvu_lookup_rsrc(struct rvu *rvu, struct rvu_block *block, in rvu_lookup_rsrc() argument
930 rvu_write64(rvu, block->addr, block->lookup_reg, val); in rvu_lookup_rsrc()
933 while (rvu_read64(rvu, block->addr, block->lookup_reg) & (1ULL << 13)) in rvu_lookup_rsrc()
936 val = rvu_read64(rvu, block->addr, block->lookup_reg); in rvu_lookup_rsrc()
949 struct rvu_block *block; in rvu_detach_block() local
957 block = &hw->block[blkaddr]; in rvu_detach_block()
959 num_lfs = rvu_get_rsrc_mapcount(pfvf, block->type); in rvu_detach_block()
964 lf = rvu_lookup_rsrc(rvu, block, pcifunc, slot); in rvu_detach_block()
969 rvu_write64(rvu, blkaddr, block->lfcfg_reg | in rvu_detach_block()
970 (lf << block->lfshift), 0x00ULL); in rvu_detach_block()
973 rvu_update_rsrc_map(rvu, pfvf, block, in rvu_detach_block()
977 rvu_free_rsrc(&block->lf, lf); in rvu_detach_block()
980 rvu_clear_msix_offset(rvu, pfvf, block, lf); in rvu_detach_block()
989 struct rvu_block *block; in rvu_detach_rsrcs() local
998 /* Check for RVU block's LFs attached to this func, in rvu_detach_rsrcs()
1002 block = &hw->block[blkid]; in rvu_detach_rsrcs()
1003 if (!block->lf.bmap) in rvu_detach_rsrcs()
1019 rvu_detach_block(rvu, pcifunc, block->type); in rvu_detach_rsrcs()
1038 struct rvu_block *block; in rvu_attach_block() local
1050 block = &hw->block[blkaddr]; in rvu_attach_block()
1051 if (!block->lf.bmap) in rvu_attach_block()
1056 lf = rvu_alloc_rsrc(&block->lf); in rvu_attach_block()
1061 rvu_write64(rvu, blkaddr, block->lfcfg_reg | in rvu_attach_block()
1062 (lf << block->lfshift), cfg); in rvu_attach_block()
1063 rvu_update_rsrc_map(rvu, pfvf, block, in rvu_attach_block()
1067 rvu_set_msix_offset(rvu, pfvf, block, lf); in rvu_attach_block()
1076 struct rvu_block *block; in rvu_check_rsrc_availability() local
1081 block = &hw->block[BLKADDR_NPA]; in rvu_check_rsrc_availability()
1082 free_lfs = rvu_rsrc_free_count(&block->lf); in rvu_check_rsrc_availability()
1094 block = &hw->block[BLKADDR_NIX0]; in rvu_check_rsrc_availability()
1095 free_lfs = rvu_rsrc_free_count(&block->lf); in rvu_check_rsrc_availability()
1106 block = &hw->block[BLKADDR_SSO]; in rvu_check_rsrc_availability()
1108 if (req->sso > block->lf.max) { in rvu_check_rsrc_availability()
1111 pcifunc, req->sso, block->lf.max); in rvu_check_rsrc_availability()
1114 mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->type); in rvu_check_rsrc_availability()
1115 free_lfs = rvu_rsrc_free_count(&block->lf); in rvu_check_rsrc_availability()
1123 block = &hw->block[BLKADDR_SSOW]; in rvu_check_rsrc_availability()
1124 if (req->ssow > block->lf.max) { in rvu_check_rsrc_availability()
1127 pcifunc, req->sso, block->lf.max); in rvu_check_rsrc_availability()
1130 mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->type); in rvu_check_rsrc_availability()
1131 free_lfs = rvu_rsrc_free_count(&block->lf); in rvu_check_rsrc_availability()
1138 block = &hw->block[BLKADDR_TIM]; in rvu_check_rsrc_availability()
1139 if (req->timlfs > block->lf.max) { in rvu_check_rsrc_availability()
1142 pcifunc, req->timlfs, block->lf.max); in rvu_check_rsrc_availability()
1145 mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->type); in rvu_check_rsrc_availability()
1146 free_lfs = rvu_rsrc_free_count(&block->lf); in rvu_check_rsrc_availability()
1153 block = &hw->block[BLKADDR_CPT0]; in rvu_check_rsrc_availability()
1154 if (req->cptlfs > block->lf.max) { in rvu_check_rsrc_availability()
1157 pcifunc, req->cptlfs, block->lf.max); in rvu_check_rsrc_availability()
1160 mappedlfs = rvu_get_rsrc_mapcount(pfvf, block->type); in rvu_check_rsrc_availability()
1161 free_lfs = rvu_rsrc_free_count(&block->lf); in rvu_check_rsrc_availability()
1170 dev_info(rvu->dev, "Request for %s failed\n", block->name); in rvu_check_rsrc_availability()
1249 struct rvu_block *block, int lf) in rvu_set_msix_offset() argument
1254 cfg = rvu_read64(rvu, block->addr, block->msixcfg_reg | in rvu_set_msix_offset()
1255 (lf << block->lfshift)); in rvu_set_msix_offset()
1265 rvu_write64(rvu, block->addr, block->msixcfg_reg | in rvu_set_msix_offset()
1266 (lf << block->lfshift), (cfg & ~0x7FFULL) | offset); in rvu_set_msix_offset()
1270 pfvf->msix_lfmap[offset + vec] = MSIX_BLKLF(block->addr, lf); in rvu_set_msix_offset()
1274 struct rvu_block *block, int lf) in rvu_clear_msix_offset() argument
1279 cfg = rvu_read64(rvu, block->addr, block->msixcfg_reg | in rvu_clear_msix_offset()
1280 (lf << block->lfshift)); in rvu_clear_msix_offset()
1284 rvu_write64(rvu, block->addr, block->msixcfg_reg | in rvu_clear_msix_offset()
1285 (lf << block->lfshift), cfg & ~0x7FFULL); in rvu_clear_msix_offset()
1287 offset = rvu_get_msix_offset(rvu, pfvf, block->addr, lf); in rvu_clear_msix_offset()
1309 /* Set MSIX offsets for each block's LFs attached to this PF/VF */ in rvu_mbox_handler_msix_offset()
1310 lf = rvu_get_lf(rvu, &hw->block[BLKADDR_NPA], pcifunc, 0); in rvu_mbox_handler_msix_offset()
1313 lf = rvu_get_lf(rvu, &hw->block[BLKADDR_NIX0], pcifunc, 0); in rvu_mbox_handler_msix_offset()
1318 lf = rvu_get_lf(rvu, &hw->block[BLKADDR_SSO], pcifunc, slot); in rvu_mbox_handler_msix_offset()
1325 lf = rvu_get_lf(rvu, &hw->block[BLKADDR_SSOW], pcifunc, slot); in rvu_mbox_handler_msix_offset()
1332 lf = rvu_get_lf(rvu, &hw->block[BLKADDR_TIM], pcifunc, slot); in rvu_mbox_handler_msix_offset()
1339 lf = rvu_get_lf(rvu, &hw->block[BLKADDR_CPT0], pcifunc, slot); in rvu_mbox_handler_msix_offset()
1758 struct rvu_block *block; in rvu_blklf_teardown() local
1762 block = &rvu->hw->block[blkaddr]; in rvu_blklf_teardown()
1764 block->type); in rvu_blklf_teardown()
1768 lf = rvu_get_lf(rvu, block, pcifunc, slot); in rvu_blklf_teardown()
1773 if (block->addr == BLKADDR_NIX0) in rvu_blklf_teardown()
1774 rvu_nix_lf_teardown(rvu, pcifunc, block->addr, lf); in rvu_blklf_teardown()
1775 else if (block->addr == BLKADDR_NPA) in rvu_blklf_teardown()
1778 err = rvu_lf_reset(rvu, block, lf); in rvu_blklf_teardown()
1781 block->addr, lf); in rvu_blklf_teardown()
1789 /* Reset order should reflect inter-block dependencies: in __rvu_flr_handler()