Lines Matching refs:afu

181 	struct ocxl_hw_afu *afu = ctx->hw_afu;  in afu_map_irq()  local
182 struct device *dev = afu->dev; in afu_map_irq()
253 struct ocxl_hw_afu *afu = ctx->hw_afu; in afu_unmap_irq() local
254 struct device *dev = afu->dev; in afu_unmap_irq()
329 struct ocxl_hw_afu *afu = ctx->hw_afu; in start_context() local
330 struct ocxl_afu_config *acfg = &afu->acfg; in start_context()
331 void *link_token = afu->link_token; in start_context()
332 struct pci_dev *pdev = afu->pdev; in start_context()
333 struct device *dev = afu->dev; in start_context()
349 ctx->psn_phys = afu->gmmio_phys; in start_context()
352 ctx->psn_phys = afu->ppmmio_phys + (ctx->pe * ctx->psn_size); in start_context()
401 struct ocxl_hw_afu *afu = ctx->hw_afu; in ocxlflash_stop_context() local
402 struct ocxl_afu_config *acfg = &afu->acfg; in ocxlflash_stop_context()
403 struct pci_dev *pdev = afu->pdev; in ocxlflash_stop_context()
404 struct device *dev = afu->dev; in ocxlflash_stop_context()
425 rc = ocxl_link_remove_pe(afu->link_token, ctx->pe); in ocxlflash_stop_context()
471 struct ocxl_hw_afu *afu = afu_cookie; in ocxlflash_get_context() local
473 return afu->ocxl_ctx; in ocxlflash_get_context()
485 struct ocxl_hw_afu *afu = afu_cookie; in ocxlflash_dev_context_init() local
486 struct device *dev = afu->dev; in ocxlflash_dev_context_init()
498 rc = idr_alloc(&afu->idr, ctx, 0, afu->max_pasid, GFP_NOWAIT); in ocxlflash_dev_context_init()
513 ctx->hw_afu = afu; in ocxlflash_dev_context_init()
566 struct ocxl_hw_afu *afu = afu_cookie; in ocxlflash_perst_reloads_same_image() local
568 afu->perst_same_image = image; in ocxlflash_perst_reloads_same_image()
591 struct ocxl_hw_afu *afu = ctx->hw_afu; in free_afu_irqs() local
592 struct device *dev = afu->dev; in free_afu_irqs()
601 ocxl_link_free_irq(afu->link_token, ctx->irqs[i].hwirq); in free_afu_irqs()
616 struct ocxl_hw_afu *afu = ctx->hw_afu; in alloc_afu_irqs() local
617 struct device *dev = afu->dev; in alloc_afu_irqs()
643 rc = ocxl_link_irq_alloc(afu->link_token, &hwirq); in alloc_afu_irqs()
659 ocxl_link_free_irq(afu->link_token, irqs[i].hwirq); in alloc_afu_irqs()
689 static void ocxlflash_unconfig_afu(struct ocxl_hw_afu *afu) in ocxlflash_unconfig_afu() argument
691 if (afu->gmmio_virt) { in ocxlflash_unconfig_afu()
692 iounmap(afu->gmmio_virt); in ocxlflash_unconfig_afu()
693 afu->gmmio_virt = NULL; in ocxlflash_unconfig_afu()
703 struct ocxl_hw_afu *afu = afu_cookie; in ocxlflash_destroy_afu() local
706 if (!afu) in ocxlflash_destroy_afu()
709 ocxlflash_release_context(afu->ocxl_ctx); in ocxlflash_destroy_afu()
710 idr_destroy(&afu->idr); in ocxlflash_destroy_afu()
713 pos = afu->acfg.dvsec_afu_control_pos; in ocxlflash_destroy_afu()
714 ocxl_config_set_afu_state(afu->pdev, pos, 0); in ocxlflash_destroy_afu()
716 ocxlflash_unconfig_afu(afu); in ocxlflash_destroy_afu()
717 kfree(afu); in ocxlflash_destroy_afu()
727 static int ocxlflash_config_fn(struct pci_dev *pdev, struct ocxl_hw_afu *afu) in ocxlflash_config_fn() argument
729 struct ocxl_fn_config *fcfg = &afu->fcfg; in ocxlflash_config_fn()
744 afu->is_present = true; in ocxlflash_config_fn()
757 afu->fn_actag_base = base; in ocxlflash_config_fn()
758 afu->fn_actag_enabled = enabled; in ocxlflash_config_fn()
764 rc = ocxl_link_setup(pdev, 0, &afu->link_token); in ocxlflash_config_fn()
780 ocxl_link_release(pdev, afu->link_token); in ocxlflash_config_fn()
789 static void ocxlflash_unconfig_fn(struct pci_dev *pdev, struct ocxl_hw_afu *afu) in ocxlflash_unconfig_fn() argument
791 ocxl_link_release(pdev, afu->link_token); in ocxlflash_unconfig_fn()
800 static int ocxlflash_map_mmio(struct ocxl_hw_afu *afu) in ocxlflash_map_mmio() argument
802 struct ocxl_afu_config *acfg = &afu->acfg; in ocxlflash_map_mmio()
803 struct pci_dev *pdev = afu->pdev; in ocxlflash_map_mmio()
804 struct device *dev = afu->dev; in ocxlflash_map_mmio()
826 afu->gmmio_virt = ioremap(gmmio, acfg->global_mmio_size); in ocxlflash_map_mmio()
827 if (unlikely(!afu->gmmio_virt)) { in ocxlflash_map_mmio()
833 afu->gmmio_phys = gmmio; in ocxlflash_map_mmio()
834 afu->ppmmio_phys = ppmmio; in ocxlflash_map_mmio()
853 static int ocxlflash_config_afu(struct pci_dev *pdev, struct ocxl_hw_afu *afu) in ocxlflash_config_afu() argument
855 struct ocxl_afu_config *acfg = &afu->acfg; in ocxlflash_config_afu()
856 struct ocxl_fn_config *fcfg = &afu->fcfg; in ocxlflash_config_afu()
864 if (!afu->is_present) in ocxlflash_config_afu()
876 base = afu->fn_actag_base; in ocxlflash_config_afu()
877 count = min_t(int, acfg->actag_supported, afu->fn_actag_enabled); in ocxlflash_config_afu()
882 afu->afu_actag_base = base; in ocxlflash_config_afu()
883 afu->afu_actag_enabled = count; in ocxlflash_config_afu()
884 afu->max_pasid = 1 << acfg->pasid_supported_log; in ocxlflash_config_afu()
888 rc = ocxlflash_map_mmio(afu); in ocxlflash_config_afu()
911 struct ocxl_hw_afu *afu; in ocxlflash_create_afu() local
914 afu = kzalloc(sizeof(*afu), GFP_KERNEL); in ocxlflash_create_afu()
915 if (unlikely(!afu)) { in ocxlflash_create_afu()
920 afu->pdev = pdev; in ocxlflash_create_afu()
921 afu->dev = dev; in ocxlflash_create_afu()
922 idr_init(&afu->idr); in ocxlflash_create_afu()
924 rc = ocxlflash_config_fn(pdev, afu); in ocxlflash_create_afu()
931 rc = ocxlflash_config_afu(pdev, afu); in ocxlflash_create_afu()
938 ctx = ocxlflash_dev_context_init(pdev, afu); in ocxlflash_create_afu()
946 afu->ocxl_ctx = ctx; in ocxlflash_create_afu()
948 return afu; in ocxlflash_create_afu()
950 ocxlflash_unconfig_afu(afu); in ocxlflash_create_afu()
952 ocxlflash_unconfig_fn(pdev, afu); in ocxlflash_create_afu()
954 idr_destroy(&afu->idr); in ocxlflash_create_afu()
955 kfree(afu); in ocxlflash_create_afu()
956 afu = NULL; in ocxlflash_create_afu()
1309 struct ocxl_hw_afu *afu = ctx->hw_afu; in ocxlflash_start_work() local
1310 struct device *dev = afu->dev; in ocxlflash_start_work()