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

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

 



On Thu, 24 Jul 2008 14:37:55 +0200
Joerg Roedel <joro@xxxxxxxxxx> wrote:

> On Thu, Jul 24, 2008 at 07:34:35PM +0900, FUJITA Tomonori wrote:
> > On Thu, 24 Jul 2008 06:09:31 -0400
> > Prarit Bhargava <prarit@xxxxxxxxxx> wrote:
> > >         skge->mem = pci_alloc_consistent(hw->pdev, skge->mem_size, 
> > > &skge->dma);
> > >         if (!skge->mem)
> > >                 return -ENOMEM;
> > > 
> > >         BUG_ON(skge->dma & 7);
> > > 
> > >         if ((u64)skge->dma >> 32 != ((u64) skge->dma + skge->mem_size) 
> > >  >> 32) {
> > >                 printk(KERN_ERR PFX "pci_alloc_consistent region crosses 
> > > 4G boundary\n");
> > >                 err = -EINVAL;
> > >                 goto free_pci_mem;
> > >         }
> > > 
> > > 
> > > If pci_alloc_consistent did the "right" thing, we should *never* see 
> > > that warning message.
> > 
> > Well, I think that this is not releated with the pci_alloc_consistent
> > alignment problem that you talk about.
> > 
> > I think that the driver tries to avoid 4GB boundary crossing
> > problem. You can find some work to avoid this, for example:
> > 
> > http://www.ussg.iu.edu/hypermail/linux/kernel/0712.0/2206.html
> > 
> > pci_device_add() has the following code to avoid this:
> > 
> > pci_set_dma_seg_boundary(dev, 0xffffffff);
> > 
> > I suspect that the problem you talk about, alloc_consistent doesn't
> > return the reqeuested size aligned memory, breaks anything.
> 
> But I think Prarit is right with this change. If the interface defines
> this behavior the IOMMU drivers have to implement it. I am just
> wondering that the problem never showed up before. The GART driver is a
> few years old now.

Yeah, I'm not against fixing IOMMUs to make alloc_consistent return
the reqeuested size aligned memory. My point is that it's not likely
to fix anything. Even with the patch, we hit the above problem because
as I explained, the root cause of the problem is the boundary issue;
we need to fix pci-dma.c

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

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux