1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2019-2020 Linaro Ltd.
7 #include <linux/types.h>
8 #include <linux/bits.h>
9 #include <linux/bitfield.h>
10 #include <linux/refcount.h>
11 #include <linux/scatterlist.h>
12 #include <linux/dma-direction.h>
15 #include "gsi_private.h"
16 #include "gsi_trans.h"
22 * DOC: GSI Transactions
24 * A GSI transaction abstracts the behavior of a GSI channel by representing
25 * everything about a related group of IPA commands in a single structure.
26 * (A "command" in this sense is either a data transfer or an IPA immediate
27 * command.) Most details of interaction with the GSI hardware are managed
28 * by the GSI transaction core, allowing users to simply describe commands
29 * to be performed. When a transaction has completed a callback function
30 * (dependent on the type of endpoint associated with the channel) allows
31 * cleanup of resources associated with the transaction.
33 * To perform a command (or set of them), a user of the GSI transaction
34 * interface allocates a transaction, indicating the number of TREs required
35 * (one per command). If sufficient TREs are available, they are reserved
36 * for use in the transaction and the allocation succeeds. This way
37 * exhaustion of the available TREs in a channel ring is detected
38 * as early as possible. All resources required to complete a transaction
39 * are allocated at transaction allocation time.
41 * Commands performed as part of a transaction are represented in an array
42 * of Linux scatterlist structures. This array is allocated with the
43 * transaction, and its entries are initialized using standard scatterlist
44 * functions (such as sg_set_buf() or skb_to_sgvec()).
46 * Once a transaction's scatterlist structures have been initialized, the
47 * transaction is committed. The caller is responsible for mapping buffers
48 * for DMA if necessary, and this should be done *before* allocating
49 * the transaction. Between a successful allocation and commit of a
50 * transaction no errors should occur.
52 * Committing transfers ownership of the entire transaction to the GSI
53 * transaction core. The GSI transaction code formats the content of
54 * the scatterlist array into the channel ring buffer and informs the
55 * hardware that new TREs are available to process.
57 * The last TRE in each transaction is marked to interrupt the AP when the
58 * GSI hardware has completed it. Because transfers described by TREs are
59 * performed strictly in order, signaling the completion of just the last
60 * TRE in the transaction is sufficient to indicate the full transaction
63 * When a transaction is complete, ipa_gsi_trans_complete() is called by the
64 * GSI code into the IPA layer, allowing it to perform any final cleanup
65 * required before the transaction is freed.
68 /* Hardware values representing a transfer element type */
71 GSI_RE_IMMD_CMD = 0x3,
74 /* An entry in a channel ring */
76 __le64 addr; /* DMA address */
77 __le16 len_opcode; /* length in bytes or enum IPA_CMD_* */
79 __le32 flags; /* TRE_FLAGS_* */
82 /* gsi_tre->flags mask values (in CPU byte order) */
83 #define TRE_FLAGS_CHAIN_FMASK GENMASK(0, 0)
84 #define TRE_FLAGS_IEOT_FMASK GENMASK(9, 9)
85 #define TRE_FLAGS_BEI_FMASK GENMASK(10, 10)
86 #define TRE_FLAGS_TYPE_FMASK GENMASK(23, 16)
88 int gsi_trans_pool_init(struct gsi_trans_pool *pool, size_t size, u32 count,
95 if (count < max_alloc)
100 /* By allocating a few extra entries in our pool (one less
101 * than the maximum number that will be requested in a
102 * single allocation), we can always satisfy requests without
103 * ever worrying about straddling the end of the pool array.
104 * If there aren't enough entries starting at the free index,
105 * we just allocate free entries from the beginning of the pool.
107 virt = kcalloc(count + max_alloc - 1, size, GFP_KERNEL);
112 /* If the allocator gave us any extra memory, use it */
113 pool->count = ksize(pool->base) / size;
115 pool->max_alloc = max_alloc;
117 pool->addr = 0; /* Only used for DMA pools */
122 void gsi_trans_pool_exit(struct gsi_trans_pool *pool)
125 memset(pool, 0, sizeof(*pool));
128 /* Allocate the requested number of (zeroed) entries from the pool */
129 /* Home-grown DMA pool. This way we can preallocate and use the tre_count
130 * to guarantee allocations will succeed. Even though we specify max_alloc
131 * (and it can be more than one), we only allow allocation of a single
132 * element from a DMA pool.
134 int gsi_trans_pool_init_dma(struct device *dev, struct gsi_trans_pool *pool,
135 size_t size, u32 count, u32 max_alloc)
143 if (count < max_alloc)
148 /* Don't let allocations cross a power-of-two boundary */
149 size = __roundup_pow_of_two(size);
150 total_size = (count + max_alloc - 1) * size;
152 /* The allocator will give us a power-of-2 number of pages
153 * sufficient to satisfy our request. Round up our requested
154 * size to avoid any unused space in the allocation. This way
155 * gsi_trans_pool_exit_dma() can assume the total allocated
156 * size is exactly (count * size).
158 total_size = get_order(total_size) << PAGE_SHIFT;
160 virt = dma_alloc_coherent(dev, total_size, &addr, GFP_KERNEL);
165 pool->count = total_size / size;
168 pool->max_alloc = max_alloc;
174 void gsi_trans_pool_exit_dma(struct device *dev, struct gsi_trans_pool *pool)
176 size_t total_size = pool->count * pool->size;
178 dma_free_coherent(dev, total_size, pool->base, pool->addr);
179 memset(pool, 0, sizeof(*pool));
182 /* Return the byte offset of the next free entry in the pool */
183 static u32 gsi_trans_pool_alloc_common(struct gsi_trans_pool *pool, u32 count)
188 WARN_ON(count > pool->max_alloc);
190 /* Allocate from beginning if wrap would occur */
191 if (count > pool->count - pool->free)
194 offset = pool->free * pool->size;
196 memset(pool->base + offset, 0, count * pool->size);
201 /* Allocate a contiguous block of zeroed entries from a pool */
202 void *gsi_trans_pool_alloc(struct gsi_trans_pool *pool, u32 count)
204 return pool->base + gsi_trans_pool_alloc_common(pool, count);
207 /* Allocate a single zeroed entry from a DMA pool */
208 void *gsi_trans_pool_alloc_dma(struct gsi_trans_pool *pool, dma_addr_t *addr)
210 u32 offset = gsi_trans_pool_alloc_common(pool, 1);
212 *addr = pool->addr + offset;
214 return pool->base + offset;
217 /* Return the pool element that immediately follows the one given.
218 * This only works done if elements are allocated one at a time.
220 void *gsi_trans_pool_next(struct gsi_trans_pool *pool, void *element)
222 void *end = pool->base + pool->count * pool->size;
224 WARN_ON(element < pool->base);
225 WARN_ON(element >= end);
226 WARN_ON(pool->max_alloc != 1);
228 element += pool->size;
230 return element < end ? element : pool->base;
233 /* Map a given ring entry index to the transaction associated with it */
234 static void gsi_channel_trans_map(struct gsi_channel *channel, u32 index,
235 struct gsi_trans *trans)
237 /* Note: index *must* be used modulo the ring count here */
238 channel->trans_info.map[index % channel->tre_ring.count] = trans;
241 /* Return the transaction mapped to a given ring entry */
243 gsi_channel_trans_mapped(struct gsi_channel *channel, u32 index)
245 /* Note: index *must* be used modulo the ring count here */
246 return channel->trans_info.map[index % channel->tre_ring.count];
249 /* Return the oldest completed transaction for a channel (or null) */
250 struct gsi_trans *gsi_channel_trans_complete(struct gsi_channel *channel)
252 return list_first_entry_or_null(&channel->trans_info.complete,
253 struct gsi_trans, links);
256 /* Move a transaction from the allocated list to the pending list */
257 static void gsi_trans_move_pending(struct gsi_trans *trans)
259 struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id];
260 struct gsi_trans_info *trans_info = &channel->trans_info;
262 spin_lock_bh(&trans_info->spinlock);
264 list_move_tail(&trans->links, &trans_info->pending);
266 spin_unlock_bh(&trans_info->spinlock);
269 /* Move a transaction and all of its predecessors from the pending list
270 * to the completed list.
272 void gsi_trans_move_complete(struct gsi_trans *trans)
274 struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id];
275 struct gsi_trans_info *trans_info = &channel->trans_info;
276 struct list_head list;
278 spin_lock_bh(&trans_info->spinlock);
280 /* Move this transaction and all predecessors to completed list */
281 list_cut_position(&list, &trans_info->pending, &trans->links);
282 list_splice_tail(&list, &trans_info->complete);
284 spin_unlock_bh(&trans_info->spinlock);
287 /* Move a transaction from the completed list to the polled list */
288 void gsi_trans_move_polled(struct gsi_trans *trans)
290 struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id];
291 struct gsi_trans_info *trans_info = &channel->trans_info;
293 spin_lock_bh(&trans_info->spinlock);
295 list_move_tail(&trans->links, &trans_info->polled);
297 spin_unlock_bh(&trans_info->spinlock);
300 /* Reserve some number of TREs on a channel. Returns true if successful */
302 gsi_trans_tre_reserve(struct gsi_trans_info *trans_info, u32 tre_count)
304 int avail = atomic_read(&trans_info->tre_avail);
308 new = avail - (int)tre_count;
309 if (unlikely(new < 0))
311 } while (!atomic_try_cmpxchg(&trans_info->tre_avail, &avail, new));
316 /* Release previously-reserved TRE entries to a channel */
318 gsi_trans_tre_release(struct gsi_trans_info *trans_info, u32 tre_count)
320 atomic_add(tre_count, &trans_info->tre_avail);
323 /* Allocate a GSI transaction on a channel */
324 struct gsi_trans *gsi_channel_trans_alloc(struct gsi *gsi, u32 channel_id,
326 enum dma_data_direction direction)
328 struct gsi_channel *channel = &gsi->channel[channel_id];
329 struct gsi_trans_info *trans_info;
330 struct gsi_trans *trans;
332 if (WARN_ON(tre_count > gsi_channel_trans_tre_max(gsi, channel_id)))
335 trans_info = &channel->trans_info;
337 /* We reserve the TREs now, but consume them at commit time.
338 * If there aren't enough available, we're done.
340 if (!gsi_trans_tre_reserve(trans_info, tre_count))
343 /* Allocate and initialize non-zero fields in the the transaction */
344 trans = gsi_trans_pool_alloc(&trans_info->pool, 1);
346 trans->channel_id = channel_id;
347 trans->tre_count = tre_count;
348 init_completion(&trans->completion);
350 /* Allocate the scatterlist and (if requested) info entries. */
351 trans->sgl = gsi_trans_pool_alloc(&trans_info->sg_pool, tre_count);
352 sg_init_marker(trans->sgl, tre_count);
354 trans->direction = direction;
356 spin_lock_bh(&trans_info->spinlock);
358 list_add_tail(&trans->links, &trans_info->alloc);
360 spin_unlock_bh(&trans_info->spinlock);
362 refcount_set(&trans->refcount, 1);
367 /* Free a previously-allocated transaction */
368 void gsi_trans_free(struct gsi_trans *trans)
370 refcount_t *refcount = &trans->refcount;
371 struct gsi_trans_info *trans_info;
374 /* We must hold the lock to release the last reference */
375 if (refcount_dec_not_one(refcount))
378 trans_info = &trans->gsi->channel[trans->channel_id].trans_info;
380 spin_lock_bh(&trans_info->spinlock);
382 /* Reference might have been added before we got the lock */
383 last = refcount_dec_and_test(refcount);
385 list_del(&trans->links);
387 spin_unlock_bh(&trans_info->spinlock);
392 ipa_gsi_trans_release(trans);
394 /* Releasing the reserved TREs implicitly frees the sgl[] and
395 * (if present) info[] arrays, plus the transaction itself.
397 gsi_trans_tre_release(trans_info, trans->tre_count);
400 /* Add an immediate command to a transaction */
401 void gsi_trans_cmd_add(struct gsi_trans *trans, void *buf, u32 size,
402 dma_addr_t addr, enum dma_data_direction direction,
403 enum ipa_cmd_opcode opcode)
405 struct ipa_cmd_info *info;
406 u32 which = trans->used++;
407 struct scatterlist *sg;
409 WARN_ON(which >= trans->tre_count);
411 /* Commands are quite different from data transfer requests.
412 * Their payloads come from a pool whose memory is allocated
413 * using dma_alloc_coherent(). We therefore do *not* map them
414 * for DMA (unlike what we do for pages and skbs).
416 * When a transaction completes, the SGL is normally unmapped.
417 * A command transaction has direction DMA_NONE, which tells
418 * gsi_trans_complete() to skip the unmapping step.
420 * The only things we use directly in a command scatter/gather
421 * entry are the DMA address and length. We still need the SG
422 * table flags to be maintained though, so assign a NULL page
423 * pointer for that purpose.
425 sg = &trans->sgl[which];
426 sg_assign_page(sg, NULL);
427 sg_dma_address(sg) = addr;
428 sg_dma_len(sg) = size;
430 info = &trans->info[which];
431 info->opcode = opcode;
432 info->direction = direction;
435 /* Add a page transfer to a transaction. It will fill the only TRE. */
436 int gsi_trans_page_add(struct gsi_trans *trans, struct page *page, u32 size,
439 struct scatterlist *sg = &trans->sgl[0];
442 if (WARN_ON(trans->tre_count != 1))
444 if (WARN_ON(trans->used))
447 sg_set_page(sg, page, size, offset);
448 ret = dma_map_sg(trans->gsi->dev, sg, 1, trans->direction);
452 trans->used++; /* Transaction now owns the (DMA mapped) page */
457 /* Add an SKB transfer to a transaction. No other TREs will be used. */
458 int gsi_trans_skb_add(struct gsi_trans *trans, struct sk_buff *skb)
460 struct scatterlist *sg = &trans->sgl[0];
464 if (WARN_ON(trans->tre_count != 1))
466 if (WARN_ON(trans->used))
469 /* skb->len will not be 0 (checked early) */
470 ret = skb_to_sgvec(skb, sg, 0, skb->len);
475 ret = dma_map_sg(trans->gsi->dev, sg, used, trans->direction);
479 trans->used += used; /* Transaction now owns the (DMA mapped) skb */
484 /* Compute the length/opcode value to use for a TRE */
485 static __le16 gsi_tre_len_opcode(enum ipa_cmd_opcode opcode, u32 len)
487 return opcode == IPA_CMD_NONE ? cpu_to_le16((u16)len)
488 : cpu_to_le16((u16)opcode);
491 /* Compute the flags value to use for a given TRE */
492 static __le32 gsi_tre_flags(bool last_tre, bool bei, enum ipa_cmd_opcode opcode)
494 enum gsi_tre_type tre_type;
497 tre_type = opcode == IPA_CMD_NONE ? GSI_RE_XFER : GSI_RE_IMMD_CMD;
498 tre_flags = u32_encode_bits(tre_type, TRE_FLAGS_TYPE_FMASK);
500 /* Last TRE contains interrupt flags */
502 /* All transactions end in a transfer completion interrupt */
503 tre_flags |= TRE_FLAGS_IEOT_FMASK;
504 /* Don't interrupt when outbound commands are acknowledged */
506 tre_flags |= TRE_FLAGS_BEI_FMASK;
507 } else { /* All others indicate there's more to come */
508 tre_flags |= TRE_FLAGS_CHAIN_FMASK;
511 return cpu_to_le32(tre_flags);
514 static void gsi_trans_tre_fill(struct gsi_tre *dest_tre, dma_addr_t addr,
515 u32 len, bool last_tre, bool bei,
516 enum ipa_cmd_opcode opcode)
520 tre.addr = cpu_to_le64(addr);
521 tre.len_opcode = gsi_tre_len_opcode(opcode, len);
523 tre.flags = gsi_tre_flags(last_tre, bei, opcode);
525 /* ARM64 can write 16 bytes as a unit with a single instruction.
526 * Doing the assignment this way is an attempt to make that happen.
532 * __gsi_trans_commit() - Common GSI transaction commit code
533 * @trans: Transaction to commit
534 * @ring_db: Whether to tell the hardware about these queued transfers
536 * Formats channel ring TRE entries based on the content of the scatterlist.
537 * Maps a transaction pointer to the last ring entry used for the transaction,
538 * so it can be recovered when it completes. Moves the transaction to the
539 * pending list. Finally, updates the channel ring pointer and optionally
540 * rings the doorbell.
542 static void __gsi_trans_commit(struct gsi_trans *trans, bool ring_db)
544 struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id];
545 struct gsi_ring *ring = &channel->tre_ring;
546 enum ipa_cmd_opcode opcode = IPA_CMD_NONE;
547 bool bei = channel->toward_ipa;
548 struct ipa_cmd_info *info;
549 struct gsi_tre *dest_tre;
550 struct scatterlist *sg;
555 WARN_ON(!trans->used);
557 /* Consume the entries. If we cross the end of the ring while
558 * filling them we'll switch to the beginning to finish.
559 * If there is no info array we're doing a simple data
560 * transfer request, whose opcode is IPA_CMD_NONE.
562 info = trans->info ? &trans->info[0] : NULL;
563 avail = ring->count - ring->index % ring->count;
564 dest_tre = gsi_ring_virt(ring, ring->index);
565 for_each_sg(trans->sgl, sg, trans->used, i) {
566 bool last_tre = i == trans->used - 1;
567 dma_addr_t addr = sg_dma_address(sg);
568 u32 len = sg_dma_len(sg);
572 dest_tre = gsi_ring_virt(ring, 0);
574 opcode = info++->opcode;
576 gsi_trans_tre_fill(dest_tre, addr, len, last_tre, bei, opcode);
579 ring->index += trans->used;
581 if (channel->toward_ipa) {
582 /* We record TX bytes when they are sent */
583 trans->len = byte_count;
584 trans->trans_count = channel->trans_count;
585 trans->byte_count = channel->byte_count;
586 channel->trans_count++;
587 channel->byte_count += byte_count;
590 /* Associate the last TRE with the transaction */
591 gsi_channel_trans_map(channel, ring->index - 1, trans);
593 gsi_trans_move_pending(trans);
595 /* Ring doorbell if requested, or if all TREs are allocated */
596 if (ring_db || !atomic_read(&channel->trans_info.tre_avail)) {
597 /* Report what we're handing off to hardware for TX channels */
598 if (channel->toward_ipa)
599 gsi_channel_tx_queued(channel);
600 gsi_channel_doorbell(channel);
604 /* Commit a GSI transaction */
605 void gsi_trans_commit(struct gsi_trans *trans, bool ring_db)
608 __gsi_trans_commit(trans, ring_db);
610 gsi_trans_free(trans);
613 /* Commit a GSI transaction and wait for it to complete */
614 void gsi_trans_commit_wait(struct gsi_trans *trans)
619 refcount_inc(&trans->refcount);
621 __gsi_trans_commit(trans, true);
623 wait_for_completion(&trans->completion);
626 gsi_trans_free(trans);
629 /* Commit a GSI transaction and wait for it to complete, with timeout */
630 int gsi_trans_commit_wait_timeout(struct gsi_trans *trans,
631 unsigned long timeout)
633 unsigned long timeout_jiffies = msecs_to_jiffies(timeout);
634 unsigned long remaining = 1; /* In case of empty transaction */
639 refcount_inc(&trans->refcount);
641 __gsi_trans_commit(trans, true);
643 remaining = wait_for_completion_timeout(&trans->completion,
646 gsi_trans_free(trans);
648 return remaining ? 0 : -ETIMEDOUT;
651 /* Process the completion of a transaction; called while polling */
652 void gsi_trans_complete(struct gsi_trans *trans)
654 /* If the entire SGL was mapped when added, unmap it now */
655 if (trans->direction != DMA_NONE)
656 dma_unmap_sg(trans->gsi->dev, trans->sgl, trans->used,
659 ipa_gsi_trans_complete(trans);
661 complete(&trans->completion);
663 gsi_trans_free(trans);
666 /* Cancel a channel's pending transactions */
667 void gsi_channel_trans_cancel_pending(struct gsi_channel *channel)
669 struct gsi_trans_info *trans_info = &channel->trans_info;
670 struct gsi_trans *trans;
673 /* channel->gsi->mutex is held by caller */
674 spin_lock_bh(&trans_info->spinlock);
676 cancelled = !list_empty(&trans_info->pending);
677 list_for_each_entry(trans, &trans_info->pending, links)
678 trans->cancelled = true;
680 list_splice_tail_init(&trans_info->pending, &trans_info->complete);
682 spin_unlock_bh(&trans_info->spinlock);
684 /* Schedule NAPI polling to complete the cancelled transactions */
686 napi_schedule(&channel->napi);
689 /* Issue a command to read a single byte from a channel */
690 int gsi_trans_read_byte(struct gsi *gsi, u32 channel_id, dma_addr_t addr)
692 struct gsi_channel *channel = &gsi->channel[channel_id];
693 struct gsi_ring *ring = &channel->tre_ring;
694 struct gsi_trans_info *trans_info;
695 struct gsi_tre *dest_tre;
697 trans_info = &channel->trans_info;
699 /* First reserve the TRE, if possible */
700 if (!gsi_trans_tre_reserve(trans_info, 1))
703 /* Now fill the the reserved TRE and tell the hardware */
705 dest_tre = gsi_ring_virt(ring, ring->index);
706 gsi_trans_tre_fill(dest_tre, addr, 1, true, false, IPA_CMD_NONE);
709 gsi_channel_doorbell(channel);
714 /* Mark a gsi_trans_read_byte() request done */
715 void gsi_trans_read_byte_done(struct gsi *gsi, u32 channel_id)
717 struct gsi_channel *channel = &gsi->channel[channel_id];
719 gsi_trans_tre_release(&channel->trans_info, 1);
722 /* Initialize a channel's GSI transaction info */
723 int gsi_channel_trans_init(struct gsi *gsi, u32 channel_id)
725 struct gsi_channel *channel = &gsi->channel[channel_id];
726 struct gsi_trans_info *trans_info;
730 /* Ensure the size of a channel element is what's expected */
731 BUILD_BUG_ON(sizeof(struct gsi_tre) != GSI_RING_ELEMENT_SIZE);
733 /* The map array is used to determine what transaction is associated
734 * with a TRE that the hardware reports has completed. We need one
737 trans_info = &channel->trans_info;
738 trans_info->map = kcalloc(channel->tre_count, sizeof(*trans_info->map),
740 if (!trans_info->map)
743 /* We can't use more TREs than there are available in the ring.
744 * This limits the number of transactions that can be oustanding.
745 * Worst case is one TRE per transaction (but we actually limit
746 * it to something a little less than that). We allocate resources
747 * for transactions (including transaction structures) based on
748 * this maximum number.
750 tre_max = gsi_channel_tre_max(channel->gsi, channel_id);
752 /* Transactions are allocated one at a time. */
753 ret = gsi_trans_pool_init(&trans_info->pool, sizeof(struct gsi_trans),
758 /* A transaction uses a scatterlist array to represent the data
759 * transfers implemented by the transaction. Each scatterlist
760 * element is used to fill a single TRE when the transaction is
761 * committed. So we need as many scatterlist elements as the
762 * maximum number of TREs that can be outstanding.
764 * All TREs in a transaction must fit within the channel's TLV FIFO.
765 * A transaction on a channel can allocate as many TREs as that but
768 ret = gsi_trans_pool_init(&trans_info->sg_pool,
769 sizeof(struct scatterlist),
770 tre_max, channel->tlv_count);
772 goto err_trans_pool_exit;
774 /* Finally, the tre_avail field is what ultimately limits the number
775 * of outstanding transactions and their resources. A transaction
776 * allocation succeeds only if the TREs available are sufficient for
777 * what the transaction might need. Transaction resource pools are
778 * sized based on the maximum number of outstanding TREs, so there
779 * will always be resources available if there are TREs available.
781 atomic_set(&trans_info->tre_avail, tre_max);
783 spin_lock_init(&trans_info->spinlock);
784 INIT_LIST_HEAD(&trans_info->alloc);
785 INIT_LIST_HEAD(&trans_info->pending);
786 INIT_LIST_HEAD(&trans_info->complete);
787 INIT_LIST_HEAD(&trans_info->polled);
792 gsi_trans_pool_exit(&trans_info->pool);
794 kfree(trans_info->map);
796 dev_err(gsi->dev, "error %d initializing channel %u transactions\n",
802 /* Inverse of gsi_channel_trans_init() */
803 void gsi_channel_trans_exit(struct gsi_channel *channel)
805 struct gsi_trans_info *trans_info = &channel->trans_info;
807 gsi_trans_pool_exit(&trans_info->sg_pool);
808 gsi_trans_pool_exit(&trans_info->pool);
809 kfree(trans_info->map);