|
22 | 22 | * DOC: GSI Transactions
|
23 | 23 | *
|
24 | 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 |
| 25 | + * everything about a related group of IPA operations in a single structure. |
| 26 | + * (A "operation" in this sense is either a data transfer or an IPA immediate |
27 | 27 | * command.) Most details of interaction with the GSI hardware are managed
|
28 |
| - * by the GSI transaction core, allowing users to simply describe commands |
| 28 | + * by the GSI transaction core, allowing users to simply describe operations |
29 | 29 | * to be performed. When a transaction has completed a callback function
|
30 | 30 | * (dependent on the type of endpoint associated with the channel) allows
|
31 | 31 | * cleanup of resources associated with the transaction.
|
32 | 32 | *
|
33 |
| - * To perform a command (or set of them), a user of the GSI transaction |
| 33 | + * To perform an operation (or set of them), a user of the GSI transaction |
34 | 34 | * interface allocates a transaction, indicating the number of TREs required
|
35 |
| - * (one per command). If sufficient TREs are available, they are reserved |
| 35 | + * (one per operation). If sufficient TREs are available, they are reserved |
36 | 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. |
| 37 | + * exhaustion of the available TREs in a channel ring is detected as early |
| 38 | + * as possible. Any other resources that might be needed to complete a |
| 39 | + * transaction are also allocated when the transaction is allocated. |
40 | 40 | *
|
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()). |
| 41 | + * Operations performed as part of a transaction are represented in an array |
| 42 | + * of Linux scatterlist structures, allocated with the transaction. These |
| 43 | + * scatterlist structures are initialized by "adding" operations to the |
| 44 | + * transaction. If a buffer in an operation must be mapped for DMA, this is |
| 45 | + * done at the time it is added to the transaction. It is possible for a |
| 46 | + * mapping error to occur when an operation is added. In this case the |
| 47 | + * transaction should simply be freed; this correctly releases resources |
| 48 | + * associated with the transaction. |
45 | 49 | *
|
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. |
51 |
| - * |
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. |
| 50 | + * Once all operations have been successfully added to a transaction, the |
| 51 | + * transaction is committed. Committing transfers ownership of the entire |
| 52 | + * transaction to the GSI transaction core. The GSI transaction code |
| 53 | + * formats the content of the scatterlist array into the channel ring |
| 54 | + * buffer and informs the hardware that new TREs are available to process. |
56 | 55 | *
|
57 | 56 | * The last TRE in each transaction is marked to interrupt the AP when the
|
58 | 57 | * GSI hardware has completed it. Because transfers described by TREs are
|
@@ -125,11 +124,10 @@ void gsi_trans_pool_exit(struct gsi_trans_pool *pool)
|
125 | 124 | memset(pool, 0, sizeof(*pool));
|
126 | 125 | }
|
127 | 126 |
|
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. |
| 127 | +/* Home-grown DMA pool. This way we can preallocate the pool, and guarantee |
| 128 | + * allocations will succeed. The immediate commands in a transaction can |
| 129 | + * require up to max_alloc elements from the pool. But we only allow |
| 130 | + * allocation of a single element from a DMA pool at a time. |
133 | 131 | */
|
134 | 132 | int gsi_trans_pool_init_dma(struct device *dev, struct gsi_trans_pool *pool,
|
135 | 133 | size_t size, u32 count, u32 max_alloc)
|
@@ -537,8 +535,8 @@ static void gsi_trans_tre_fill(struct gsi_tre *dest_tre, dma_addr_t addr,
|
537 | 535 | *
|
538 | 536 | * Formats channel ring TRE entries based on the content of the scatterlist.
|
539 | 537 | * Maps a transaction pointer to the last ring entry used for the transaction,
|
540 |
| - * so it can be recovered when it completes. Moves the transaction to the |
541 |
| - * pending list. Finally, updates the channel ring pointer and optionally |
| 538 | + * so it can be recovered when it completes. Moves the transaction to |
| 539 | + * pending state. Finally, updates the channel ring pointer and optionally |
542 | 540 | * rings the doorbell.
|
543 | 541 | */
|
544 | 542 | static void __gsi_trans_commit(struct gsi_trans *trans, bool ring_db)
|
|
0 commit comments