lkml.org 
[lkml]   [2012]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 0/2] ARM: IOMMU: tegra: Add iommu_ops for GART/SMMU driver
On Mon, Jan 09, 2012 at 09:39:48AM +0900, KyongHo Cho wrote:
> On Thu, Jan 5, 2012 at 9:53 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > On Thu, Jan 05, 2012 at 09:17:18AM +0200, Hiroshi Doyu wrote:
> >> Just for DMA mapping test from MPU side, the following one is used.
> >
> > This patch is buggy.
> >
> >> +static void dmaapi_test_map_page(struct device *dev)
> >> +{
> >> +     struct page *page;
> >> +     dma_addr_t dma_addr;
> >> +     void *cpu_addr;
> >> +
> >> +     page = alloc_page(GFP_KERNEL);
> >> +     BUG_ON(!page);
> >> +
> >> +     dma_addr = dma_map_page(dev, page, 0, PAGE_SIZE, DMA_TO_DEVICE);
> >> +     BUG_ON(!dma_addr);
> >> +
> >> +     cpu_addr = kmap(page);
> >> +     BUG_ON(!cpu_addr);
> >> +     memset(cpu_addr, 0xa5, PAGE_SIZE);
> >> +     kunmap(cpu_addr);
> >
> > The DMA API works like this:
> >
> > - The CPU owns the page or buffer and can access it.
> > - You map the page or buffer.
> > - The device owns the page or buffer; the CPU must explicitly access it.

Sorry, that 'must' should have been a 'must not'.

> I don't understand what "CPU must __explicitly__ access it" means.
>
> Do you mean that CPU must access the mapped buffer when
> it __explicitly__ knows that the access does not cause any side effect?

No - I mean that the program must not attempt to read or write the
buffer.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-01-09 12:47    [W:0.059 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site