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 device *dev = afu->dev; in start_context()
348 ctx->psn_phys = afu->gmmio_phys; in start_context()
351 ctx->psn_phys = afu->ppmmio_phys + (ctx->pe * ctx->psn_size); in start_context()
399 struct ocxl_hw_afu *afu = ctx->hw_afu; in ocxlflash_stop_context() local
400 struct ocxl_afu_config *acfg = &afu->acfg; in ocxlflash_stop_context()
401 struct pci_dev *pdev = afu->pdev; in ocxlflash_stop_context()
402 struct device *dev = afu->dev; in ocxlflash_stop_context()
423 rc = ocxl_link_remove_pe(afu->link_token, ctx->pe); in ocxlflash_stop_context()
469 struct ocxl_hw_afu *afu = afu_cookie; in ocxlflash_get_context() local
471 return afu->ocxl_ctx; in ocxlflash_get_context()
483 struct ocxl_hw_afu *afu = afu_cookie; in ocxlflash_dev_context_init() local
484 struct device *dev = afu->dev; in ocxlflash_dev_context_init()
496 rc = idr_alloc(&afu->idr, ctx, 0, afu->max_pasid, GFP_NOWAIT); in ocxlflash_dev_context_init()
511 ctx->hw_afu = afu; in ocxlflash_dev_context_init()
564 struct ocxl_hw_afu *afu = afu_cookie; in ocxlflash_perst_reloads_same_image() local
566 afu->perst_same_image = image; in ocxlflash_perst_reloads_same_image()
589 struct ocxl_hw_afu *afu = ctx->hw_afu; in free_afu_irqs() local
590 struct device *dev = afu->dev; in free_afu_irqs()
599 ocxl_link_free_irq(afu->link_token, ctx->irqs[i].hwirq); in free_afu_irqs()
614 struct ocxl_hw_afu *afu = ctx->hw_afu; in alloc_afu_irqs() local
615 struct device *dev = afu->dev; in alloc_afu_irqs()
641 rc = ocxl_link_irq_alloc(afu->link_token, &hwirq); in alloc_afu_irqs()
657 ocxl_link_free_irq(afu->link_token, irqs[i].hwirq); in alloc_afu_irqs()
687 static void ocxlflash_unconfig_afu(struct ocxl_hw_afu *afu) in ocxlflash_unconfig_afu() argument
689 if (afu->gmmio_virt) { in ocxlflash_unconfig_afu()
690 iounmap(afu->gmmio_virt); in ocxlflash_unconfig_afu()
691 afu->gmmio_virt = NULL; in ocxlflash_unconfig_afu()
701 struct ocxl_hw_afu *afu = afu_cookie; in ocxlflash_destroy_afu() local
704 if (!afu) in ocxlflash_destroy_afu()
707 ocxlflash_release_context(afu->ocxl_ctx); in ocxlflash_destroy_afu()
708 idr_destroy(&afu->idr); in ocxlflash_destroy_afu()
711 pos = afu->acfg.dvsec_afu_control_pos; in ocxlflash_destroy_afu()
712 ocxl_config_set_afu_state(afu->pdev, pos, 0); in ocxlflash_destroy_afu()
714 ocxlflash_unconfig_afu(afu); in ocxlflash_destroy_afu()
715 kfree(afu); in ocxlflash_destroy_afu()
725 static int ocxlflash_config_fn(struct pci_dev *pdev, struct ocxl_hw_afu *afu) in ocxlflash_config_fn() argument
727 struct ocxl_fn_config *fcfg = &afu->fcfg; in ocxlflash_config_fn()
742 afu->is_present = true; in ocxlflash_config_fn()
755 afu->fn_actag_base = base; in ocxlflash_config_fn()
756 afu->fn_actag_enabled = enabled; in ocxlflash_config_fn()
762 rc = ocxl_link_setup(pdev, 0, &afu->link_token); in ocxlflash_config_fn()
778 ocxl_link_release(pdev, afu->link_token); in ocxlflash_config_fn()
787 static void ocxlflash_unconfig_fn(struct pci_dev *pdev, struct ocxl_hw_afu *afu) in ocxlflash_unconfig_fn() argument
789 ocxl_link_release(pdev, afu->link_token); in ocxlflash_unconfig_fn()
798 static int ocxlflash_map_mmio(struct ocxl_hw_afu *afu) in ocxlflash_map_mmio() argument
800 struct ocxl_afu_config *acfg = &afu->acfg; in ocxlflash_map_mmio()
801 struct pci_dev *pdev = afu->pdev; in ocxlflash_map_mmio()
802 struct device *dev = afu->dev; in ocxlflash_map_mmio()
824 afu->gmmio_virt = ioremap(gmmio, acfg->global_mmio_size); in ocxlflash_map_mmio()
825 if (unlikely(!afu->gmmio_virt)) { in ocxlflash_map_mmio()
831 afu->gmmio_phys = gmmio; in ocxlflash_map_mmio()
832 afu->ppmmio_phys = ppmmio; in ocxlflash_map_mmio()
851 static int ocxlflash_config_afu(struct pci_dev *pdev, struct ocxl_hw_afu *afu) in ocxlflash_config_afu() argument
853 struct ocxl_afu_config *acfg = &afu->acfg; in ocxlflash_config_afu()
854 struct ocxl_fn_config *fcfg = &afu->fcfg; in ocxlflash_config_afu()
862 if (!afu->is_present) in ocxlflash_config_afu()
874 base = afu->fn_actag_base; in ocxlflash_config_afu()
875 count = min_t(int, acfg->actag_supported, afu->fn_actag_enabled); in ocxlflash_config_afu()
880 afu->afu_actag_base = base; in ocxlflash_config_afu()
881 afu->afu_actag_enabled = count; in ocxlflash_config_afu()
882 afu->max_pasid = 1 << acfg->pasid_supported_log; in ocxlflash_config_afu()
886 rc = ocxlflash_map_mmio(afu); in ocxlflash_config_afu()
909 struct ocxl_hw_afu *afu; in ocxlflash_create_afu() local
912 afu = kzalloc(sizeof(*afu), GFP_KERNEL); in ocxlflash_create_afu()
913 if (unlikely(!afu)) { in ocxlflash_create_afu()
918 afu->pdev = pdev; in ocxlflash_create_afu()
919 afu->dev = dev; in ocxlflash_create_afu()
920 idr_init(&afu->idr); in ocxlflash_create_afu()
922 rc = ocxlflash_config_fn(pdev, afu); in ocxlflash_create_afu()
929 rc = ocxlflash_config_afu(pdev, afu); in ocxlflash_create_afu()
936 ctx = ocxlflash_dev_context_init(pdev, afu); in ocxlflash_create_afu()
944 afu->ocxl_ctx = ctx; in ocxlflash_create_afu()
946 return afu; in ocxlflash_create_afu()
948 ocxlflash_unconfig_afu(afu); in ocxlflash_create_afu()
950 ocxlflash_unconfig_fn(pdev, afu); in ocxlflash_create_afu()
952 idr_destroy(&afu->idr); in ocxlflash_create_afu()
953 kfree(afu); in ocxlflash_create_afu()
954 afu = NULL; in ocxlflash_create_afu()
1307 struct ocxl_hw_afu *afu = ctx->hw_afu; in ocxlflash_start_work() local
1308 struct device *dev = afu->dev; in ocxlflash_start_work()