Hi Siarhei, Yes, 74Kc core has 32 byte cache line size, and it has DSPr2 extensions (it is mandatory). I changed original patch, to search only for "MIPS 74Kc" string in the /proc/cpuinfo since this is (for now, until 1074Kc, M14KE, and other cores become available) only MIPS core that does support DSPr2 extensions. With the run-time detection set this way, we are sure that we are running on the platform that supports all of the MIPS related optimizations. One thing I did notice is that some vendors (like Broadcom) have their own version of the /proc/cpuinfo description, where they don't mention at all on which MIPS core these platforms are based on (this will consequently prevent MIPS optimization although they are available for use).
Best Regards, Nemanja Lukic -----Original Message----- From: Siarhei Siamashka [mailto:siarhei.siamas...@gmail.com] Sent: Friday, February 17, 2012 5:18 PM To: Lukic, Nemanja Cc: Søren Sandmann; pixman@lists.freedesktop.org Subject: Re: [Pixman] [PATCH] MIPS: DSPr2: Basic infrastructure for MIPS architecture On Fri, Feb 17, 2012 at 5:38 PM, Lukic, Nemanja <nlu...@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 _______________________________________________ Pixman mailing list Pixman@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pixman