Re: [PATCH 3/3] x86: make GART to respect device's dma_mask aboutvirtual mappings

From: FUJITA Tomonori
Date: Fri Sep 12 2008 - 11:04:29 EST


On Fri, 12 Sep 2008 16:52:27 +0200
Joerg Roedel <joerg.roedel@xxxxxxx> wrote:

> On Fri, Sep 12, 2008 at 07:42:35PM +0900, FUJITA Tomonori wrote:
> > Currently, GART IOMMU ingores device's dma_mask when it does virtual
> > mappings. So it could give a device a virtual address that the device
> > can't access to.
> >
> > This patch fixes the above problem.
> >
> > Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx>
> > ---
> > arch/x86/kernel/pci-gart_64.c | 39 ++++++++++++++++++++++++++++-----------
> > 1 files changed, 28 insertions(+), 11 deletions(-)
> >
> > diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
> > index 47abe43..9739d56 100644
> > --- a/arch/x86/kernel/pci-gart_64.c
> > +++ b/arch/x86/kernel/pci-gart_64.c
> > @@ -83,23 +83,34 @@ static unsigned long next_bit; /* protected by iommu_bitmap_lock */
> > static int need_flush; /* global flush state. set for each gart wrap */
> >
> > static unsigned long alloc_iommu(struct device *dev, int size,
> > - unsigned long align_mask)
> > + unsigned long align_mask, u64 dma_mask)
>
> You can calculate the dma_mask in this function from the dev parameter.
> There is no need to pass it two levels down to this function extending
> various parameter lists.

No, we can't because we need to use dev->coherent_dma_mask for
alloc_coherent and dev->dma_mask for the rest.
--
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/