diff options
Diffstat (limited to 'drivers/dma/ioat/dma_v3.c')
-rw-r--r-- | drivers/dma/ioat/dma_v3.c | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index 0284908997f8..f8170de1d6a4 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c | |||
@@ -67,6 +67,8 @@ | |||
67 | #include "dma.h" | 67 | #include "dma.h" |
68 | #include "dma_v2.h" | 68 | #include "dma_v2.h" |
69 | 69 | ||
70 | extern struct kmem_cache *ioat3_sed_cache; | ||
71 | |||
70 | /* ioat hardware assumes at least two sources for raid operations */ | 72 | /* ioat hardware assumes at least two sources for raid operations */ |
71 | #define src_cnt_to_sw(x) ((x) + 2) | 73 | #define src_cnt_to_sw(x) ((x) + 2) |
72 | #define src_cnt_to_hw(x) ((x) - 2) | 74 | #define src_cnt_to_hw(x) ((x) - 2) |
@@ -252,7 +254,7 @@ ioat3_alloc_sed(struct ioatdma_device *device, unsigned int hw_pool) | |||
252 | struct ioat_sed_ent *sed; | 254 | struct ioat_sed_ent *sed; |
253 | gfp_t flags = __GFP_ZERO | GFP_ATOMIC; | 255 | gfp_t flags = __GFP_ZERO | GFP_ATOMIC; |
254 | 256 | ||
255 | sed = kmem_cache_alloc(device->sed_pool, flags); | 257 | sed = kmem_cache_alloc(ioat3_sed_cache, flags); |
256 | if (!sed) | 258 | if (!sed) |
257 | return NULL; | 259 | return NULL; |
258 | 260 | ||
@@ -260,7 +262,7 @@ ioat3_alloc_sed(struct ioatdma_device *device, unsigned int hw_pool) | |||
260 | sed->hw = dma_pool_alloc(device->sed_hw_pool[hw_pool], | 262 | sed->hw = dma_pool_alloc(device->sed_hw_pool[hw_pool], |
261 | flags, &sed->dma); | 263 | flags, &sed->dma); |
262 | if (!sed->hw) { | 264 | if (!sed->hw) { |
263 | kmem_cache_free(device->sed_pool, sed); | 265 | kmem_cache_free(ioat3_sed_cache, sed); |
264 | return NULL; | 266 | return NULL; |
265 | } | 267 | } |
266 | 268 | ||
@@ -273,7 +275,7 @@ static void ioat3_free_sed(struct ioatdma_device *device, struct ioat_sed_ent *s | |||
273 | return; | 275 | return; |
274 | 276 | ||
275 | dma_pool_free(device->sed_hw_pool[sed->hw_pool], sed->hw, sed->dma); | 277 | dma_pool_free(device->sed_hw_pool[sed->hw_pool], sed->hw, sed->dma); |
276 | kmem_cache_free(device->sed_pool, sed); | 278 | kmem_cache_free(ioat3_sed_cache, sed); |
277 | } | 279 | } |
278 | 280 | ||
279 | static bool desc_has_ext(struct ioat_ring_ent *desc) | 281 | static bool desc_has_ext(struct ioat_ring_ent *desc) |
@@ -1652,21 +1654,15 @@ int ioat3_dma_probe(struct ioatdma_device *device, int dca) | |||
1652 | char pool_name[14]; | 1654 | char pool_name[14]; |
1653 | int i; | 1655 | int i; |
1654 | 1656 | ||
1655 | /* allocate sw descriptor pool for SED */ | ||
1656 | device->sed_pool = kmem_cache_create("ioat_sed", | ||
1657 | sizeof(struct ioat_sed_ent), 0, 0, NULL); | ||
1658 | if (!device->sed_pool) | ||
1659 | return -ENOMEM; | ||
1660 | |||
1661 | for (i = 0; i < MAX_SED_POOLS; i++) { | 1657 | for (i = 0; i < MAX_SED_POOLS; i++) { |
1662 | snprintf(pool_name, 14, "ioat_hw%d_sed", i); | 1658 | snprintf(pool_name, 14, "ioat_hw%d_sed", i); |
1663 | 1659 | ||
1664 | /* allocate SED DMA pool */ | 1660 | /* allocate SED DMA pool */ |
1665 | device->sed_hw_pool[i] = dma_pool_create(pool_name, | 1661 | device->sed_hw_pool[i] = dmam_pool_create(pool_name, |
1666 | &pdev->dev, | 1662 | &pdev->dev, |
1667 | SED_SIZE * (i + 1), 64, 0); | 1663 | SED_SIZE * (i + 1), 64, 0); |
1668 | if (!device->sed_hw_pool[i]) | 1664 | if (!device->sed_hw_pool[i]) |
1669 | goto sed_pool_cleanup; | 1665 | return -ENOMEM; |
1670 | 1666 | ||
1671 | } | 1667 | } |
1672 | } | 1668 | } |
@@ -1692,28 +1688,4 @@ int ioat3_dma_probe(struct ioatdma_device *device, int dca) | |||
1692 | device->dca = ioat3_dca_init(pdev, device->reg_base); | 1688 | device->dca = ioat3_dca_init(pdev, device->reg_base); |
1693 | 1689 | ||
1694 | return 0; | 1690 | return 0; |
1695 | |||
1696 | sed_pool_cleanup: | ||
1697 | if (device->sed_pool) { | ||
1698 | int i; | ||
1699 | kmem_cache_destroy(device->sed_pool); | ||
1700 | |||
1701 | for (i = 0; i < MAX_SED_POOLS; i++) | ||
1702 | if (device->sed_hw_pool[i]) | ||
1703 | dma_pool_destroy(device->sed_hw_pool[i]); | ||
1704 | } | ||
1705 | |||
1706 | return -ENOMEM; | ||
1707 | } | ||
1708 | |||
1709 | void ioat3_dma_remove(struct ioatdma_device *device) | ||
1710 | { | ||
1711 | if (device->sed_pool) { | ||
1712 | int i; | ||
1713 | kmem_cache_destroy(device->sed_pool); | ||
1714 | |||
1715 | for (i = 0; i < MAX_SED_POOLS; i++) | ||
1716 | if (device->sed_hw_pool[i]) | ||
1717 | dma_pool_destroy(device->sed_hw_pool[i]); | ||
1718 | } | ||
1719 | } | 1691 | } |