-
Notifications
You must be signed in to change notification settings - Fork 38
dma-proxy: SG list needs to be mapped before use with DMA driver #17
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,11 +194,16 @@ static void start_transfer(struct dma_proxy_channel *pchannel_p) | |
| /* A single entry scatter gather list is used as it's not clear how to do it with a simpler method. | ||
| * Get a descriptor for the transfer ready to submit | ||
| */ | ||
| sg_init_one( | ||
| &pchannel_p->bdtable[bdindex].sglist, | ||
| (void*)pchannel_p->bdtable[bdindex].dma_handle, | ||
| pchannel_p->buffer_table_p[bdindex].length | ||
| ); | ||
| sg_init_one(&pchannel_p->bdtable[bdindex].sglist, | ||
| (void*)pchannel_p->bdtable[baindex].dma_handle, | ||
| pchannel_p->buffer_table_p[bdindex].length); | ||
|
|
||
| n = dma_map_sg(dma_device->dev, &pchannel_p->bdtable[bdindex].sglist, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we allocated in
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem that I addressed here was not the mapping of the memory pointers. It was about the length. In scatterlist.h there is so with IOMMU a different length field is accessed. Those field values are harmonized with dma_map_sg() and that makes the transfer work, otherwise the length field will be read with 0. |
||
| 1, DMA_FROM_DEVICE); | ||
| if (n != 1) { | ||
| printk(KERN_ERR "DMA mapping failed\n"); | ||
| return; | ||
| } | ||
|
|
||
| chan_desc = dma_device->device_prep_slave_sg(pchannel_p->channel_p, &pchannel_p->bdtable[bdindex].sglist, 1, | ||
| pchannel_p->direction, flags, NULL); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sg_init_one() according to scatterlist.c takes in a virtual address to the memory to write to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, yes. Not sure why dma_handle has been introduced here. In that case it's probably better to drop the dma_handle completely instead of just ignoring it.