Skip to content

Commit

Permalink
bcm2835-sdhost: Allow for sg entries that cross pages
Browse files Browse the repository at this point in the history
The dma_complete handling code calculates a virtual address for a page
then adds an offset, but if the offset is more than a page and HIGHMEM
is in use then the summed address could be in an unmapped (or just
incorrect) page.

The upstream SDHOST driver allows for this possibility - copy the code
that does so.

Signed-off-by: Phil Elwell <[email protected]>
  • Loading branch information
Phil Elwell authored and popcornmix committed Mar 21, 2019
1 parent 3111886 commit 5b12bd4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/mmc/host/bcm2835-sdhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,11 @@ static void bcm2835_sdhost_dma_complete(void *param)
void *page;
u32 *buf;

if (host->drain_offset & PAGE_MASK) {
host->drain_page += host->drain_offset >> PAGE_SHIFT;
host->drain_offset &= ~PAGE_MASK;
}

page = kmap_atomic(host->drain_page);
buf = page + host->drain_offset;

Expand Down

0 comments on commit 5b12bd4

Please sign in to comment.