Skip to content
  • FUJITA Tomonori's avatar
    iommu sg merging: add device_dma_parameters structure · 6b7b6510
    FUJITA Tomonori authored
    
    
    IOMMUs merges scatter/gather segments without considering a low level
    driver's restrictions. The problem is that IOMMUs can't access to the
    limitations because they are in request_queue.
    
    This patchset introduces a new structure, device_dma_parameters,
    including dma information. A pointer to device_dma_parameters is added
    to struct device. The bus specific structures (like pci_dev) includes
    device_dma_parameters. Low level drivers can use dma_set_max_seg_size
    to tell IOMMUs about the restrictions.
    
    We can move more dma stuff in struct device (like dma_mask) to struct
    device_dma_parameters later (needs some cleanups before that).
    
    This includes patches for all the IOMMUs that could merge sg (x86_64,
    ppc, IA64, alpha, sparc64, and parisc) though only the ppc patch was
    tested. The patches for other IOMMUs are only compile tested.
    
    This patch:
    
    Add a new structure, device_dma_parameters, including dma information.  A
    pointer to device_dma_parameters is added to struct device.
    
    - there are only max_segment_size and segment_boundary_mask there but we'll
      move more dma stuff in struct device (like dma_mask) to struct
      device_dma_parameters later.  segment_boundary_mask is not supported yet.
    
    - new accessors for the dma parameters are added.  So we can easily change
      where to place struct device_dma_parameters in the future.
    
    - dma_get_max_seg_size returns 64K if dma_parms in struct device isn't set
      up properly.  64K is the default max_segment_size in the block layer.
    
    Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
    Acked-by: default avatarJeff Garzik <jeff@garzik.org>
    Cc: James Bottomley <James.Bottomley@steeleye.com>
    Acked-by: default avatarJens Axboe <jens.axboe@oracle.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    6b7b6510