Re: [PATCH]: PCI: GART iommu alignment fixes [v2]

From: Prarit Bhargava
Date: Fri Aug 08 2008 - 11:21:57 EST




Muli Ben-Yehuda wrote:
On Thu, Aug 07, 2008 at 01:41:40PM -0400, Prarit Bhargava wrote:

As for Calgary, I'm looking into it ATM. I think I can get my hands
on one.

Feel free to ping me if Calgary testing is needed.

Muli -- I just ran tests on an IBM system with a Calgary iommu that Ed Pollard pointed me at.

dma_ops_alloc_addresses() does not have the option to return size-aligned values. This means that pci_alloc_consistent()/dma_alloc_coherent() will return unaligned values to callers when the lower 4G of memory not available.

Additionally, a quick test shows that in dma_ops_alloc_addresses()

boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1,
PAGE_SIZE) >> PAGE_SHIFT;

may return 0 in the same manner I've been pointing out -- if dma_get_seg_boundary(dev) returns 0xffffffff and 1 is added to that result, boundary_size = 0. Then you BUG() in the iommu-helper code.

Jesse pointed out to me that my fix on that line is incorrect. _If_ this is not a compiler issue (I've emailed jakub privately and cc'd him on this email) then a better fix would be to do (sorry for the cut-and-paste):

--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -78,7 +78,7 @@ static inline unsigned int dma_set_max_seg_size(struct device
static inline unsigned long dma_get_seg_boundary(struct device *dev)
{
return dev->dma_parms ?
- dev->dma_parms->segment_boundary_mask : 0xffffffff;
+ dev->dma_parms->segment_boundary_mask : 0xffffffffUL;
}

However, I'm still waiting for clarification from jakub before submitting again with that chunk.

P.


Cheers,
Muli
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/