lkml.org 
[lkml]   [2008]   [Jul]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH]: PCI: GART iommu alignment fixes [v2]
From
On Wed, 23 Jul 2008 07:19:43 -0400
Prarit Bhargava <prarit@redhat.com> wrote:

> pci_alloc_consistent/dma_alloc_coherent does not return size aligned
> addresses.
>
> From Documentation/DMA-mapping.txt:
>
> "pci_alloc_consistent returns two values: the virtual address which you
> can use to access it from the CPU and dma_handle which you pass to the
> card.
>
> The cpu return address and the DMA bus master address are both
> guaranteed to be aligned to the smallest PAGE_SIZE order which
> is greater than or equal to the requested size. This invariant
> exists (for example) to guarantee that if you allocate a chunk
> which is smaller than or equal to 64 kilobytes, the extent of the
> buffer you receive will not cross a 64K boundary."
>
> 1. Modify alloc_iommu to allow for an alignment mask
> 2. Modify pci_gart_simple to return size-aligned values.
> 3. Fixup the alignment calculation in the iommu-helper code.

Hmm, you don't fix anything in the helper code. You just use
__ALIGN_MASK.

And please don't use __ALIGN_MASK. You will notice that no one in
mainline use __ALIGN_MASK. Andrew said that we should not.

Ideally, we should use ALIGN here but the current code was accepted
because it is pretty simple and we have an comment what we do here. So
please let it alone.


\
 
 \ /
  Last update: 2008-07-24 01:25    [W:0.217 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site