Skip to content

Commit

Permalink
mpfs_usb.c: Use kernel memory instead of user memory for DMA
Browse files Browse the repository at this point in the history
DMA directly to user (virtual) memory won't work, as the DMA engine(s)
don't do address translations, i.e. they require a physical address.

Using kernel heap is fine as it is mapped vaddr=paddr. Also, the USB DMA
engine does not have any alignment requirements.
  • Loading branch information
pussuw committed Dec 15, 2023
1 parent 9483729 commit ee6debc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/risc-v/src/mpfs/mpfs_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1718,7 +1718,7 @@ static void *mpfs_ep_allocbuffer(struct usbdev_ep_s *ep, uint16_t nbytes)
{
/* There is not special buffer allocation requirement */

return kumm_malloc(nbytes);
return kmm_malloc(nbytes);
}
#endif

Expand All @@ -1745,7 +1745,7 @@ static void mpfs_ep_freebuffer(struct usbdev_ep_s *ep, void *buf)
{
/* There is not special buffer allocation requirement */

kumm_free(buf);
kmm_free(buf);
}
#endif

Expand Down

0 comments on commit ee6debc

Please sign in to comment.