CPU Support

From LinuxMIPS
Revision as of 13:05, 27 March 2017 by Ralf (talk | contribs) (Link to the new page on the WAIT instruction.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

In the MIPS world, there are different families of MIPS cores. For example Toshiba TX49, SiByte SB1, NEC VR41XX, MIPS32, and MIPS64 to name a few. These different families may have different cache architectures, may be 32-bit or 64-bit, and may or may not have a FP unit. A complete list of families is found in the 'arch/mips/config-shared.in' and 'include/asm-mips/cpu.h' files. When you are configuring your kernel the complete list will appear under the 'CPU type' menu selection. If you are adding support for an entirely new family of MIPS cores, you will need to change the following files:

  • arch/mips/config-shared.in - You will need to add your processor family to the list under 'CPU type'.
  • include/asm-mips/cpu.h - You will need to add a PRID_COMP and PRID_IMP entries for your processor family if they do not already exist. You will also need to then add the CPU types that you will support in that family. Adding CPU types is covered below.
  • arch/mips/kernel/cpu-probe.c - For each processor family, there is typically a cpu_probe_XXX function that probes and fills in the struct cpuinfo_mips which contains information about the CPU type, whether a FP unit exists, the number of TLBs available, etc. Your function is responsible for properly probing and filling in this information for the entire family of processors. Finally, if your family does something special for CPU idle, then you will have to define a 'wait' function. Most likely, you will be able to use one that already exists. If not, add your 'wait' function and enable detection of it in check_wait.
  • arch/mips/mm - If your processor family has a unique cache architecture or anything out of the ordinary, you will need to either add or modify files in this directory.

Within each family of MIPS cores, there are multiple processors. For example, Alchemy processors and Broadcom processors are in the MIPS32 family, the Sibyte 1250 is in the SB1 family, and so on. Once you have decided what family your processor is in, you need to verify that a unique CPU identification exists for it. The 'include/asm-mips/cpu.h' file contains all of the currently supported CPU types for the Linux/MIPS kernel.

If your processor is already listed in the 'include/asm-mips/cpu.h' file, the existing Linux/MIPS code should auto-detect it. If your processor is not listed, you will need to change three files to properly detect your processor:

  • include/asm-mips/cpu.h - Add your processor at the end of the CPU_XXX definitions. Make sure you update the 'CPU_LAST' value to match that of the processor you added.
  • include/asm-mips/mach-<PLAT>/cpu-feature-override.h A file that define a number of flages. This is used to narrow down the CPUs supported by the kernel gaining some size and performance improvments. For details see Cpu features page.
  • arch/mips/kernel/proc.c - Add an entry to the cpu_name array so that your CPU name can be properly displayed in /proc/cpuinfo.
  • arch/mips/kernel/cpu-probe.c - Add your processor into the case statement in the function check_wait if your CPU can do some sort of wait or idle operation. Add the necessary code in the cpu_probe_XX function to detect and set your CPU type.

Once you have support for your processor family and specific CPU type, you should be able to take full advantage of its capabilities.

Next page: Linux Interrupts