[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080630000023F.fujita.tomonori@lab.ntt.co.jp>
Date: Mon, 30 Jun 2008 00:07:16 +0900
From: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
To: joerg.roedel@....com
Cc: tglx@...utronix.de, mingo@...hat.com, linux-kernel@...r.kernel.org,
iommu@...ts.linux-foundation.org, bhavna.sarathy@....com,
Sebastian.Biemueller@....com, robert.richter@....com,
joro@...tes.org
Subject: Re: [PATCH 26/34] AMD IOMMU: add mapping functions for scatter
gather lists
On Thu, 26 Jun 2008 21:28:02 +0200
Joerg Roedel <joerg.roedel@....com> wrote:
> This patch adds the dma_ops functions for mapping and unmapping scatter gather
> lists.
>
> Signed-off-by: Joerg Roedel <joerg.roedel@....com>
> ---
> arch/x86/kernel/amd_iommu.c | 98 +++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 98 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
> index b4079f6..f4747fe 100644
> --- a/arch/x86/kernel/amd_iommu.c
> +++ b/arch/x86/kernel/amd_iommu.c
> @@ -700,3 +700,101 @@ static void unmap_single(struct device *dev, dma_addr_t dma_addr,
> spin_unlock_irqrestore(&domain->lock, flags);
> }
>
> +static int map_sg_no_iommu(struct device *dev, struct scatterlist *sglist,
> + int nelems, int dir)
> +{
> + struct scatterlist *s;
> + int i;
> +
> + for_each_sg(sglist, s, nelems, i) {
> + s->dma_address = (dma_addr_t)sg_phys(s);
> + s->dma_length = s->length;
> + }
> +
> + return nelems;
> +}
> +
> +static int map_sg(struct device *dev, struct scatterlist *sglist,
> + int nelems, int dir)
> +{
> + unsigned long flags;
> + struct amd_iommu *iommu;
> + struct protection_domain *domain;
> + u16 devid;
> + int i;
> + struct scatterlist *s;
> + phys_addr_t paddr;
> + int mapped_elems = 0;
> +
> + get_device_resources(dev, &iommu, &domain, &devid);
> +
> + if (!iommu || !domain)
> + return map_sg_no_iommu(dev, sglist, nelems, dir);
VT-d put a pointer in struct dev_archdata to store IOMMU info per
device. Is is useful for you too?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists