This is probably a workaround because Loongson doesn't support DMA
address above 4GB. If memory is more than 4GB, CONFIG_SWIOTLB and
ZONE_DMA32 should be selected. In this way, DMA pages are allocated
below 4GB preferably.
However, CONFIG_SWIOTLB+ZONE_DMA32 is not enough, so, we provide a
platform
> +static void *loongson_dma_alloc_coherent(struct device *dev, size_t size,
> + dma_addr_t *dma_handle, gfp_t gfp, struct
> dma_attrs *attrs)
> +{
> + void *ret;
> +
> + if (dma_alloc_from_coherent(dev, size, dma_handle, &ret))
> + return ret;
> +
>
Most of the code are copied from arch/mips/cavium-octeon/dma-octeon.c
and they work well.
Anyway, I'll try your suggestions, thank you.
On Tue, Aug 14, 2012 at 1:54 AM, Konrad Rzeszutek Wilk
wrote:
>> +static void *loongson_dma_alloc_coherent(struct device *dev, size_t size,
>> +
Hi, David,
Seems like you are the original author of code in
arch/mips/cavium-octeon/dma-octeon.c. Could you please tell me why we
need mb() in alloc_coherent(), map_page(), map_sg()? It seems like
because of cache coherency (CPU write some data, then map the page for
a device, if without mb(), th
On 08/13/2012 10:57 PM, Huacai Chen wrote:
Hi, David,
Seems like you are the original author of code in
arch/mips/cavium-octeon/dma-octeon.c. Could you please tell me why we
need mb() in alloc_coherent(), map_page(), map_sg()? It seems like
because of cache coherency (CPU write some data, then m
On Tue, Aug 14, 2012 at 1:54 AM, Konrad Rzeszutek Wilk
wrote:
>> +static void *loongson_dma_alloc_coherent(struct device *dev, size_t size,
>> + dma_addr_t *dma_handle, gfp_t gfp, struct
>> dma_attrs *attrs)
>> +{
>> + void *ret;
>> +
>> + if (dma_alloc_from_co
On Mon, Aug 13, 2012 at 01:54:47PM -0400, Konrad Rzeszutek Wilk wrote:
> > +static void *loongson_dma_alloc_coherent(struct device *dev, size_t size,
> > + dma_addr_t *dma_handle, gfp_t gfp, struct
> > dma_attrs *attrs)
> > +{
> > + void *ret;
> > +
> > + if (dma_all
On Thu, Aug 16, 2012 at 4:24 AM, Ralf Baechle wrote:
> On Mon, Aug 13, 2012 at 01:54:47PM -0400, Konrad Rzeszutek Wilk wrote:
>
>> > +static void *loongson_dma_alloc_coherent(struct device *dev, size_t size,
>> > + dma_addr_t *dma_handle, gfp_t gfp, struct
>> > dma_attrs
8 matches
Mail list logo