Hi Vasily,
On 11/28/2012 09:56 AM, Vasily A. Sartakov wrote:
Inspired by article about Genode and Pandaboard, we have tried to turn on L2 cache on same board. Two patches are attached. One of them - new L2 features for foc kernel, extracted from linux and u-boot, the other one - small example for testing cache. This example show increasing performance on memory operations with block sized more then L1. ( We made 4 tests: without L2, block size equal L1, block size equal quarter of L2; with L2 for same blocks) Based on this I make assumption what L2 work correct. But USB host driver is stuck on boot. There were problems of opposition L2 and USB, something has changed?
Very good that you have a look at this tricky problem and cool thing that you found out that one has to use 'smc' calls to program the PL310 controller on Panda board. However this issue is not as trivial as it seems. As you noticed, problems arise when using DMA (like the USB driver). Device drivers that allocate DMA memory need to map this memory uncached. The problem here is that core maps all its RAM from sigma0 as cached memory, there currently is no way to get uncached RAM. So what core does if someone requests an uncached dataspace (see 'alloc' in 'Ram_session'), is to simply map the pages uncached to the client, which is supported by Fiasco.OC. The other thing it does is to clean the L1 cache to make sure that all data is in RAM (see 'base-foc/src/core/ram_session_support.cc'). When the L2 cache is enabled it needs to be cleaned as well. In theory it would suffice to call 'l4_cache_dma_coherent' instead of 'l4_cache_clean_data'. Unfortunately the PL310 on Panda must be programed via these funny 'smc' calls and the implementation for that is missing in Fiasco. What one would have to do, is to implement the 'Outer_cache' interface in Fiasco.OC (see: 'src/kern/arm/outer-cache.cpp'). The interface compromises the 'clean', 'flush', and 'invalidate' functions. We already have some code for rev38, but did not have any time to finish the issue. Maybe you could use https://github.com/skalk/genode/tree/omap4_fb as a starting point, if you want to further investigate this issue. By the way, another possibility to enable the L2 cache is to let U-Boot do it.
Greetings and thanks for your efforts,
Sebastian