Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XDMA: simplify next_adj setting #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jberaud
Copy link
Contributor

@jberaud jberaud commented Nov 24, 2020

transfer_desc_init already sets the control field to
cpu_to_le32(DESC_MAGIC) so it is useless to mask and rewrite the magic.
Just write next_adj at the right location in the control field.
The error in the mask raised by @mpb27 made me realize that mask plus magic setting was actually useless.

transfer_desc_init already sets the control field to
cpu_to_le32(DESC_MAGIC) so it is useless to mask and rewrite the magic.
Just write next_adj at the right location in the control field.
jberaud referenced this pull request in jberaud/dma_ip_drivers Nov 24, 2020
Fix the setting of the next adjacent fields in descriptors.

Following commit 5faf23e the next_adj field of all descriptors is set
according to the index of the descriptor rather than its address which
causes issues when dma_alloc_coherent doesn't return an address which is
page aligned (which happens).
Moreover, in the case of a transfer which number of descriptors is
bigger than a full page, the next_adj field is set to the maximum (63)
for all descriptors untill the last page of descriptors where it starts
decreasing.
Last, even before this commit, the next_adj field inside a block of
adjacent descriptors is not decreasing untill coming near page end,
which is not compliant with what the documentation says :

"Every descriptor in the descriptor list must accurately describe the descriptor
or block ofdescriptors that follows. In a block of adjacent descriptors, the
Nxt_adj value decrements from the first descriptor to the second to last
descriptor which has a value of zero. Likewise, eachdescriptor in the block
points to the next descriptor in the block, except for the last descriptor
which might point to a new block or might terminate the list."

This commit aligns the blocks of adjacent descriptors to
XDMA_MAX_ADJ_BLOCK_SIZE and makes the next_adj field decrease inside
each block untill the second to last descriptor in the block or in the
full transfer. The size of the page being a multiple of the size of the
block (4096 = sizeof(xdma_desc) * 128 =
sizeof(xdma_desc) * 2 * XDMA_MAX_ADJ_BLOCK_SIZE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant