Why is sg->offset not added in pci_map_sg()?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

in arch/sparc/kernel/ioport.c pci_map_sg() iterates over the
scatterlist and assigns:
sg->dvma_address = virt_to_phys(page_address(sg->page)).

If CONFIG_PCI is set dma_map_sg is just a wrapper around pci_map_sg()
as defined in include/asm-generic/dma-mapping.h. But I believe that
this makes the behaviour of dma_map_sg() different on sparc compared
to i386; In dma_map_sg() on i386 sg->offset is also added to
dvma_address.

I ran in to this while I was making the DMA API available to non-PCI
systems on SPARC. I created the dma_* functions by just copying the
pci_-equivalent and changing the BUG_ON(direction ==..) check. But
since pci_map_sg() does not include the addition of sg->offset,
transfers to buffers which do not begin on a page boundary will not
work as expected. In my case this broke the scatterlist mappings in
usbcore.

Now I am curious as to why sg->offset isn't added to sg->dvma_address
in pci_map_sg(). Have I overlooked something or should the offset be
added?

I am not very familiar with the DMA mapping system, and quite new to
kernel programming - so please be gentle :-)

Best regards,
 Jan
-
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux