Lines Matching refs:ioat_chan

121 		  struct ioatdma_chan *ioat_chan, int idx);
405 struct ioatdma_chan *ioat_chan; in ioat_dma_setup_interrupts() local
434 ioat_chan = ioat_chan_by_index(ioat_dma, i); in ioat_dma_setup_interrupts()
437 "ioat-msix", ioat_chan); in ioat_dma_setup_interrupts()
441 ioat_chan = ioat_chan_by_index(ioat_dma, j); in ioat_dma_setup_interrupts()
442 devm_free_irq(dev, msix->vector, ioat_chan); in ioat_dma_setup_interrupts()
555 struct ioatdma_chan *ioat_chan; in ioat_enumerate_channels() local
577 ioat_chan = kzalloc(sizeof(*ioat_chan), GFP_KERNEL); in ioat_enumerate_channels()
578 if (!ioat_chan) in ioat_enumerate_channels()
581 ioat_init_channel(ioat_dma, ioat_chan, i); in ioat_enumerate_channels()
582 ioat_chan->xfercap_log = xfercap_log; in ioat_enumerate_channels()
583 spin_lock_init(&ioat_chan->prep_lock); in ioat_enumerate_channels()
584 if (ioat_reset_hw(ioat_chan)) { in ioat_enumerate_channels()
598 struct ioatdma_chan *ioat_chan = to_ioat_chan(c); in ioat_free_chan_resources() local
599 struct ioatdma_device *ioat_dma = ioat_chan->ioat_dma; in ioat_free_chan_resources()
601 const int total_descs = 1 << ioat_chan->alloc_order; in ioat_free_chan_resources()
608 if (!ioat_chan->ring) in ioat_free_chan_resources()
611 ioat_stop(ioat_chan); in ioat_free_chan_resources()
613 if (!test_bit(IOAT_CHAN_DOWN, &ioat_chan->state)) { in ioat_free_chan_resources()
614 ioat_reset_hw(ioat_chan); in ioat_free_chan_resources()
619 ioat_chan->reg_base + in ioat_free_chan_resources()
623 spin_lock_bh(&ioat_chan->cleanup_lock); in ioat_free_chan_resources()
624 spin_lock_bh(&ioat_chan->prep_lock); in ioat_free_chan_resources()
625 descs = ioat_ring_space(ioat_chan); in ioat_free_chan_resources()
626 dev_dbg(to_dev(ioat_chan), "freeing %d idle descriptors\n", descs); in ioat_free_chan_resources()
628 desc = ioat_get_ring_ent(ioat_chan, ioat_chan->head + i); in ioat_free_chan_resources()
633 dev_err(to_dev(ioat_chan), "Freeing %d in use descriptors!\n", in ioat_free_chan_resources()
637 desc = ioat_get_ring_ent(ioat_chan, ioat_chan->tail + i); in ioat_free_chan_resources()
638 dump_desc_dbg(ioat_chan, desc); in ioat_free_chan_resources()
642 for (i = 0; i < ioat_chan->desc_chunks; i++) { in ioat_free_chan_resources()
643 dma_free_coherent(to_dev(ioat_chan), IOAT_CHUNK_SIZE, in ioat_free_chan_resources()
644 ioat_chan->descs[i].virt, in ioat_free_chan_resources()
645 ioat_chan->descs[i].hw); in ioat_free_chan_resources()
646 ioat_chan->descs[i].virt = NULL; in ioat_free_chan_resources()
647 ioat_chan->descs[i].hw = 0; in ioat_free_chan_resources()
649 ioat_chan->desc_chunks = 0; in ioat_free_chan_resources()
651 kfree(ioat_chan->ring); in ioat_free_chan_resources()
652 ioat_chan->ring = NULL; in ioat_free_chan_resources()
653 ioat_chan->alloc_order = 0; in ioat_free_chan_resources()
654 dma_pool_free(ioat_dma->completion_pool, ioat_chan->completion, in ioat_free_chan_resources()
655 ioat_chan->completion_dma); in ioat_free_chan_resources()
656 spin_unlock_bh(&ioat_chan->prep_lock); in ioat_free_chan_resources()
657 spin_unlock_bh(&ioat_chan->cleanup_lock); in ioat_free_chan_resources()
659 ioat_chan->last_completion = 0; in ioat_free_chan_resources()
660 ioat_chan->completion_dma = 0; in ioat_free_chan_resources()
661 ioat_chan->dmacount = 0; in ioat_free_chan_resources()
669 struct ioatdma_chan *ioat_chan = to_ioat_chan(c); in ioat_alloc_chan_resources() local
677 if (ioat_chan->ring) in ioat_alloc_chan_resources()
678 return 1 << ioat_chan->alloc_order; in ioat_alloc_chan_resources()
681 writew(IOAT_CHANCTRL_RUN, ioat_chan->reg_base + IOAT_CHANCTRL_OFFSET); in ioat_alloc_chan_resources()
685 ioat_chan->completion = in ioat_alloc_chan_resources()
686 dma_pool_zalloc(ioat_chan->ioat_dma->completion_pool, in ioat_alloc_chan_resources()
687 GFP_NOWAIT, &ioat_chan->completion_dma); in ioat_alloc_chan_resources()
688 if (!ioat_chan->completion) in ioat_alloc_chan_resources()
691 writel(((u64)ioat_chan->completion_dma) & 0x00000000FFFFFFFF, in ioat_alloc_chan_resources()
692 ioat_chan->reg_base + IOAT_CHANCMP_OFFSET_LOW); in ioat_alloc_chan_resources()
693 writel(((u64)ioat_chan->completion_dma) >> 32, in ioat_alloc_chan_resources()
694 ioat_chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); in ioat_alloc_chan_resources()
701 spin_lock_bh(&ioat_chan->cleanup_lock); in ioat_alloc_chan_resources()
702 spin_lock_bh(&ioat_chan->prep_lock); in ioat_alloc_chan_resources()
703 ioat_chan->ring = ring; in ioat_alloc_chan_resources()
704 ioat_chan->head = 0; in ioat_alloc_chan_resources()
705 ioat_chan->issued = 0; in ioat_alloc_chan_resources()
706 ioat_chan->tail = 0; in ioat_alloc_chan_resources()
707 ioat_chan->alloc_order = order; in ioat_alloc_chan_resources()
708 set_bit(IOAT_RUN, &ioat_chan->state); in ioat_alloc_chan_resources()
709 spin_unlock_bh(&ioat_chan->prep_lock); in ioat_alloc_chan_resources()
710 spin_unlock_bh(&ioat_chan->cleanup_lock); in ioat_alloc_chan_resources()
713 if (ioat_chan->ioat_dma->version >= IOAT_VER_3_4) { in ioat_alloc_chan_resources()
719 writel(lat_val, ioat_chan->reg_base + in ioat_alloc_chan_resources()
725 writel(lat_val, ioat_chan->reg_base + in ioat_alloc_chan_resources()
730 ioat_chan->reg_base + in ioat_alloc_chan_resources()
734 ioat_start_null_desc(ioat_chan); in ioat_alloc_chan_resources()
739 status = ioat_chansts(ioat_chan); in ioat_alloc_chan_resources()
743 return 1 << ioat_chan->alloc_order; in ioat_alloc_chan_resources()
745 chanerr = readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET); in ioat_alloc_chan_resources()
747 dev_WARN(to_dev(ioat_chan), in ioat_alloc_chan_resources()
756 struct ioatdma_chan *ioat_chan, int idx) in ioat_init_channel() argument
760 ioat_chan->ioat_dma = ioat_dma; in ioat_init_channel()
761 ioat_chan->reg_base = ioat_dma->reg_base + (0x80 * (idx + 1)); in ioat_init_channel()
762 spin_lock_init(&ioat_chan->cleanup_lock); in ioat_init_channel()
763 ioat_chan->dma_chan.device = dma; in ioat_init_channel()
764 dma_cookie_init(&ioat_chan->dma_chan); in ioat_init_channel()
765 list_add_tail(&ioat_chan->dma_chan.device_node, &dma->channels); in ioat_init_channel()
766 ioat_dma->idx[idx] = ioat_chan; in ioat_init_channel()
767 timer_setup(&ioat_chan->timer, ioat_timer_event, 0); in ioat_init_channel()
768 tasklet_setup(&ioat_chan->cleanup_task, ioat_cleanup_event); in ioat_init_channel()
1054 struct ioatdma_chan *ioat_chan; in ioat_intr_quirk() local
1065 ioat_chan = to_ioat_chan(c); in ioat_intr_quirk()
1066 errmask = readl(ioat_chan->reg_base + in ioat_intr_quirk()
1070 writel(errmask, ioat_chan->reg_base + in ioat_intr_quirk()
1082 struct ioatdma_chan *ioat_chan; in ioat3_dma_probe() local
1168 ioat_chan = to_ioat_chan(c); in ioat3_dma_probe()
1170 ioat_chan->reg_base + IOAT_DCACTRL_OFFSET); in ioat3_dma_probe()
1212 struct ioatdma_chan *ioat_chan; in ioat_shutdown() local
1219 ioat_chan = ioat_dma->idx[i]; in ioat_shutdown()
1220 if (!ioat_chan) in ioat_shutdown()
1223 spin_lock_bh(&ioat_chan->prep_lock); in ioat_shutdown()
1224 set_bit(IOAT_CHAN_DOWN, &ioat_chan->state); in ioat_shutdown()
1225 spin_unlock_bh(&ioat_chan->prep_lock); in ioat_shutdown()
1232 timer_delete_sync(&ioat_chan->timer); in ioat_shutdown()
1235 ioat_reset_hw(ioat_chan); in ioat_shutdown()
1243 struct ioatdma_chan *ioat_chan; in ioat_resume() local
1248 ioat_chan = ioat_dma->idx[i]; in ioat_resume()
1249 if (!ioat_chan) in ioat_resume()
1252 spin_lock_bh(&ioat_chan->prep_lock); in ioat_resume()
1253 clear_bit(IOAT_CHAN_DOWN, &ioat_chan->state); in ioat_resume()
1254 spin_unlock_bh(&ioat_chan->prep_lock); in ioat_resume()
1256 chanerr = readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET); in ioat_resume()
1257 writel(chanerr, ioat_chan->reg_base + IOAT_CHANERR_OFFSET); in ioat_resume()