[Pixman] [PATCH] MIPS: DSPr2: Basic infrastructure for MIPS architecture

Siarhei Siamashka siarhei.siamashka at gmail.com
Fri Feb 17 08:18:11 PST 2012

On Fri, Feb 17, 2012 at 5:38 PM, Lukic, Nemanja <nlukic at mips.com> wrote:
> Hi Siarhei,
> You are right, "cpu model" line from /proc/cpuinfo for MIPS doesn't provide nearly enough information.
> Main issue with run-time detection of the version of the DSP extensions and (as you pointed out) cache line size, is that this information is stored in status registers, which can't be read from user space (for cache line size, this is CP0 Register 16, Select 1, bits 12:10).
> And this information is not stored in /proc/cpuinfo and there is no system call to determine them either. So, at this point, we are not able to run time distinguish between DSPr1 and DSPr2, and retrieve cache line size.

Sorry for not being clear enough earlier.

What I mean is that according MIPS website [1] and pdf documents, 74K
always has 32 bytes cache line. Also if it has DSP ASE support (is it
optional or mandatory for 74K?), then it is likely DSPr2 and not
DSPr1. So if we find "MIPS 74K" substring in /proc/cpuinfo, then we
can be reasonably sure that your assembly optimizations will work
correctly on it. I guess it is possible to check all the MIPS cores
known by "arch/mips/kernel/cpu-probe.c" [2], make a list of the ones
which do support DSPr2 instructions and use this list in pixman
runtime detection code. Cache line sizes can be stored in this list
too. Yes, this is ugly, and can be used only a stop gap measure until
the kernel gets updated to provide the necessary information.

BTW, the information reported by the kernel used to be not perfect for
ARM either, see [3] and [4]. But now this is fixed. The MIPS case is
better, because we don't even have to make any wrong assumptions if I
understand it correctly. Just the code gets ugly. But on a positive
side, showing this ugly code to the kernel people could probably
convince them that they are really lacking some necessary information
in /proc/cpuinfo ;)

Runtime detection may be useful because I read on the news that some
MIPS based Android tablets are going to use Ingenic JZ4770 SoC [5].
Yay for the "Ingenic’s own extension of SIMD instruction set". Looks
like there is no agreement between MIPS vendors about what kind of
SIMD ISA is preferable and this is going to be a big mess.

1. http://www.mips.com/products/cores/32-64-bit-cores/mips32-74k/
2. http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=arch/mips/kernel/cpu-probe.c;h=0bab464b8e33be322e64dacc1263189c71dbb1ac;hb=d65b4e98d7ea3038b767b70fe8be959b2913f16d#l831
3. http://cgit.freedesktop.org/pixman/tree/pixman/pixman-pict.c?id=f2af00bf02dcf3e7e27ac3e035d41c387fc9400b#n2330
4. http://cgit.freedesktop.org/pixman/commit/?id=cf1f034fef34478c528bedf1e59be443fa72429c
5. http://en.ingenic.cn/product.aspx?CID=9

Best regards,
Siarhei Siamashka

More information about the Pixman mailing list