init.c (cd60cd96137f6cb3ea82cace9225626619e7a52d) | init.c (dd4645ebb7d100bb04ba38ec58b499cbe95322fa) |
---|---|
1/* 2 * Intel I/OAT DMA Linux driver 3 * Copyright(c) 2004 - 2015 Intel Corporation. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms and conditions of the GNU General Public License, 7 * version 2, as published by the Free Software Foundation. 8 * --- 14 unchanged lines hidden (view full) --- 23#include <linux/interrupt.h> 24#include <linux/dmaengine.h> 25#include <linux/delay.h> 26#include <linux/dma-mapping.h> 27#include <linux/workqueue.h> 28#include <linux/prefetch.h> 29#include <linux/dca.h> 30#include <linux/aer.h> | 1/* 2 * Intel I/OAT DMA Linux driver 3 * Copyright(c) 2004 - 2015 Intel Corporation. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms and conditions of the GNU General Public License, 7 * version 2, as published by the Free Software Foundation. 8 * --- 14 unchanged lines hidden (view full) --- 23#include <linux/interrupt.h> 24#include <linux/dmaengine.h> 25#include <linux/delay.h> 26#include <linux/dma-mapping.h> 27#include <linux/workqueue.h> 28#include <linux/prefetch.h> 29#include <linux/dca.h> 30#include <linux/aer.h> |
31#include <linux/sizes.h> |
|
31#include "dma.h" 32#include "registers.h" 33#include "hw.h" 34 35#include "../dmaengine.h" 36 37MODULE_VERSION(IOAT_DMA_VERSION); 38MODULE_LICENSE("Dual BSD/GPL"); --- 452 unchanged lines hidden (view full) --- 491 492static int ioat_probe(struct ioatdma_device *ioat_dma) 493{ 494 int err = -ENODEV; 495 struct dma_device *dma = &ioat_dma->dma_dev; 496 struct pci_dev *pdev = ioat_dma->pdev; 497 struct device *dev = &pdev->dev; 498 | 32#include "dma.h" 33#include "registers.h" 34#include "hw.h" 35 36#include "../dmaengine.h" 37 38MODULE_VERSION(IOAT_DMA_VERSION); 39MODULE_LICENSE("Dual BSD/GPL"); --- 452 unchanged lines hidden (view full) --- 492 493static int ioat_probe(struct ioatdma_device *ioat_dma) 494{ 495 int err = -ENODEV; 496 struct dma_device *dma = &ioat_dma->dma_dev; 497 struct pci_dev *pdev = ioat_dma->pdev; 498 struct device *dev = &pdev->dev; 499 |
499 /* DMA coherent memory pool for DMA descriptor allocations */ 500 ioat_dma->dma_pool = dma_pool_create("dma_desc_pool", dev, 501 sizeof(struct ioat_dma_descriptor), 502 64, 0); 503 if (!ioat_dma->dma_pool) { 504 err = -ENOMEM; 505 goto err_dma_pool; 506 } 507 | |
508 ioat_dma->completion_pool = dma_pool_create("completion_pool", dev, 509 sizeof(u64), 510 SMP_CACHE_BYTES, 511 SMP_CACHE_BYTES); 512 513 if (!ioat_dma->completion_pool) { 514 err = -ENOMEM; | 500 ioat_dma->completion_pool = dma_pool_create("completion_pool", dev, 501 sizeof(u64), 502 SMP_CACHE_BYTES, 503 SMP_CACHE_BYTES); 504 505 if (!ioat_dma->completion_pool) { 506 err = -ENOMEM; |
515 goto err_completion_pool; | 507 goto err_out; |
516 } 517 518 ioat_enumerate_channels(ioat_dma); 519 520 dma_cap_set(DMA_MEMCPY, dma->cap_mask); 521 dma->dev = &pdev->dev; 522 523 if (!dma->chancnt) { --- 10 unchanged lines hidden (view full) --- 534 goto err_self_test; 535 536 return 0; 537 538err_self_test: 539 ioat_disable_interrupts(ioat_dma); 540err_setup_interrupts: 541 dma_pool_destroy(ioat_dma->completion_pool); | 508 } 509 510 ioat_enumerate_channels(ioat_dma); 511 512 dma_cap_set(DMA_MEMCPY, dma->cap_mask); 513 dma->dev = &pdev->dev; 514 515 if (!dma->chancnt) { --- 10 unchanged lines hidden (view full) --- 526 goto err_self_test; 527 528 return 0; 529 530err_self_test: 531 ioat_disable_interrupts(ioat_dma); 532err_setup_interrupts: 533 dma_pool_destroy(ioat_dma->completion_pool); |
542err_completion_pool: 543 dma_pool_destroy(ioat_dma->dma_pool); 544err_dma_pool: | 534err_out: |
545 return err; 546} 547 548static int ioat_register(struct ioatdma_device *ioat_dma) 549{ 550 int err = dma_async_device_register(&ioat_dma->dma_dev); 551 552 if (err) { 553 ioat_disable_interrupts(ioat_dma); 554 dma_pool_destroy(ioat_dma->completion_pool); | 535 return err; 536} 537 538static int ioat_register(struct ioatdma_device *ioat_dma) 539{ 540 int err = dma_async_device_register(&ioat_dma->dma_dev); 541 542 if (err) { 543 ioat_disable_interrupts(ioat_dma); 544 dma_pool_destroy(ioat_dma->completion_pool); |
555 dma_pool_destroy(ioat_dma->dma_pool); | |
556 } 557 558 return err; 559} 560 561static void ioat_dma_remove(struct ioatdma_device *ioat_dma) 562{ 563 struct dma_device *dma = &ioat_dma->dma_dev; 564 565 ioat_disable_interrupts(ioat_dma); 566 567 ioat_kobject_del(ioat_dma); 568 569 dma_async_device_unregister(dma); 570 | 545 } 546 547 return err; 548} 549 550static void ioat_dma_remove(struct ioatdma_device *ioat_dma) 551{ 552 struct dma_device *dma = &ioat_dma->dma_dev; 553 554 ioat_disable_interrupts(ioat_dma); 555 556 ioat_kobject_del(ioat_dma); 557 558 dma_async_device_unregister(dma); 559 |
571 dma_pool_destroy(ioat_dma->dma_pool); | |
572 dma_pool_destroy(ioat_dma->completion_pool); 573 574 INIT_LIST_HEAD(&dma->channels); 575} 576 577/** 578 * ioat_enumerate_channels - find and initialize the device's channels 579 * @ioat_dma: the ioat dma device to be enumerated --- 73 unchanged lines hidden (view full) --- 653 total_descs - descs); 654 655 for (i = 0; i < total_descs - descs; i++) { 656 desc = ioat_get_ring_ent(ioat_chan, ioat_chan->tail + i); 657 dump_desc_dbg(ioat_chan, desc); 658 ioat_free_ring_ent(desc, c); 659 } 660 | 560 dma_pool_destroy(ioat_dma->completion_pool); 561 562 INIT_LIST_HEAD(&dma->channels); 563} 564 565/** 566 * ioat_enumerate_channels - find and initialize the device's channels 567 * @ioat_dma: the ioat dma device to be enumerated --- 73 unchanged lines hidden (view full) --- 641 total_descs - descs); 642 643 for (i = 0; i < total_descs - descs; i++) { 644 desc = ioat_get_ring_ent(ioat_chan, ioat_chan->tail + i); 645 dump_desc_dbg(ioat_chan, desc); 646 ioat_free_ring_ent(desc, c); 647 } 648 |
649 for (i = 0; i < ioat_chan->desc_chunks; i++) { 650 dma_free_coherent(to_dev(ioat_chan), SZ_2M, 651 ioat_chan->descs[i].virt, 652 ioat_chan->descs[i].hw); 653 ioat_chan->descs[i].virt = NULL; 654 ioat_chan->descs[i].hw = 0; 655 } 656 ioat_chan->desc_chunks = 0; 657 |
|
661 kfree(ioat_chan->ring); 662 ioat_chan->ring = NULL; 663 ioat_chan->alloc_order = 0; 664 dma_pool_free(ioat_dma->completion_pool, ioat_chan->completion, 665 ioat_chan->completion_dma); 666 spin_unlock_bh(&ioat_chan->prep_lock); 667 spin_unlock_bh(&ioat_chan->cleanup_lock); 668 --- 748 unchanged lines hidden --- | 658 kfree(ioat_chan->ring); 659 ioat_chan->ring = NULL; 660 ioat_chan->alloc_order = 0; 661 dma_pool_free(ioat_dma->completion_pool, ioat_chan->completion, 662 ioat_chan->completion_dma); 663 spin_unlock_bh(&ioat_chan->prep_lock); 664 spin_unlock_bh(&ioat_chan->cleanup_lock); 665 --- 748 unchanged lines hidden --- |