1 ============ 2 CPU Features 3 ============ 4 5 Hollis Blanchard <hollis@austin.ibm.com> 6 5 Jun 2002 7 8 This document describes the system (including 9 PPC Linux kernel to support a variety of Power 10 compile-time selection. 11 12 Early in the boot process the ppc32 kernel det 13 chooses a set of features accordingly. Some ex 14 split instruction and data caches, and if the 15 sleep modes. 16 17 Detection of the feature set is simple. A list 18 arch/powerpc/kernel/cputable.c. The PVR regist 19 each value in the list. If a match is found, t 20 is assigned to the feature bitmask for this pr 21 function is called. 22 23 C code may test 'cur_cpu_spec[smp_processor_id 24 particular feature bit. This is done in quite 25 in ppc_setup_l2cr(). 26 27 Implementing cpufeatures in assembly is a litt 28 several paths that are performance-critical an 29 index, structure dereference, and conditional 30 performance penalty but still allow for runtim 31 selection, unused code is replaced by 'nop' in 32 based on CPU 0's capabilities, so a multi-proc 33 processors will not work (but such a system wo 34 anyways). 35 36 After detecting the processor type, the kernel 37 that shouldn't be used by writing nop's over i 38 just 2 macros (found in arch/powerpc/include/a 39 transfer_to_handler:: 40 41 #ifdef CONFIG_ALTIVEC 42 BEGIN_FTR_SECTION 43 mfspr r22,SPRN_VRSAVE 44 stw r22,THREAD_VRSAVE(r23) 45 END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 46 #endif /* CONFIG_ALTIVEC */ 47 48 If CPU 0 supports Altivec, the code is left un 49 instructions are replaced with nop's. 50 51 The END_FTR_SECTION macro has two simpler vari 52 and END_FTR_SECTION_IFCLR. These simply test i 53 cur_cpu_spec[0]->cpu_features) or is cleared, 54 should be used in the majority of cases. 55 56 The END_FTR_SECTION macros are implemented by 57 code in the '__ftr_fixup' ELF section. When do 58 (arch/powerpc/kernel/misc.S) is invoked, it wi 59 __ftr_fixup, and if the required feature is no 60 nop's from each BEGIN_FTR_SECTION to END_FTR_S
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.