Getting virt address of a scatterlist buffer in high memory spanning multiple pages

view full story

http://stackoverflow.com – here's my current scenario: I'm currently writing a block driver for some scsi block device. My setup uses a 32-bit kernel 2.6.35. When copying files to my device, I'm seeing scatterlists being sent from high memory (dma address are higher, virt address non-existent, etc.) These buffers are meant to be copied via memcpy to another buffer in memory prior to dma, and so I needed virt addresses for those in high memory. I used kmap_atomic to the sgl to get virtual address, did the memcpy, and then kunmap_atomic those previous mappings. Everything's ok so far until I hit a bug: unable to hand (HowTos)