I am currently writing a Linux Device Driver for a PCI device. I am trying to do a DMA transfer from the device to a user space buffer. However because of the PCI device's limitations, I need the physical address that is generated from page_to_phys to be on a 64KB boundary. Here is the essential code, hostaddr is the address of my user space buffer.

pages = kmalloc(nr_pages, GFP_KERNEL);
get_user_pages(current, current->mm, hostaddr, nr_pages, rw == READ, 0, pages, NULL);
page_to_phys(pages[0]); //this address

since the physical address that comes out of page_to_phys is on a 4KB (PAGE_SIZE) boundary, the chances of my routine successfully transfering the data to the user buffer is 1 in 16. Any suggestions on how to move the pages attached to my user space buffer?

Thanks for the time and consideration,
Ron