diff options
Diffstat (limited to 'drivers/dma/ioat/dma.c')
-rw-r--r-- | drivers/dma/ioat/dma.c | 53 |
1 files changed, 8 insertions, 45 deletions
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 5ff6fc1819dc..1a49c777607c 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c | |||
@@ -531,21 +531,6 @@ static void ioat1_cleanup_event(unsigned long data) | |||
531 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); | 531 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); |
532 | } | 532 | } |
533 | 533 | ||
534 | void ioat_dma_unmap(struct ioat_chan_common *chan, enum dma_ctrl_flags flags, | ||
535 | size_t len, struct ioat_dma_descriptor *hw) | ||
536 | { | ||
537 | struct pci_dev *pdev = chan->device->pdev; | ||
538 | size_t offset = len - hw->size; | ||
539 | |||
540 | if (!(flags & DMA_COMPL_SKIP_DEST_UNMAP)) | ||
541 | ioat_unmap(pdev, hw->dst_addr - offset, len, | ||
542 | PCI_DMA_FROMDEVICE, flags, 1); | ||
543 | |||
544 | if (!(flags & DMA_COMPL_SKIP_SRC_UNMAP)) | ||
545 | ioat_unmap(pdev, hw->src_addr - offset, len, | ||
546 | PCI_DMA_TODEVICE, flags, 0); | ||
547 | } | ||
548 | |||
549 | dma_addr_t ioat_get_current_completion(struct ioat_chan_common *chan) | 534 | dma_addr_t ioat_get_current_completion(struct ioat_chan_common *chan) |
550 | { | 535 | { |
551 | dma_addr_t phys_complete; | 536 | dma_addr_t phys_complete; |
@@ -602,7 +587,7 @@ static void __cleanup(struct ioat_dma_chan *ioat, dma_addr_t phys_complete) | |||
602 | dump_desc_dbg(ioat, desc); | 587 | dump_desc_dbg(ioat, desc); |
603 | if (tx->cookie) { | 588 | if (tx->cookie) { |
604 | dma_cookie_complete(tx); | 589 | dma_cookie_complete(tx); |
605 | ioat_dma_unmap(chan, tx->flags, desc->len, desc->hw); | 590 | dma_descriptor_unmap(tx); |
606 | ioat->active -= desc->hw->tx_cnt; | 591 | ioat->active -= desc->hw->tx_cnt; |
607 | if (tx->callback) { | 592 | if (tx->callback) { |
608 | tx->callback(tx->callback_param); | 593 | tx->callback(tx->callback_param); |
@@ -733,7 +718,7 @@ ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, | |||
733 | enum dma_status ret; | 718 | enum dma_status ret; |
734 | 719 | ||
735 | ret = dma_cookie_status(c, cookie, txstate); | 720 | ret = dma_cookie_status(c, cookie, txstate); |
736 | if (ret == DMA_SUCCESS) | 721 | if (ret == DMA_COMPLETE) |
737 | return ret; | 722 | return ret; |
738 | 723 | ||
739 | device->cleanup_fn((unsigned long) c); | 724 | device->cleanup_fn((unsigned long) c); |
@@ -833,8 +818,7 @@ int ioat_dma_self_test(struct ioatdma_device *device) | |||
833 | 818 | ||
834 | dma_src = dma_map_single(dev, src, IOAT_TEST_SIZE, DMA_TO_DEVICE); | 819 | dma_src = dma_map_single(dev, src, IOAT_TEST_SIZE, DMA_TO_DEVICE); |
835 | dma_dest = dma_map_single(dev, dest, IOAT_TEST_SIZE, DMA_FROM_DEVICE); | 820 | dma_dest = dma_map_single(dev, dest, IOAT_TEST_SIZE, DMA_FROM_DEVICE); |
836 | flags = DMA_COMPL_SKIP_SRC_UNMAP | DMA_COMPL_SKIP_DEST_UNMAP | | 821 | flags = DMA_PREP_INTERRUPT; |
837 | DMA_PREP_INTERRUPT; | ||
838 | tx = device->common.device_prep_dma_memcpy(dma_chan, dma_dest, dma_src, | 822 | tx = device->common.device_prep_dma_memcpy(dma_chan, dma_dest, dma_src, |
839 | IOAT_TEST_SIZE, flags); | 823 | IOAT_TEST_SIZE, flags); |
840 | if (!tx) { | 824 | if (!tx) { |
@@ -859,7 +843,7 @@ int ioat_dma_self_test(struct ioatdma_device *device) | |||
859 | 843 | ||
860 | if (tmo == 0 || | 844 | if (tmo == 0 || |
861 | dma->device_tx_status(dma_chan, cookie, NULL) | 845 | dma->device_tx_status(dma_chan, cookie, NULL) |
862 | != DMA_SUCCESS) { | 846 | != DMA_COMPLETE) { |
863 | dev_err(dev, "Self-test copy timed out, disabling\n"); | 847 | dev_err(dev, "Self-test copy timed out, disabling\n"); |
864 | err = -ENODEV; | 848 | err = -ENODEV; |
865 | goto unmap_dma; | 849 | goto unmap_dma; |
@@ -885,8 +869,7 @@ static char ioat_interrupt_style[32] = "msix"; | |||
885 | module_param_string(ioat_interrupt_style, ioat_interrupt_style, | 869 | module_param_string(ioat_interrupt_style, ioat_interrupt_style, |
886 | sizeof(ioat_interrupt_style), 0644); | 870 | sizeof(ioat_interrupt_style), 0644); |
887 | MODULE_PARM_DESC(ioat_interrupt_style, | 871 | MODULE_PARM_DESC(ioat_interrupt_style, |
888 | "set ioat interrupt style: msix (default), " | 872 | "set ioat interrupt style: msix (default), msi, intx"); |
889 | "msix-single-vector, msi, intx)"); | ||
890 | 873 | ||
891 | /** | 874 | /** |
892 | * ioat_dma_setup_interrupts - setup interrupt handler | 875 | * ioat_dma_setup_interrupts - setup interrupt handler |
@@ -904,8 +887,6 @@ int ioat_dma_setup_interrupts(struct ioatdma_device *device) | |||
904 | 887 | ||
905 | if (!strcmp(ioat_interrupt_style, "msix")) | 888 | if (!strcmp(ioat_interrupt_style, "msix")) |
906 | goto msix; | 889 | goto msix; |
907 | if (!strcmp(ioat_interrupt_style, "msix-single-vector")) | ||
908 | goto msix_single_vector; | ||
909 | if (!strcmp(ioat_interrupt_style, "msi")) | 890 | if (!strcmp(ioat_interrupt_style, "msi")) |
910 | goto msi; | 891 | goto msi; |
911 | if (!strcmp(ioat_interrupt_style, "intx")) | 892 | if (!strcmp(ioat_interrupt_style, "intx")) |
@@ -920,10 +901,8 @@ msix: | |||
920 | device->msix_entries[i].entry = i; | 901 | device->msix_entries[i].entry = i; |
921 | 902 | ||
922 | err = pci_enable_msix(pdev, device->msix_entries, msixcnt); | 903 | err = pci_enable_msix(pdev, device->msix_entries, msixcnt); |
923 | if (err < 0) | 904 | if (err) |
924 | goto msi; | 905 | goto msi; |
925 | if (err > 0) | ||
926 | goto msix_single_vector; | ||
927 | 906 | ||
928 | for (i = 0; i < msixcnt; i++) { | 907 | for (i = 0; i < msixcnt; i++) { |
929 | msix = &device->msix_entries[i]; | 908 | msix = &device->msix_entries[i]; |
@@ -937,29 +916,13 @@ msix: | |||
937 | chan = ioat_chan_by_index(device, j); | 916 | chan = ioat_chan_by_index(device, j); |
938 | devm_free_irq(dev, msix->vector, chan); | 917 | devm_free_irq(dev, msix->vector, chan); |
939 | } | 918 | } |
940 | goto msix_single_vector; | 919 | goto msi; |
941 | } | 920 | } |
942 | } | 921 | } |
943 | intrctrl |= IOAT_INTRCTRL_MSIX_VECTOR_CONTROL; | 922 | intrctrl |= IOAT_INTRCTRL_MSIX_VECTOR_CONTROL; |
944 | device->irq_mode = IOAT_MSIX; | 923 | device->irq_mode = IOAT_MSIX; |
945 | goto done; | 924 | goto done; |
946 | 925 | ||
947 | msix_single_vector: | ||
948 | msix = &device->msix_entries[0]; | ||
949 | msix->entry = 0; | ||
950 | err = pci_enable_msix(pdev, device->msix_entries, 1); | ||
951 | if (err) | ||
952 | goto msi; | ||
953 | |||
954 | err = devm_request_irq(dev, msix->vector, ioat_dma_do_interrupt, 0, | ||
955 | "ioat-msix", device); | ||
956 | if (err) { | ||
957 | pci_disable_msix(pdev); | ||
958 | goto msi; | ||
959 | } | ||
960 | device->irq_mode = IOAT_MSIX_SINGLE; | ||
961 | goto done; | ||
962 | |||
963 | msi: | 926 | msi: |
964 | err = pci_enable_msi(pdev); | 927 | err = pci_enable_msi(pdev); |
965 | if (err) | 928 | if (err) |
@@ -971,7 +934,7 @@ msi: | |||
971 | pci_disable_msi(pdev); | 934 | pci_disable_msi(pdev); |
972 | goto intx; | 935 | goto intx; |
973 | } | 936 | } |
974 | device->irq_mode = IOAT_MSIX; | 937 | device->irq_mode = IOAT_MSI; |
975 | goto done; | 938 | goto done; |
976 | 939 | ||
977 | intx: | 940 | intx: |