On Wed, Dec 9, 2009 at 21:18, Song, Barry wrote:
>From: Mike Frysinger [mailto:[email protected]]
>>On Wed, Dec 2, 2009 at 04:13,  <[email protected]> wrote:
>>> Revision 7906 Author bhsong Date 2009-12-02 04:13:36 -0500
>>>
>>> Log Message
>>>
>>> task [#5723], Enable 128/256k/512k uncacheable DMA memory
>>> region for small memory system
>>>
>>> Modified: trunk/arch/blackfin/kernel/cplb-nompu/cplbinit.c (7905 => 7906)
>>>
>>> @@ -136,10 +146,22 @@
>>>      i_i = 0;
>>>      /* Normal RAM, including MTD FS.  */
>>>  #ifdef CONFIG_MTD_UCLINUX
>>> -    icplb_bounds[i_i].eaddr = memory_mtd_start + mtd_size;
>>> +    /*
>>> +     * While DMA uncache size is 128/256/512KB, we let
>>>icplb cover the whole
>>> 1MB from normal_memory_end & 0xfffff
>>> +     * A bad result is the 128/256/512KB becomes be able to fetch
>>> instrcutions. But in order to protect the area,
>>> +     * we have to manage the area by page size
>>> +     */
>>> +    if (unlikely((memory_mtd_start + mtd_size) & (1 * 1024
>>>* 1024 - 1)))
>>> +            icplb_bounds[i_i].eaddr = ((memory_mtd_start +
>>>mtd_size) & ~(1 * 1024 *
>>> 1024 - 1)) + 1 * 1024 * 1024;
>>> +    else
>>> +            icplb_bounds[i_i].eaddr = memory_mtd_start + mtd_size;
>>>  #else
>>> -    icplb_bounds[i_i].eaddr = memory_end;
>>> +    if (unlikely(memory_end & (1 * 1024 * 1024 - 1)))
>>> +            icplb_bounds[i_i].eaddr = (memory_end & ~(1 *
>>>1024 * 1024 - 1)) + 1 *
>>> 1024 * 1024;
>>> +    else
>>> +            icplb_bounds[i_i].eaddr = memory_end;
>>>  #endif
>>> +
>>>      icplb_bounds[i_i++].data = SDRAM_IGENERIC;
>>>      /* DMA uncached region.  */
>>>      if (DMA_UNCACHED_REGION) {
>>
>>while i can understand the need to change the DCPLB maps, why do we
>>need this for ICPLBs ?  the dma uncached region is reserved for data
>>usage ... we're never going to put instructions in there.
>
> Not exact. If DMA uncache size is less than 1MB, normal memory end will
> not be 1MB aligned. Then the last "1MB - DMA uncached size" will be
> difficult to be covered by any icplb.
> Here we just give more space to normal memory. As I comment, a bad
> result is the 128/256/512KB DMA area becomes be able to fetch
> instrcutions.

i know normal memory wont be exactly aligned.  i'm saying that for the
purposes of icplb's, why do we care.  there shouldnt be an icplb miss
in the uncached region, so simply giving icplb coverage to the whole
thing shouldnt matter.  same goes for the if (DMA_UNCACHED_REGION)
icplb code.  we should simply cover all memory that the kernel is
managing (i.e. everything up to _ramend).
-mike
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to