Merge branch 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6

* 'for-linus' of git://one.firstfloor.org/home/andi/git/linux-2.6: (225 commits)
[PATCH] Don't set calgary iommu as default y
[PATCH] i386/x86-64: New Intel feature flags
[PATCH] x86: Add a cumulative thermal throttle event counter.
[PATCH] i386: Make the jiffies compares use the 64bit safe macros.
[PATCH] x86: Refactor thermal throttle processing
[PATCH] Add 64bit jiffies compares (for use with get_jiffies_64)
[PATCH] Fix unwinder warning in traps.c
[PATCH] x86: Allow disabling early pci scans with pci=noearly or disallowing conf1
[PATCH] x86: Move direct PCI scanning functions out of line
[PATCH] i386/x86-64: Make all early PCI scans dependent on CONFIG_PCI
[PATCH] Don't leak NT bit into next task
[PATCH] i386/x86-64: Work around gcc bug with noreturn functions in unwinder
[PATCH] Fix some broken white space in ia32_signal.c
[PATCH] Initialize argument registers for 32bit signal handlers.
[PATCH] Remove all traces of signal number conversion
[PATCH] Don't synchronize time reading on single core AMD systems
[PATCH] Remove outdated comment in x86-64 mmconfig code
[PATCH] Use string instructions for Core2 copy/clear
[PATCH] x86: - restore i8259A eoi status on resume
[PATCH] i386: Split multi-line printk in oops output.
...

+6923 -5320
+2 -1
Documentation/HOWTO
··· 358 358 quilt trees: 359 359 - USB, PCI, Driver Core, and I2C, Greg Kroah-Hartman <gregkh@suse.de> 360 360 kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ 361 - 361 + - x86-64, partly i386, Andi Kleen <ak@suse.de> 362 + ftp.firstfloor.org:/pub/ak/x86_64/quilt/ 362 363 363 364 Bug Reporting 364 365 -------------
+9 -5
Documentation/filesystems/proc.txt
··· 1124 1124 NMI switch that most IA32 servers have fires unknown NMI up, for example. 1125 1125 If a system hangs up, try pressing the NMI switch. 1126 1126 1127 - [NOTE] 1128 - This function and oprofile share a NMI callback. Therefore this function 1129 - cannot be enabled when oprofile is activated. 1130 - And NMI watchdog will be disabled when the value in this file is set to 1131 - non-zero. 1127 + nmi_watchdog 1128 + ------------ 1129 + 1130 + Enables/Disables the NMI watchdog on x86 systems. When the value is non-zero 1131 + the NMI watchdog is enabled and will continuously test all online cpus to 1132 + determine whether or not they are still functioning properly. 1133 + 1134 + Because the NMI watchdog shares registers with oprofile, by disabling the NMI 1135 + watchdog, oprofile may have more registers to utilize. 1132 1136 1133 1137 1134 1138 2.4 /proc/sys/vm - The virtual memory subsystem
+5
Documentation/kbuild/makefiles.txt
··· 421 421 The second argument is optional, and if supplied will be used 422 422 if first argument is not supported. 423 423 424 + as-instr 425 + as-instr checks if the assembler reports a specific instruction 426 + and then outputs either option1 or option2 427 + C escapes are supported in the test instruction 428 + 424 429 cc-option 425 430 cc-option is used to check if $(CC) supports a given option, and not 426 431 supported to use an optional second option.
+5 -1
Documentation/kernel-parameters.txt
··· 1240 1240 bootloader. This is currently used on 1241 1241 IXP2000 systems where the bus has to be 1242 1242 configured a certain way for adjunct CPUs. 1243 - 1243 + noearly [X86] Don't do any early type 1 scanning. 1244 + This might help on some broken boards which 1245 + machine check when some devices' config space 1246 + is read. But various workarounds are disabled 1247 + and some IOMMU drivers will not work. 1244 1248 pcmv= [HW,PCMCIA] BadgePAD 4 1245 1249 1246 1250 pd. [PARIDE]
+7
Documentation/x86_64/boot-options.txt
··· 245 245 newfallback: use new unwinder but fall back to old if it gets 246 246 stuck (default) 247 247 248 + call_trace=[old|both|newfallback|new] 249 + old: use old inexact backtracer 250 + new: use new exact dwarf2 unwinder 251 + both: print entries from both 252 + newfallback: use new unwinder but fall back to old if it gets 253 + stuck (default) 254 + 248 255 Misc 249 256 250 257 noreplacement Don't replace instructions with more appropriate ones
+99
Documentation/x86_64/kernel-stacks
··· 1 + Most of the text from Keith Owens, hacked by AK 2 + 3 + x86_64 page size (PAGE_SIZE) is 4K. 4 + 5 + Like all other architectures, x86_64 has a kernel stack for every 6 + active thread. These thread stacks are THREAD_SIZE (2*PAGE_SIZE) big. 7 + These stacks contain useful data as long as a thread is alive or a 8 + zombie. While the thread is in user space the kernel stack is empty 9 + except for the thread_info structure at the bottom. 10 + 11 + In addition to the per thread stacks, there are specialized stacks 12 + associated with each cpu. These stacks are only used while the kernel 13 + is in control on that cpu, when a cpu returns to user space the 14 + specialized stacks contain no useful data. The main cpu stacks is 15 + 16 + * Interrupt stack. IRQSTACKSIZE 17 + 18 + Used for external hardware interrupts. If this is the first external 19 + hardware interrupt (i.e. not a nested hardware interrupt) then the 20 + kernel switches from the current task to the interrupt stack. Like 21 + the split thread and interrupt stacks on i386 (with CONFIG_4KSTACKS), 22 + this gives more room for kernel interrupt processing without having 23 + to increase the size of every per thread stack. 24 + 25 + The interrupt stack is also used when processing a softirq. 26 + 27 + Switching to the kernel interrupt stack is done by software based on a 28 + per CPU interrupt nest counter. This is needed because x86-64 "IST" 29 + hardware stacks cannot nest without races. 30 + 31 + x86_64 also has a feature which is not available on i386, the ability 32 + to automatically switch to a new stack for designated events such as 33 + double fault or NMI, which makes it easier to handle these unusual 34 + events on x86_64. This feature is called the Interrupt Stack Table 35 + (IST). There can be up to 7 IST entries per cpu. The IST code is an 36 + index into the Task State Segment (TSS), the IST entries in the TSS 37 + point to dedicated stacks, each stack can be a different size. 38 + 39 + An IST is selected by an non-zero value in the IST field of an 40 + interrupt-gate descriptor. When an interrupt occurs and the hardware 41 + loads such a descriptor, the hardware automatically sets the new stack 42 + pointer based on the IST value, then invokes the interrupt handler. If 43 + software wants to allow nested IST interrupts then the handler must 44 + adjust the IST values on entry to and exit from the interrupt handler. 45 + (this is occasionally done, e.g. for debug exceptions) 46 + 47 + Events with different IST codes (i.e. with different stacks) can be 48 + nested. For example, a debug interrupt can safely be interrupted by an 49 + NMI. arch/x86_64/kernel/entry.S::paranoidentry adjusts the stack 50 + pointers on entry to and exit from all IST events, in theory allowing 51 + IST events with the same code to be nested. However in most cases, the 52 + stack size allocated to an IST assumes no nesting for the same code. 53 + If that assumption is ever broken then the stacks will become corrupt. 54 + 55 + The currently assigned IST stacks are :- 56 + 57 + * STACKFAULT_STACK. EXCEPTION_STKSZ (PAGE_SIZE). 58 + 59 + Used for interrupt 12 - Stack Fault Exception (#SS). 60 + 61 + This allows to recover from invalid stack segments. Rarely 62 + happens. 63 + 64 + * DOUBLEFAULT_STACK. EXCEPTION_STKSZ (PAGE_SIZE). 65 + 66 + Used for interrupt 8 - Double Fault Exception (#DF). 67 + 68 + Invoked when handling a exception causes another exception. Happens 69 + when the kernel is very confused (e.g. kernel stack pointer corrupt) 70 + Using a separate stack allows to recover from it well enough in many 71 + cases to still output an oops. 72 + 73 + * NMI_STACK. EXCEPTION_STKSZ (PAGE_SIZE). 74 + 75 + Used for non-maskable interrupts (NMI). 76 + 77 + NMI can be delivered at any time, including when the kernel is in the 78 + middle of switching stacks. Using IST for NMI events avoids making 79 + assumptions about the previous state of the kernel stack. 80 + 81 + * DEBUG_STACK. DEBUG_STKSZ 82 + 83 + Used for hardware debug interrupts (interrupt 1) and for software 84 + debug interrupts (INT3). 85 + 86 + When debugging a kernel, debug interrupts (both hardware and 87 + software) can occur at any time. Using IST for these interrupts 88 + avoids making assumptions about the previous state of the kernel 89 + stack. 90 + 91 + * MCE_STACK. EXCEPTION_STKSZ (PAGE_SIZE). 92 + 93 + Used for interrupt 18 - Machine Check Exception (#MC). 94 + 95 + MCE can be delivered at any time, including when the kernel is in the 96 + middle of switching stacks. Using IST for MCE events avoids making 97 + assumptions about the previous state of the kernel stack. 98 + 99 + For more details see the Intel IA32 or AMD AMD64 architecture manuals.
+11 -6
arch/i386/Kconfig
··· 166 166 167 167 config X86_GENERICARCH 168 168 bool "Generic architecture (Summit, bigsmp, ES7000, default)" 169 - depends on SMP 170 169 help 171 170 This option compiles in the Summit, bigsmp, ES7000, default subarchitectures. 172 171 It is intended for a generic binary kernel. ··· 262 263 263 264 config X86_UP_APIC 264 265 bool "Local APIC support on uniprocessors" 265 - depends on !SMP && !(X86_VISWS || X86_VOYAGER) 266 + depends on !SMP && !(X86_VISWS || X86_VOYAGER || X86_GENERICARCH) 266 267 help 267 268 A local APIC (Advanced Programmable Interrupt Controller) is an 268 269 integrated interrupt controller in the CPU. If you have a single-CPU ··· 287 288 288 289 config X86_LOCAL_APIC 289 290 bool 290 - depends on X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER) 291 + depends on X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER) || X86_GENERICARCH 291 292 default y 292 293 293 294 config X86_IO_APIC 294 295 bool 295 - depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER)) 296 + depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER)) || X86_GENERICARCH 296 297 default y 297 298 298 299 config X86_VISWS_APIC ··· 740 741 source kernel/Kconfig.hz 741 742 742 743 config KEXEC 743 - bool "kexec system call (EXPERIMENTAL)" 744 - depends on EXPERIMENTAL 744 + bool "kexec system call" 745 745 help 746 746 kexec is a system call that implements the ability to shutdown your 747 747 current kernel, and to start another kernel. It is like a reboot ··· 761 763 depends on HIGHMEM 762 764 help 763 765 Generate crash dump after being started by kexec. 766 + This should be normally only set in special crash dump kernels 767 + which are loaded in the main kernel with kexec-tools into 768 + a specially reserved region and then later executed after 769 + a crash by kdump/kexec. The crash dump kernel must be compiled 770 + to a memory address not used by the main kernel or BIOS using 771 + PHYSICAL_START. 772 + For more details see Documentation/kdump/kdump.txt 764 773 765 774 config PHYSICAL_START 766 775 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP)
+8
arch/i386/Makefile
··· 46 46 # a lot more stack due to the lack of sharing of stacklots: 47 47 CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call cc-option,-fno-unit-at-a-time); fi ;) 48 48 49 + # do binutils support CFI? 50 + cflags-y += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 51 + AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 52 + 53 + # is .cfi_signal_frame supported too? 54 + cflags-y += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 55 + AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 56 + 49 57 CFLAGS += $(cflags-y) 50 58 51 59 # Default subarch .c files
+75 -22
arch/i386/boot/edd.S
··· 15 15 #include <asm/setup.h> 16 16 17 17 #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) 18 + 19 + # It is assumed that %ds == INITSEG here 20 + 18 21 movb $0, (EDD_MBR_SIG_NR_BUF) 19 22 movb $0, (EDDNR) 20 23 21 - # Check the command line for two options: 24 + # Check the command line for options: 22 25 # edd=of disables EDD completely (edd=off) 23 26 # edd=sk skips the MBR test (edd=skipmbr) 27 + # edd=on re-enables EDD (edd=on) 28 + 24 29 pushl %esi 25 - cmpl $0, %cs:cmd_line_ptr 26 - jz done_cl 30 + movw $edd_mbr_sig_start, %di # Default to edd=on 31 + 27 32 movl %cs:(cmd_line_ptr), %esi 28 - # ds:esi has the pointer to the command line now 29 - movl $(COMMAND_LINE_SIZE-7), %ecx 30 - # loop through kernel command line one byte at a time 31 - cl_loop: 32 - cmpl $EDD_CL_EQUALS, (%si) 33 + andl %esi, %esi 34 + jz old_cl # Old boot protocol? 35 + 36 + # Convert to a real-mode pointer in fs:si 37 + movl %esi, %eax 38 + shrl $4, %eax 39 + movw %ax, %fs 40 + andw $0xf, %si 41 + jmp have_cl_pointer 42 + 43 + # Old-style boot protocol? 44 + old_cl: 45 + push %ds # aka INITSEG 46 + pop %fs 47 + 48 + cmpw $0xa33f, (0x20) 49 + jne done_cl # No command line at all? 50 + movw (0x22), %si # Pointer relative to INITSEG 51 + 52 + # fs:si has the pointer to the command line now 53 + have_cl_pointer: 54 + 55 + # Loop through kernel command line one byte at a time. Just in 56 + # case the loader is buggy and failed to null-terminate the command line 57 + # terminate if we get close enough to the end of the segment that we 58 + # cannot fit "edd=XX"... 59 + cl_atspace: 60 + cmpw $-5, %si # Watch for segment wraparound 61 + jae done_cl 62 + movl %fs:(%si), %eax 63 + andb %al, %al # End of line? 64 + jz done_cl 65 + cmpl $EDD_CL_EQUALS, %eax 33 66 jz found_edd_equals 34 - incl %esi 35 - loop cl_loop 36 - jmp done_cl 67 + cmpb $0x20, %al # <= space consider whitespace 68 + ja cl_skipword 69 + incw %si 70 + jmp cl_atspace 71 + 72 + cl_skipword: 73 + cmpw $-5, %si # Watch for segment wraparound 74 + jae done_cl 75 + movb %fs:(%si), %al # End of string? 76 + andb %al, %al 77 + jz done_cl 78 + cmpb $0x20, %al 79 + jbe cl_atspace 80 + incw %si 81 + jmp cl_skipword 82 + 37 83 found_edd_equals: 38 84 # only looking at first two characters after equals 39 - addl $4, %esi 40 - cmpw $EDD_CL_OFF, (%si) # edd=of 41 - jz do_edd_off 42 - cmpw $EDD_CL_SKIP, (%si) # edd=sk 43 - jz do_edd_skipmbr 44 - jmp done_cl 85 + # late overrides early on the command line, so keep going after finding something 86 + movw %fs:4(%si), %ax 87 + cmpw $EDD_CL_OFF, %ax # edd=of 88 + je do_edd_off 89 + cmpw $EDD_CL_SKIP, %ax # edd=sk 90 + je do_edd_skipmbr 91 + cmpw $EDD_CL_ON, %ax # edd=on 92 + je do_edd_on 93 + jmp cl_skipword 45 94 do_edd_skipmbr: 46 - popl %esi 47 - jmp edd_start 95 + movw $edd_start, %di 96 + jmp cl_skipword 48 97 do_edd_off: 49 - popl %esi 50 - jmp edd_done 98 + movw $edd_done, %di 99 + jmp cl_skipword 100 + do_edd_on: 101 + movw $edd_mbr_sig_start, %di 102 + jmp cl_skipword 103 + 51 104 done_cl: 52 105 popl %esi 53 - 106 + jmpw *%di 54 107 55 108 # Read the first sector of each BIOS disk device and store the 4-byte signature 56 109 edd_mbr_sig_start:
+2 -2
arch/i386/boot/setup.S
··· 494 494 movw %cs, %ax # aka SETUPSEG 495 495 subw $DELTA_INITSEG, %ax # aka INITSEG 496 496 movw %ax, %ds 497 - movw $0, (0x1ff) # default is no pointing device 497 + movb $0, (0x1ff) # default is no pointing device 498 498 int $0x11 # int 0x11: equipment list 499 499 testb $0x04, %al # check if mouse installed 500 500 jz no_psmouse 501 501 502 - movw $0xAA, (0x1ff) # device present 502 + movb $0xAA, (0x1ff) # device present 503 503 no_psmouse: 504 504 505 505 #if defined(CONFIG_X86_SPEEDSTEP_SMI) || defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
+501 -562
arch/i386/defconfig
··· 1 1 # 2 2 # Automatically generated make config: don't edit 3 + # Linux kernel version: 2.6.18-git5 4 + # Tue Sep 26 09:30:47 2006 3 5 # 4 6 CONFIG_X86_32=y 7 + CONFIG_GENERIC_TIME=y 8 + CONFIG_LOCKDEP_SUPPORT=y 9 + CONFIG_STACKTRACE_SUPPORT=y 5 10 CONFIG_SEMAPHORE_SLEEPERS=y 6 11 CONFIG_X86=y 7 12 CONFIG_MMU=y 8 13 CONFIG_GENERIC_ISA_DMA=y 9 14 CONFIG_GENERIC_IOMAP=y 15 + CONFIG_GENERIC_HWEIGHT=y 10 16 CONFIG_ARCH_MAY_HAVE_PC_FDC=y 11 17 CONFIG_DMI=y 18 + CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 12 19 13 20 # 14 21 # Code maturity level options 15 22 # 16 23 CONFIG_EXPERIMENTAL=y 17 - CONFIG_BROKEN_ON_SMP=y 24 + CONFIG_LOCK_KERNEL=y 18 25 CONFIG_INIT_ENV_ARG_LIMIT=32 19 26 20 27 # 21 28 # General setup 22 29 # 23 30 CONFIG_LOCALVERSION="" 24 - # CONFIG_LOCALVERSION_AUTO is not set 31 + CONFIG_LOCALVERSION_AUTO=y 25 32 CONFIG_SWAP=y 26 33 CONFIG_SYSVIPC=y 27 - # CONFIG_POSIX_MQUEUE is not set 34 + CONFIG_POSIX_MQUEUE=y 28 35 # CONFIG_BSD_PROCESS_ACCT is not set 29 - CONFIG_SYSCTL=y 36 + # CONFIG_TASKSTATS is not set 30 37 # CONFIG_AUDIT is not set 31 38 CONFIG_IKCONFIG=y 32 39 CONFIG_IKCONFIG_PROC=y 40 + # CONFIG_CPUSETS is not set 41 + # CONFIG_RELAY is not set 33 42 CONFIG_INITRAMFS_SOURCE="" 34 - CONFIG_UID16=y 35 - CONFIG_VM86=y 36 43 CONFIG_CC_OPTIMIZE_FOR_SIZE=y 37 44 # CONFIG_EMBEDDED is not set 45 + CONFIG_UID16=y 46 + CONFIG_SYSCTL=y 38 47 CONFIG_KALLSYMS=y 48 + CONFIG_KALLSYMS_ALL=y 39 49 # CONFIG_KALLSYMS_EXTRA_PASS is not set 40 50 CONFIG_HOTPLUG=y 41 51 CONFIG_PRINTK=y ··· 55 45 CONFIG_FUTEX=y 56 46 CONFIG_EPOLL=y 57 47 CONFIG_SHMEM=y 58 - CONFIG_CC_ALIGN_FUNCTIONS=0 59 - CONFIG_CC_ALIGN_LABELS=0 60 - CONFIG_CC_ALIGN_LOOPS=0 61 - CONFIG_CC_ALIGN_JUMPS=0 62 48 CONFIG_SLAB=y 49 + CONFIG_VM_EVENT_COUNTERS=y 50 + CONFIG_RT_MUTEXES=y 63 51 # CONFIG_TINY_SHMEM is not set 64 52 CONFIG_BASE_SMALL=0 65 53 # CONFIG_SLOB is not set ··· 68 60 CONFIG_MODULES=y 69 61 CONFIG_MODULE_UNLOAD=y 70 62 CONFIG_MODULE_FORCE_UNLOAD=y 71 - CONFIG_OBSOLETE_MODPARM=y 72 63 # CONFIG_MODVERSIONS is not set 73 64 # CONFIG_MODULE_SRCVERSION_ALL is not set 74 65 # CONFIG_KMOD is not set 66 + CONFIG_STOP_MACHINE=y 75 67 76 68 # 77 69 # Block layer 78 70 # 79 - # CONFIG_LBD is not set 71 + CONFIG_LBD=y 72 + # CONFIG_BLK_DEV_IO_TRACE is not set 73 + # CONFIG_LSF is not set 80 74 81 75 # 82 76 # IO Schedulers 83 77 # 84 78 CONFIG_IOSCHED_NOOP=y 85 - # CONFIG_IOSCHED_AS is not set 86 - # CONFIG_IOSCHED_DEADLINE is not set 79 + CONFIG_IOSCHED_AS=y 80 + CONFIG_IOSCHED_DEADLINE=y 87 81 CONFIG_IOSCHED_CFQ=y 88 - # CONFIG_DEFAULT_AS is not set 82 + CONFIG_DEFAULT_AS=y 89 83 # CONFIG_DEFAULT_DEADLINE is not set 90 - CONFIG_DEFAULT_CFQ=y 84 + # CONFIG_DEFAULT_CFQ is not set 91 85 # CONFIG_DEFAULT_NOOP is not set 92 - CONFIG_DEFAULT_IOSCHED="cfq" 86 + CONFIG_DEFAULT_IOSCHED="anticipatory" 93 87 94 88 # 95 89 # Processor type and features 96 90 # 97 - CONFIG_X86_PC=y 91 + CONFIG_SMP=y 92 + # CONFIG_X86_PC is not set 98 93 # CONFIG_X86_ELAN is not set 99 94 # CONFIG_X86_VOYAGER is not set 100 95 # CONFIG_X86_NUMAQ is not set 101 96 # CONFIG_X86_SUMMIT is not set 102 97 # CONFIG_X86_BIGSMP is not set 103 98 # CONFIG_X86_VISWS is not set 104 - # CONFIG_X86_GENERICARCH is not set 99 + CONFIG_X86_GENERICARCH=y 105 100 # CONFIG_X86_ES7000 is not set 101 + CONFIG_X86_CYCLONE_TIMER=y 106 102 # CONFIG_M386 is not set 107 103 # CONFIG_M486 is not set 108 104 # CONFIG_M586 is not set ··· 114 102 # CONFIG_M586MMX is not set 115 103 # CONFIG_M686 is not set 116 104 # CONFIG_MPENTIUMII is not set 117 - # CONFIG_MPENTIUMIII is not set 105 + CONFIG_MPENTIUMIII=y 118 106 # CONFIG_MPENTIUMM is not set 119 107 # CONFIG_MPENTIUM4 is not set 120 108 # CONFIG_MK6 is not set 121 - CONFIG_MK7=y 109 + # CONFIG_MK7 is not set 122 110 # CONFIG_MK8 is not set 123 111 # CONFIG_MCRUSOE is not set 124 112 # CONFIG_MEFFICEON is not set ··· 129 117 # CONFIG_MGEODE_LX is not set 130 118 # CONFIG_MCYRIXIII is not set 131 119 # CONFIG_MVIAC3_2 is not set 132 - # CONFIG_X86_GENERIC is not set 120 + CONFIG_X86_GENERIC=y 133 121 CONFIG_X86_CMPXCHG=y 134 122 CONFIG_X86_XADD=y 135 - CONFIG_X86_L1_CACHE_SHIFT=6 123 + CONFIG_X86_L1_CACHE_SHIFT=7 136 124 CONFIG_RWSEM_XCHGADD_ALGORITHM=y 137 125 CONFIG_GENERIC_CALIBRATE_DELAY=y 138 126 CONFIG_X86_WP_WORKS_OK=y ··· 143 131 CONFIG_X86_GOOD_APIC=y 144 132 CONFIG_X86_INTEL_USERCOPY=y 145 133 CONFIG_X86_USE_PPRO_CHECKSUM=y 146 - CONFIG_X86_USE_3DNOW=y 147 134 CONFIG_X86_TSC=y 148 - # CONFIG_HPET_TIMER is not set 149 - # CONFIG_SMP is not set 150 - CONFIG_PREEMPT_NONE=y 151 - # CONFIG_PREEMPT_VOLUNTARY is not set 135 + CONFIG_HPET_TIMER=y 136 + CONFIG_HPET_EMULATE_RTC=y 137 + CONFIG_NR_CPUS=32 138 + CONFIG_SCHED_SMT=y 139 + CONFIG_SCHED_MC=y 140 + # CONFIG_PREEMPT_NONE is not set 141 + CONFIG_PREEMPT_VOLUNTARY=y 152 142 # CONFIG_PREEMPT is not set 153 - CONFIG_X86_UP_APIC=y 154 - CONFIG_X86_UP_IOAPIC=y 143 + CONFIG_PREEMPT_BKL=y 155 144 CONFIG_X86_LOCAL_APIC=y 156 145 CONFIG_X86_IO_APIC=y 157 146 CONFIG_X86_MCE=y 158 147 CONFIG_X86_MCE_NONFATAL=y 159 - # CONFIG_X86_MCE_P4THERMAL is not set 148 + CONFIG_X86_MCE_P4THERMAL=y 149 + CONFIG_VM86=y 160 150 # CONFIG_TOSHIBA is not set 161 151 # CONFIG_I8K is not set 162 152 # CONFIG_X86_REBOOTFIXUPS is not set 163 - # CONFIG_MICROCODE is not set 164 - # CONFIG_X86_MSR is not set 165 - # CONFIG_X86_CPUID is not set 153 + CONFIG_MICROCODE=y 154 + CONFIG_X86_MSR=y 155 + CONFIG_X86_CPUID=y 166 156 167 157 # 168 158 # Firmware Drivers ··· 172 158 # CONFIG_EDD is not set 173 159 # CONFIG_DELL_RBU is not set 174 160 # CONFIG_DCDBAS is not set 175 - CONFIG_NOHIGHMEM=y 176 - # CONFIG_HIGHMEM4G is not set 161 + # CONFIG_NOHIGHMEM is not set 162 + CONFIG_HIGHMEM4G=y 177 163 # CONFIG_HIGHMEM64G is not set 178 - CONFIG_VMSPLIT_3G=y 179 - # CONFIG_VMSPLIT_3G_OPT is not set 180 - # CONFIG_VMSPLIT_2G is not set 181 - # CONFIG_VMSPLIT_1G is not set 182 164 CONFIG_PAGE_OFFSET=0xC0000000 183 - CONFIG_ARCH_FLATMEM_ENABLE=y 184 - CONFIG_ARCH_SPARSEMEM_ENABLE=y 185 - CONFIG_ARCH_SELECT_MEMORY_MODEL=y 165 + CONFIG_HIGHMEM=y 186 166 CONFIG_SELECT_MEMORY_MODEL=y 187 167 CONFIG_FLATMEM_MANUAL=y 188 168 # CONFIG_DISCONTIGMEM_MANUAL is not set 189 169 # CONFIG_SPARSEMEM_MANUAL is not set 190 170 CONFIG_FLATMEM=y 191 171 CONFIG_FLAT_NODE_MEM_MAP=y 192 - CONFIG_SPARSEMEM_STATIC=y 172 + # CONFIG_SPARSEMEM_STATIC is not set 193 173 CONFIG_SPLIT_PTLOCK_CPUS=4 174 + CONFIG_RESOURCES_64BIT=y 175 + # CONFIG_HIGHPTE is not set 194 176 # CONFIG_MATH_EMULATION is not set 195 177 CONFIG_MTRR=y 196 178 # CONFIG_EFI is not set 179 + # CONFIG_IRQBALANCE is not set 197 180 CONFIG_REGPARM=y 198 - # CONFIG_SECCOMP is not set 199 - CONFIG_HZ_100=y 200 - # CONFIG_HZ_250 is not set 181 + CONFIG_SECCOMP=y 182 + # CONFIG_HZ_100 is not set 183 + CONFIG_HZ_250=y 201 184 # CONFIG_HZ_1000 is not set 202 - CONFIG_HZ=100 185 + CONFIG_HZ=250 203 186 # CONFIG_KEXEC is not set 187 + # CONFIG_CRASH_DUMP is not set 204 188 CONFIG_PHYSICAL_START=0x100000 205 - CONFIG_DOUBLEFAULT=y 189 + # CONFIG_HOTPLUG_CPU is not set 190 + CONFIG_COMPAT_VDSO=y 191 + CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 206 192 207 193 # 208 194 # Power management options (ACPI, APM) 209 195 # 210 196 CONFIG_PM=y 211 - # CONFIG_PM_LEGACY is not set 197 + CONFIG_PM_LEGACY=y 212 198 # CONFIG_PM_DEBUG is not set 213 - CONFIG_SOFTWARE_SUSPEND=y 214 - CONFIG_PM_STD_PARTITION="" 215 199 216 200 # 217 201 # ACPI (Advanced Configuration and Power Interface) Support 218 202 # 219 203 CONFIG_ACPI=y 220 - # CONFIG_ACPI_SLEEP is not set 221 - # CONFIG_ACPI_AC is not set 222 - # CONFIG_ACPI_BATTERY is not set 223 - # CONFIG_ACPI_BUTTON is not set 204 + CONFIG_ACPI_AC=y 205 + CONFIG_ACPI_BATTERY=y 206 + CONFIG_ACPI_BUTTON=y 224 207 # CONFIG_ACPI_VIDEO is not set 225 208 # CONFIG_ACPI_HOTKEY is not set 226 - # CONFIG_ACPI_FAN is not set 227 - # CONFIG_ACPI_PROCESSOR is not set 209 + CONFIG_ACPI_FAN=y 210 + # CONFIG_ACPI_DOCK is not set 211 + CONFIG_ACPI_PROCESSOR=y 212 + CONFIG_ACPI_THERMAL=y 228 213 # CONFIG_ACPI_ASUS is not set 229 214 # CONFIG_ACPI_IBM is not set 230 215 # CONFIG_ACPI_TOSHIBA is not set 231 - CONFIG_ACPI_BLACKLIST_YEAR=0 232 - # CONFIG_ACPI_DEBUG is not set 216 + CONFIG_ACPI_BLACKLIST_YEAR=2001 217 + CONFIG_ACPI_DEBUG=y 233 218 CONFIG_ACPI_EC=y 234 219 CONFIG_ACPI_POWER=y 235 220 CONFIG_ACPI_SYSTEM=y 236 - # CONFIG_X86_PM_TIMER is not set 221 + CONFIG_X86_PM_TIMER=y 237 222 # CONFIG_ACPI_CONTAINER is not set 238 223 239 224 # ··· 243 230 # 244 231 # CPU Frequency scaling 245 232 # 246 - # CONFIG_CPU_FREQ is not set 233 + CONFIG_CPU_FREQ=y 234 + CONFIG_CPU_FREQ_TABLE=y 235 + CONFIG_CPU_FREQ_DEBUG=y 236 + CONFIG_CPU_FREQ_STAT=y 237 + # CONFIG_CPU_FREQ_STAT_DETAILS is not set 238 + CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 239 + # CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 240 + CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 241 + # CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 242 + CONFIG_CPU_FREQ_GOV_USERSPACE=y 243 + CONFIG_CPU_FREQ_GOV_ONDEMAND=y 244 + # CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set 245 + 246 + # 247 + # CPUFreq processor drivers 248 + # 249 + CONFIG_X86_ACPI_CPUFREQ=y 250 + # CONFIG_X86_POWERNOW_K6 is not set 251 + # CONFIG_X86_POWERNOW_K7 is not set 252 + CONFIG_X86_POWERNOW_K8=y 253 + CONFIG_X86_POWERNOW_K8_ACPI=y 254 + # CONFIG_X86_GX_SUSPMOD is not set 255 + # CONFIG_X86_SPEEDSTEP_CENTRINO is not set 256 + # CONFIG_X86_SPEEDSTEP_ICH is not set 257 + # CONFIG_X86_SPEEDSTEP_SMI is not set 258 + # CONFIG_X86_P4_CLOCKMOD is not set 259 + # CONFIG_X86_CPUFREQ_NFORCE2 is not set 260 + # CONFIG_X86_LONGRUN is not set 261 + # CONFIG_X86_LONGHAUL is not set 262 + 263 + # 264 + # shared options 265 + # 266 + CONFIG_X86_ACPI_CPUFREQ_PROC_INTF=y 267 + # CONFIG_X86_SPEEDSTEP_LIB is not set 247 268 248 269 # 249 270 # Bus options (PCI, PCMCIA, EISA, MCA, ISA) ··· 291 244 CONFIG_PCI_DIRECT=y 292 245 CONFIG_PCI_MMCONFIG=y 293 246 # CONFIG_PCIEPORTBUS is not set 294 - # CONFIG_PCI_MSI is not set 295 - # CONFIG_PCI_LEGACY_PROC is not set 247 + CONFIG_PCI_MSI=y 248 + # CONFIG_PCI_DEBUG is not set 296 249 CONFIG_ISA_DMA_API=y 297 250 # CONFIG_ISA is not set 298 251 # CONFIG_MCA is not set 299 252 # CONFIG_SCx200 is not set 253 + CONFIG_K8_NB=y 300 254 301 255 # 302 256 # PCCARD (PCMCIA/CardBus) support ··· 326 278 # 327 279 # CONFIG_NETDEBUG is not set 328 280 CONFIG_PACKET=y 329 - CONFIG_PACKET_MMAP=y 281 + # CONFIG_PACKET_MMAP is not set 330 282 CONFIG_UNIX=y 283 + CONFIG_XFRM=y 284 + # CONFIG_XFRM_USER is not set 285 + # CONFIG_XFRM_SUB_POLICY is not set 331 286 # CONFIG_NET_KEY is not set 332 287 CONFIG_INET=y 333 - # CONFIG_IP_MULTICAST is not set 288 + CONFIG_IP_MULTICAST=y 334 289 # CONFIG_IP_ADVANCED_ROUTER is not set 335 290 CONFIG_IP_FIB_HASH=y 336 - # CONFIG_IP_PNP is not set 291 + CONFIG_IP_PNP=y 292 + CONFIG_IP_PNP_DHCP=y 293 + # CONFIG_IP_PNP_BOOTP is not set 294 + # CONFIG_IP_PNP_RARP is not set 337 295 # CONFIG_NET_IPIP is not set 338 296 # CONFIG_NET_IPGRE is not set 297 + # CONFIG_IP_MROUTE is not set 339 298 # CONFIG_ARPD is not set 340 299 # CONFIG_SYN_COOKIES is not set 341 300 # CONFIG_INET_AH is not set 342 301 # CONFIG_INET_ESP is not set 343 302 # CONFIG_INET_IPCOMP is not set 303 + # CONFIG_INET_XFRM_TUNNEL is not set 344 304 # CONFIG_INET_TUNNEL is not set 345 - # CONFIG_INET_DIAG is not set 305 + CONFIG_INET_XFRM_MODE_TRANSPORT=y 306 + CONFIG_INET_XFRM_MODE_TUNNEL=y 307 + CONFIG_INET_DIAG=y 308 + CONFIG_INET_TCP_DIAG=y 346 309 # CONFIG_TCP_CONG_ADVANCED is not set 347 - CONFIG_TCP_CONG_BIC=y 348 - 349 - # 350 - # IP: Virtual Server Configuration 351 - # 352 - # CONFIG_IP_VS is not set 353 - # CONFIG_IPV6 is not set 354 - CONFIG_NETFILTER=y 355 - # CONFIG_NETFILTER_DEBUG is not set 356 - 357 - # 358 - # Core Netfilter Configuration 359 - # 360 - # CONFIG_NETFILTER_NETLINK is not set 361 - CONFIG_NETFILTER_XTABLES=y 362 - # CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set 363 - # CONFIG_NETFILTER_XT_TARGET_MARK is not set 364 - # CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set 365 - # CONFIG_NETFILTER_XT_MATCH_COMMENT is not set 366 - # CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set 367 - # CONFIG_NETFILTER_XT_MATCH_DCCP is not set 368 - # CONFIG_NETFILTER_XT_MATCH_HELPER is not set 369 - # CONFIG_NETFILTER_XT_MATCH_LENGTH is not set 370 - CONFIG_NETFILTER_XT_MATCH_LIMIT=y 371 - CONFIG_NETFILTER_XT_MATCH_MAC=y 372 - # CONFIG_NETFILTER_XT_MATCH_MARK is not set 373 - # CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set 374 - # CONFIG_NETFILTER_XT_MATCH_REALM is not set 375 - # CONFIG_NETFILTER_XT_MATCH_SCTP is not set 376 - CONFIG_NETFILTER_XT_MATCH_STATE=y 377 - # CONFIG_NETFILTER_XT_MATCH_STRING is not set 378 - # CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set 379 - 380 - # 381 - # IP: Netfilter Configuration 382 - # 383 - CONFIG_IP_NF_CONNTRACK=y 384 - # CONFIG_IP_NF_CT_ACCT is not set 385 - # CONFIG_IP_NF_CONNTRACK_MARK is not set 386 - # CONFIG_IP_NF_CONNTRACK_EVENTS is not set 387 - # CONFIG_IP_NF_CT_PROTO_SCTP is not set 388 - CONFIG_IP_NF_FTP=y 389 - # CONFIG_IP_NF_IRC is not set 390 - # CONFIG_IP_NF_NETBIOS_NS is not set 391 - # CONFIG_IP_NF_TFTP is not set 392 - # CONFIG_IP_NF_AMANDA is not set 393 - # CONFIG_IP_NF_PPTP is not set 394 - # CONFIG_IP_NF_QUEUE is not set 395 - CONFIG_IP_NF_IPTABLES=y 396 - # CONFIG_IP_NF_MATCH_IPRANGE is not set 397 - # CONFIG_IP_NF_MATCH_MULTIPORT is not set 398 - # CONFIG_IP_NF_MATCH_TOS is not set 399 - # CONFIG_IP_NF_MATCH_RECENT is not set 400 - # CONFIG_IP_NF_MATCH_ECN is not set 401 - # CONFIG_IP_NF_MATCH_DSCP is not set 402 - # CONFIG_IP_NF_MATCH_AH_ESP is not set 403 - # CONFIG_IP_NF_MATCH_TTL is not set 404 - # CONFIG_IP_NF_MATCH_OWNER is not set 405 - # CONFIG_IP_NF_MATCH_ADDRTYPE is not set 406 - # CONFIG_IP_NF_MATCH_HASHLIMIT is not set 407 - CONFIG_IP_NF_FILTER=y 408 - # CONFIG_IP_NF_TARGET_REJECT is not set 409 - CONFIG_IP_NF_TARGET_LOG=y 410 - # CONFIG_IP_NF_TARGET_ULOG is not set 411 - # CONFIG_IP_NF_TARGET_TCPMSS is not set 412 - # CONFIG_IP_NF_NAT is not set 413 - # CONFIG_IP_NF_MANGLE is not set 414 - # CONFIG_IP_NF_RAW is not set 415 - # CONFIG_IP_NF_ARPTABLES is not set 310 + CONFIG_TCP_CONG_CUBIC=y 311 + CONFIG_DEFAULT_TCP_CONG="cubic" 312 + CONFIG_IPV6=y 313 + # CONFIG_IPV6_PRIVACY is not set 314 + # CONFIG_IPV6_ROUTER_PREF is not set 315 + # CONFIG_INET6_AH is not set 316 + # CONFIG_INET6_ESP is not set 317 + # CONFIG_INET6_IPCOMP is not set 318 + # CONFIG_IPV6_MIP6 is not set 319 + # CONFIG_INET6_XFRM_TUNNEL is not set 320 + # CONFIG_INET6_TUNNEL is not set 321 + CONFIG_INET6_XFRM_MODE_TRANSPORT=y 322 + CONFIG_INET6_XFRM_MODE_TUNNEL=y 323 + # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 324 + # CONFIG_IPV6_TUNNEL is not set 325 + # CONFIG_IPV6_SUBTREES is not set 326 + # CONFIG_IPV6_MULTIPLE_TABLES is not set 327 + # CONFIG_NETWORK_SECMARK is not set 328 + # CONFIG_NETFILTER is not set 416 329 417 330 # 418 331 # DCCP Configuration (EXPERIMENTAL) ··· 398 389 # CONFIG_ATALK is not set 399 390 # CONFIG_X25 is not set 400 391 # CONFIG_LAPB is not set 401 - # CONFIG_NET_DIVERT is not set 402 392 # CONFIG_ECONET is not set 403 393 # CONFIG_WAN_ROUTER is not set 404 394 ··· 410 402 # Network testing 411 403 # 412 404 # CONFIG_NET_PKTGEN is not set 405 + # CONFIG_NET_TCPPROBE is not set 413 406 # CONFIG_HAMRADIO is not set 414 407 # CONFIG_IRDA is not set 415 408 # CONFIG_BT is not set ··· 425 416 # 426 417 CONFIG_STANDALONE=y 427 418 CONFIG_PREVENT_FIRMWARE_BUILD=y 428 - # CONFIG_FW_LOADER is not set 419 + CONFIG_FW_LOADER=y 420 + # CONFIG_DEBUG_DRIVER is not set 421 + # CONFIG_SYS_HYPERVISOR is not set 429 422 430 423 # 431 424 # Connector - unified userspace <-> kernelspace linker ··· 442 431 # 443 432 # Parallel port support 444 433 # 445 - CONFIG_PARPORT=y 446 - CONFIG_PARPORT_PC=y 447 - # CONFIG_PARPORT_SERIAL is not set 448 - # CONFIG_PARPORT_PC_FIFO is not set 449 - # CONFIG_PARPORT_PC_SUPERIO is not set 450 - # CONFIG_PARPORT_GSC is not set 451 - CONFIG_PARPORT_1284=y 434 + # CONFIG_PARPORT is not set 452 435 453 436 # 454 437 # Plug and Play support ··· 452 447 # 453 448 # Block devices 454 449 # 455 - # CONFIG_BLK_DEV_FD is not set 456 - # CONFIG_PARIDE is not set 450 + CONFIG_BLK_DEV_FD=y 457 451 # CONFIG_BLK_CPQ_DA is not set 458 452 # CONFIG_BLK_CPQ_CISS_DA is not set 459 453 # CONFIG_BLK_DEV_DAC960 is not set ··· 463 459 # CONFIG_BLK_DEV_NBD is not set 464 460 # CONFIG_BLK_DEV_SX8 is not set 465 461 # CONFIG_BLK_DEV_UB is not set 466 - # CONFIG_BLK_DEV_RAM is not set 462 + CONFIG_BLK_DEV_RAM=y 467 463 CONFIG_BLK_DEV_RAM_COUNT=16 464 + CONFIG_BLK_DEV_RAM_SIZE=4096 465 + CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 466 + CONFIG_BLK_DEV_INITRD=y 468 467 # CONFIG_CDROM_PKTCDVD is not set 469 468 # CONFIG_ATA_OVER_ETH is not set 470 469 ··· 483 476 # CONFIG_BLK_DEV_IDE_SATA is not set 484 477 # CONFIG_BLK_DEV_HD_IDE is not set 485 478 CONFIG_BLK_DEV_IDEDISK=y 486 - # CONFIG_IDEDISK_MULTI_MODE is not set 479 + CONFIG_IDEDISK_MULTI_MODE=y 487 480 CONFIG_BLK_DEV_IDECD=y 488 481 # CONFIG_BLK_DEV_IDETAPE is not set 489 482 # CONFIG_BLK_DEV_IDEFLOPPY is not set ··· 493 486 # 494 487 # IDE chipset support/bugfixes 495 488 # 496 - # CONFIG_IDE_GENERIC is not set 489 + CONFIG_IDE_GENERIC=y 497 490 # CONFIG_BLK_DEV_CMD640 is not set 498 491 CONFIG_BLK_DEV_IDEPCI=y 499 - CONFIG_IDEPCI_SHARE_IRQ=y 492 + # CONFIG_IDEPCI_SHARE_IRQ is not set 500 493 # CONFIG_BLK_DEV_OFFBOARD is not set 501 494 # CONFIG_BLK_DEV_GENERIC is not set 502 495 # CONFIG_BLK_DEV_OPTI621 is not set ··· 507 500 # CONFIG_IDEDMA_ONLYDISK is not set 508 501 # CONFIG_BLK_DEV_AEC62XX is not set 509 502 # CONFIG_BLK_DEV_ALI15X3 is not set 510 - # CONFIG_BLK_DEV_AMD74XX is not set 503 + CONFIG_BLK_DEV_AMD74XX=y 511 504 # CONFIG_BLK_DEV_ATIIXP is not set 512 505 # CONFIG_BLK_DEV_CMD64X is not set 513 506 # CONFIG_BLK_DEV_TRIFLEX is not set ··· 518 511 # CONFIG_BLK_DEV_HPT34X is not set 519 512 # CONFIG_BLK_DEV_HPT366 is not set 520 513 # CONFIG_BLK_DEV_SC1200 is not set 521 - # CONFIG_BLK_DEV_PIIX is not set 514 + CONFIG_BLK_DEV_PIIX=y 522 515 # CONFIG_BLK_DEV_IT821X is not set 523 516 # CONFIG_BLK_DEV_NS87415 is not set 524 517 # CONFIG_BLK_DEV_PDC202XX_OLD is not set ··· 528 521 # CONFIG_BLK_DEV_SIS5513 is not set 529 522 # CONFIG_BLK_DEV_SLC90E66 is not set 530 523 # CONFIG_BLK_DEV_TRM290 is not set 531 - CONFIG_BLK_DEV_VIA82CXXX=y 524 + # CONFIG_BLK_DEV_VIA82CXXX is not set 532 525 # CONFIG_IDE_ARM is not set 533 526 CONFIG_BLK_DEV_IDEDMA=y 534 527 # CONFIG_IDEDMA_IVB is not set ··· 540 533 # 541 534 # CONFIG_RAID_ATTRS is not set 542 535 CONFIG_SCSI=y 536 + CONFIG_SCSI_NETLINK=y 543 537 # CONFIG_SCSI_PROC_FS is not set 544 538 545 539 # ··· 549 541 CONFIG_BLK_DEV_SD=y 550 542 # CONFIG_CHR_DEV_ST is not set 551 543 # CONFIG_CHR_DEV_OSST is not set 552 - # CONFIG_BLK_DEV_SR is not set 553 - # CONFIG_CHR_DEV_SG is not set 544 + CONFIG_BLK_DEV_SR=y 545 + # CONFIG_BLK_DEV_SR_VENDOR is not set 546 + CONFIG_CHR_DEV_SG=y 554 547 # CONFIG_CHR_DEV_SCH is not set 555 548 556 549 # ··· 562 553 # CONFIG_SCSI_LOGGING is not set 563 554 564 555 # 565 - # SCSI Transport Attributes 556 + # SCSI Transports 566 557 # 567 - # CONFIG_SCSI_SPI_ATTRS is not set 568 - # CONFIG_SCSI_FC_ATTRS is not set 558 + CONFIG_SCSI_SPI_ATTRS=y 559 + CONFIG_SCSI_FC_ATTRS=y 569 560 # CONFIG_SCSI_ISCSI_ATTRS is not set 570 561 # CONFIG_SCSI_SAS_ATTRS is not set 562 + # CONFIG_SCSI_SAS_LIBSAS is not set 571 563 572 564 # 573 565 # SCSI low-level drivers 574 566 # 575 567 # CONFIG_ISCSI_TCP is not set 576 - # CONFIG_BLK_DEV_3W_XXXX_RAID is not set 568 + CONFIG_BLK_DEV_3W_XXXX_RAID=y 577 569 # CONFIG_SCSI_3W_9XXX is not set 578 570 # CONFIG_SCSI_ACARD is not set 579 571 # CONFIG_SCSI_AACRAID is not set 580 - # CONFIG_SCSI_AIC7XXX is not set 572 + CONFIG_SCSI_AIC7XXX=y 573 + CONFIG_AIC7XXX_CMDS_PER_DEVICE=32 574 + CONFIG_AIC7XXX_RESET_DELAY_MS=5000 575 + CONFIG_AIC7XXX_DEBUG_ENABLE=y 576 + CONFIG_AIC7XXX_DEBUG_MASK=0 577 + CONFIG_AIC7XXX_REG_PRETTY_PRINT=y 581 578 # CONFIG_SCSI_AIC7XXX_OLD is not set 582 - # CONFIG_SCSI_AIC79XX is not set 579 + CONFIG_SCSI_AIC79XX=y 580 + CONFIG_AIC79XX_CMDS_PER_DEVICE=32 581 + CONFIG_AIC79XX_RESET_DELAY_MS=4000 582 + # CONFIG_AIC79XX_ENABLE_RD_STRM is not set 583 + # CONFIG_AIC79XX_DEBUG_ENABLE is not set 584 + CONFIG_AIC79XX_DEBUG_MASK=0 585 + # CONFIG_AIC79XX_REG_PRETTY_PRINT is not set 586 + # CONFIG_SCSI_AIC94XX is not set 583 587 # CONFIG_SCSI_DPT_I2O is not set 588 + # CONFIG_SCSI_ADVANSYS is not set 589 + # CONFIG_SCSI_ARCMSR is not set 584 590 # CONFIG_MEGARAID_NEWGEN is not set 585 591 # CONFIG_MEGARAID_LEGACY is not set 586 592 # CONFIG_MEGARAID_SAS is not set 587 - # CONFIG_SCSI_SATA is not set 593 + # CONFIG_SCSI_HPTIOP is not set 588 594 # CONFIG_SCSI_BUSLOGIC is not set 589 595 # CONFIG_SCSI_DMX3191D is not set 590 596 # CONFIG_SCSI_EATA is not set ··· 608 584 # CONFIG_SCSI_IPS is not set 609 585 # CONFIG_SCSI_INITIO is not set 610 586 # CONFIG_SCSI_INIA100 is not set 611 - # CONFIG_SCSI_PPA is not set 612 - # CONFIG_SCSI_IMM is not set 587 + # CONFIG_SCSI_STEX is not set 613 588 # CONFIG_SCSI_SYM53C8XX_2 is not set 614 589 # CONFIG_SCSI_IPR is not set 615 - # CONFIG_SCSI_QLOGIC_FC is not set 616 590 # CONFIG_SCSI_QLOGIC_1280 is not set 617 591 # CONFIG_SCSI_QLA_FC is not set 618 592 # CONFIG_SCSI_LPFC is not set ··· 620 598 # CONFIG_SCSI_DEBUG is not set 621 599 622 600 # 601 + # Serial ATA (prod) and Parallel ATA (experimental) drivers 602 + # 603 + CONFIG_ATA=y 604 + CONFIG_SATA_AHCI=y 605 + CONFIG_SATA_SVW=y 606 + CONFIG_ATA_PIIX=y 607 + # CONFIG_SATA_MV is not set 608 + CONFIG_SATA_NV=y 609 + # CONFIG_PDC_ADMA is not set 610 + # CONFIG_SATA_QSTOR is not set 611 + # CONFIG_SATA_PROMISE is not set 612 + # CONFIG_SATA_SX4 is not set 613 + CONFIG_SATA_SIL=y 614 + # CONFIG_SATA_SIL24 is not set 615 + # CONFIG_SATA_SIS is not set 616 + # CONFIG_SATA_ULI is not set 617 + CONFIG_SATA_VIA=y 618 + # CONFIG_SATA_VITESSE is not set 619 + CONFIG_SATA_INTEL_COMBINED=y 620 + # CONFIG_PATA_ALI is not set 621 + # CONFIG_PATA_AMD is not set 622 + # CONFIG_PATA_ARTOP is not set 623 + # CONFIG_PATA_ATIIXP is not set 624 + # CONFIG_PATA_CMD64X is not set 625 + # CONFIG_PATA_CS5520 is not set 626 + # CONFIG_PATA_CS5530 is not set 627 + # CONFIG_PATA_CS5535 is not set 628 + # CONFIG_PATA_CYPRESS is not set 629 + # CONFIG_PATA_EFAR is not set 630 + # CONFIG_ATA_GENERIC is not set 631 + # CONFIG_PATA_HPT366 is not set 632 + # CONFIG_PATA_HPT37X is not set 633 + # CONFIG_PATA_HPT3X2N is not set 634 + # CONFIG_PATA_HPT3X3 is not set 635 + # CONFIG_PATA_IT821X is not set 636 + # CONFIG_PATA_JMICRON is not set 637 + # CONFIG_PATA_LEGACY is not set 638 + # CONFIG_PATA_TRIFLEX is not set 639 + # CONFIG_PATA_MPIIX is not set 640 + # CONFIG_PATA_OLDPIIX is not set 641 + # CONFIG_PATA_NETCELL is not set 642 + # CONFIG_PATA_NS87410 is not set 643 + # CONFIG_PATA_OPTI is not set 644 + # CONFIG_PATA_OPTIDMA is not set 645 + # CONFIG_PATA_PDC_OLD is not set 646 + # CONFIG_PATA_QDI is not set 647 + # CONFIG_PATA_RADISYS is not set 648 + # CONFIG_PATA_RZ1000 is not set 649 + # CONFIG_PATA_SC1200 is not set 650 + # CONFIG_PATA_SERVERWORKS is not set 651 + # CONFIG_PATA_PDC2027X is not set 652 + # CONFIG_PATA_SIL680 is not set 653 + # CONFIG_PATA_SIS is not set 654 + # CONFIG_PATA_VIA is not set 655 + # CONFIG_PATA_WINBOND is not set 656 + 657 + # 623 658 # Multi-device support (RAID and LVM) 624 659 # 625 - # CONFIG_MD is not set 660 + CONFIG_MD=y 661 + # CONFIG_BLK_DEV_MD is not set 662 + CONFIG_BLK_DEV_DM=y 663 + # CONFIG_DM_CRYPT is not set 664 + # CONFIG_DM_SNAPSHOT is not set 665 + # CONFIG_DM_MIRROR is not set 666 + # CONFIG_DM_ZERO is not set 667 + # CONFIG_DM_MULTIPATH is not set 626 668 627 669 # 628 670 # Fusion MPT device support 629 671 # 630 - # CONFIG_FUSION is not set 631 - # CONFIG_FUSION_SPI is not set 672 + CONFIG_FUSION=y 673 + CONFIG_FUSION_SPI=y 632 674 # CONFIG_FUSION_FC is not set 633 675 # CONFIG_FUSION_SAS is not set 676 + CONFIG_FUSION_MAX_SGE=128 677 + # CONFIG_FUSION_CTL is not set 634 678 635 679 # 636 680 # IEEE 1394 (FireWire) support 637 681 # 638 - # CONFIG_IEEE1394 is not set 682 + CONFIG_IEEE1394=y 683 + 684 + # 685 + # Subsystem Options 686 + # 687 + # CONFIG_IEEE1394_VERBOSEDEBUG is not set 688 + # CONFIG_IEEE1394_OUI_DB is not set 689 + # CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set 690 + # CONFIG_IEEE1394_EXPORT_FULL_API is not set 691 + 692 + # 693 + # Device Drivers 694 + # 695 + 696 + # 697 + # Texas Instruments PCILynx requires I2C 698 + # 699 + CONFIG_IEEE1394_OHCI1394=y 700 + 701 + # 702 + # Protocol Drivers 703 + # 704 + # CONFIG_IEEE1394_VIDEO1394 is not set 705 + # CONFIG_IEEE1394_SBP2 is not set 706 + # CONFIG_IEEE1394_ETH1394 is not set 707 + # CONFIG_IEEE1394_DV1394 is not set 708 + CONFIG_IEEE1394_RAWIO=y 639 709 640 710 # 641 711 # I2O device support ··· 766 652 # 767 653 # Tulip family network device support 768 654 # 769 - # CONFIG_NET_TULIP is not set 655 + CONFIG_NET_TULIP=y 656 + # CONFIG_DE2104X is not set 657 + CONFIG_TULIP=y 658 + # CONFIG_TULIP_MWI is not set 659 + # CONFIG_TULIP_MMIO is not set 660 + # CONFIG_TULIP_NAPI is not set 661 + # CONFIG_DE4X5 is not set 662 + # CONFIG_WINBOND_840 is not set 663 + # CONFIG_DM9102 is not set 664 + # CONFIG_ULI526X is not set 770 665 # CONFIG_HP100 is not set 771 666 CONFIG_NET_PCI=y 772 667 # CONFIG_PCNET32 is not set 773 668 # CONFIG_AMD8111_ETH is not set 774 669 # CONFIG_ADAPTEC_STARFIRE is not set 775 - # CONFIG_B44 is not set 776 - # CONFIG_FORCEDETH is not set 670 + CONFIG_B44=y 671 + CONFIG_FORCEDETH=y 672 + # CONFIG_FORCEDETH_NAPI is not set 777 673 # CONFIG_DGRS is not set 778 674 # CONFIG_EEPRO100 is not set 779 675 CONFIG_E100=y 780 676 # CONFIG_FEALNX is not set 781 677 # CONFIG_NATSEMI is not set 782 678 # CONFIG_NE2K_PCI is not set 783 - # CONFIG_8139CP is not set 784 - # CONFIG_8139TOO is not set 679 + CONFIG_8139CP=y 680 + CONFIG_8139TOO=y 681 + # CONFIG_8139TOO_PIO is not set 682 + # CONFIG_8139TOO_TUNE_TWISTER is not set 683 + # CONFIG_8139TOO_8129 is not set 684 + # CONFIG_8139_OLD_RX_RESET is not set 785 685 # CONFIG_SIS900 is not set 786 686 # CONFIG_EPIC100 is not set 787 687 # CONFIG_SUNDANCE is not set 788 688 # CONFIG_TLAN is not set 789 689 # CONFIG_VIA_RHINE is not set 790 - # CONFIG_NET_POCKET is not set 791 690 792 691 # 793 692 # Ethernet (1000 Mbit) 794 693 # 795 694 # CONFIG_ACENIC is not set 796 695 # CONFIG_DL2K is not set 797 - # CONFIG_E1000 is not set 696 + CONFIG_E1000=y 697 + # CONFIG_E1000_NAPI is not set 698 + # CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 798 699 # CONFIG_NS83820 is not set 799 700 # CONFIG_HAMACHI is not set 800 701 # CONFIG_YELLOWFIN is not set 801 - # CONFIG_R8169 is not set 702 + CONFIG_R8169=y 703 + # CONFIG_R8169_NAPI is not set 802 704 # CONFIG_SIS190 is not set 803 705 # CONFIG_SKGE is not set 804 - # CONFIG_SKY2 is not set 706 + CONFIG_SKY2=y 805 707 # CONFIG_SK98LIN is not set 806 708 # CONFIG_VIA_VELOCITY is not set 807 - # CONFIG_TIGON3 is not set 808 - # CONFIG_BNX2 is not set 709 + CONFIG_TIGON3=y 710 + CONFIG_BNX2=y 711 + # CONFIG_QLA3XXX is not set 809 712 810 713 # 811 714 # Ethernet (10000 Mbit) ··· 830 699 # CONFIG_CHELSIO_T1 is not set 831 700 # CONFIG_IXGB is not set 832 701 # CONFIG_S2IO is not set 702 + # CONFIG_MYRI10GE is not set 833 703 834 704 # 835 705 # Token Ring devices ··· 848 716 # CONFIG_WAN is not set 849 717 # CONFIG_FDDI is not set 850 718 # CONFIG_HIPPI is not set 851 - # CONFIG_PLIP is not set 852 719 # CONFIG_PPP is not set 853 720 # CONFIG_SLIP is not set 854 721 # CONFIG_NET_FC is not set 855 722 # CONFIG_SHAPER is not set 856 - # CONFIG_NETCONSOLE is not set 857 - # CONFIG_NETPOLL is not set 858 - # CONFIG_NET_POLL_CONTROLLER is not set 723 + CONFIG_NETCONSOLE=y 724 + CONFIG_NETPOLL=y 725 + # CONFIG_NETPOLL_RX is not set 726 + # CONFIG_NETPOLL_TRAP is not set 727 + CONFIG_NET_POLL_CONTROLLER=y 859 728 860 729 # 861 730 # ISDN subsystem ··· 878 745 # 879 746 CONFIG_INPUT_MOUSEDEV=y 880 747 CONFIG_INPUT_MOUSEDEV_PSAUX=y 881 - CONFIG_INPUT_MOUSEDEV_SCREEN_X=1280 882 - CONFIG_INPUT_MOUSEDEV_SCREEN_Y=1024 748 + CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 749 + CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 883 750 # CONFIG_INPUT_JOYDEV is not set 884 751 # CONFIG_INPUT_TSDEV is not set 885 752 CONFIG_INPUT_EVDEV=y ··· 909 776 CONFIG_SERIO_I8042=y 910 777 # CONFIG_SERIO_SERPORT is not set 911 778 # CONFIG_SERIO_CT82C710 is not set 912 - # CONFIG_SERIO_PARKBD is not set 913 779 # CONFIG_SERIO_PCIPS2 is not set 914 780 CONFIG_SERIO_LIBPS2=y 915 781 # CONFIG_SERIO_RAW is not set ··· 920 788 CONFIG_VT=y 921 789 CONFIG_VT_CONSOLE=y 922 790 CONFIG_HW_CONSOLE=y 791 + # CONFIG_VT_HW_CONSOLE_BINDING is not set 923 792 # CONFIG_SERIAL_NONSTANDARD is not set 924 793 925 794 # 926 795 # Serial drivers 927 796 # 928 797 CONFIG_SERIAL_8250=y 929 - # CONFIG_SERIAL_8250_CONSOLE is not set 930 - # CONFIG_SERIAL_8250_ACPI is not set 798 + CONFIG_SERIAL_8250_CONSOLE=y 799 + CONFIG_SERIAL_8250_PCI=y 931 800 CONFIG_SERIAL_8250_NR_UARTS=4 932 801 CONFIG_SERIAL_8250_RUNTIME_UARTS=4 933 802 # CONFIG_SERIAL_8250_EXTENDED is not set ··· 937 804 # Non-8250 serial port support 938 805 # 939 806 CONFIG_SERIAL_CORE=y 807 + CONFIG_SERIAL_CORE_CONSOLE=y 940 808 # CONFIG_SERIAL_JSM is not set 941 809 CONFIG_UNIX98_PTYS=y 942 810 CONFIG_LEGACY_PTYS=y 943 811 CONFIG_LEGACY_PTY_COUNT=256 944 - CONFIG_PRINTER=y 945 - # CONFIG_LP_CONSOLE is not set 946 - # CONFIG_PPDEV is not set 947 - # CONFIG_TIPAR is not set 948 812 949 813 # 950 814 # IPMI ··· 952 822 # Watchdog Cards 953 823 # 954 824 # CONFIG_WATCHDOG is not set 955 - # CONFIG_HW_RANDOM is not set 956 - CONFIG_NVRAM=y 825 + CONFIG_HW_RANDOM=y 826 + CONFIG_HW_RANDOM_INTEL=y 827 + CONFIG_HW_RANDOM_AMD=y 828 + CONFIG_HW_RANDOM_GEODE=y 829 + CONFIG_HW_RANDOM_VIA=y 830 + # CONFIG_NVRAM is not set 957 831 CONFIG_RTC=y 958 832 # CONFIG_DTLK is not set 959 833 # CONFIG_R3964 is not set ··· 967 833 # 968 834 # Ftape, the floppy tape device driver 969 835 # 970 - # CONFIG_FTAPE is not set 971 836 CONFIG_AGP=y 972 837 # CONFIG_AGP_ALI is not set 973 838 # CONFIG_AGP_ATI is not set 974 839 # CONFIG_AGP_AMD is not set 975 - # CONFIG_AGP_AMD64 is not set 976 - # CONFIG_AGP_INTEL is not set 840 + CONFIG_AGP_AMD64=y 841 + CONFIG_AGP_INTEL=y 977 842 # CONFIG_AGP_NVIDIA is not set 978 843 # CONFIG_AGP_SIS is not set 979 844 # CONFIG_AGP_SWORKS is not set 980 - CONFIG_AGP_VIA=y 845 + # CONFIG_AGP_VIA is not set 981 846 # CONFIG_AGP_EFFICEON is not set 982 - CONFIG_DRM=y 983 - # CONFIG_DRM_TDFX is not set 984 - # CONFIG_DRM_R128 is not set 985 - CONFIG_DRM_RADEON=y 986 - # CONFIG_DRM_MGA is not set 987 - # CONFIG_DRM_SIS is not set 988 - # CONFIG_DRM_VIA is not set 989 - # CONFIG_DRM_SAVAGE is not set 847 + # CONFIG_DRM is not set 990 848 # CONFIG_MWAVE is not set 849 + # CONFIG_PC8736x_GPIO is not set 850 + # CONFIG_NSC_GPIO is not set 991 851 # CONFIG_CS5535_GPIO is not set 992 - # CONFIG_RAW_DRIVER is not set 993 - # CONFIG_HPET is not set 994 - # CONFIG_HANGCHECK_TIMER is not set 852 + CONFIG_RAW_DRIVER=y 853 + CONFIG_MAX_RAW_DEVS=256 854 + CONFIG_HPET=y 855 + # CONFIG_HPET_RTC_IRQ is not set 856 + CONFIG_HPET_MMAP=y 857 + CONFIG_HANGCHECK_TIMER=y 995 858 996 859 # 997 860 # TPM devices ··· 999 868 # 1000 869 # I2C support 1001 870 # 1002 - CONFIG_I2C=y 1003 - CONFIG_I2C_CHARDEV=y 1004 - 1005 - # 1006 - # I2C Algorithms 1007 - # 1008 - CONFIG_I2C_ALGOBIT=y 1009 - # CONFIG_I2C_ALGOPCF is not set 1010 - # CONFIG_I2C_ALGOPCA is not set 1011 - 1012 - # 1013 - # I2C Hardware Bus support 1014 - # 1015 - # CONFIG_I2C_ALI1535 is not set 1016 - # CONFIG_I2C_ALI1563 is not set 1017 - # CONFIG_I2C_ALI15X3 is not set 1018 - # CONFIG_I2C_AMD756 is not set 1019 - # CONFIG_I2C_AMD8111 is not set 1020 - # CONFIG_I2C_I801 is not set 1021 - # CONFIG_I2C_I810 is not set 1022 - # CONFIG_I2C_PIIX4 is not set 1023 - CONFIG_I2C_ISA=y 1024 - # CONFIG_I2C_NFORCE2 is not set 1025 - # CONFIG_I2C_PARPORT is not set 1026 - # CONFIG_I2C_PARPORT_LIGHT is not set 1027 - # CONFIG_I2C_PROSAVAGE is not set 1028 - # CONFIG_I2C_SAVAGE4 is not set 1029 - # CONFIG_SCx200_ACB is not set 1030 - # CONFIG_I2C_SIS5595 is not set 1031 - # CONFIG_I2C_SIS630 is not set 1032 - # CONFIG_I2C_SIS96X is not set 1033 - # CONFIG_I2C_STUB is not set 1034 - # CONFIG_I2C_VIA is not set 1035 - CONFIG_I2C_VIAPRO=y 1036 - # CONFIG_I2C_VOODOO3 is not set 1037 - # CONFIG_I2C_PCA_ISA is not set 1038 - 1039 - # 1040 - # Miscellaneous I2C Chip support 1041 - # 1042 - # CONFIG_SENSORS_DS1337 is not set 1043 - # CONFIG_SENSORS_DS1374 is not set 1044 - # CONFIG_SENSORS_EEPROM is not set 1045 - # CONFIG_SENSORS_PCF8574 is not set 1046 - # CONFIG_SENSORS_PCA9539 is not set 1047 - # CONFIG_SENSORS_PCF8591 is not set 1048 - # CONFIG_SENSORS_RTC8564 is not set 1049 - # CONFIG_SENSORS_MAX6875 is not set 1050 - # CONFIG_RTC_X1205_I2C is not set 1051 - # CONFIG_I2C_DEBUG_CORE is not set 1052 - # CONFIG_I2C_DEBUG_ALGO is not set 1053 - # CONFIG_I2C_DEBUG_BUS is not set 1054 - # CONFIG_I2C_DEBUG_CHIP is not set 871 + # CONFIG_I2C is not set 1055 872 1056 873 # 1057 874 # SPI support ··· 1010 931 # 1011 932 # Dallas's 1-wire bus 1012 933 # 1013 - # CONFIG_W1 is not set 1014 934 1015 935 # 1016 936 # Hardware Monitoring support 1017 937 # 1018 - CONFIG_HWMON=y 1019 - CONFIG_HWMON_VID=y 1020 - # CONFIG_SENSORS_ADM1021 is not set 1021 - # CONFIG_SENSORS_ADM1025 is not set 1022 - # CONFIG_SENSORS_ADM1026 is not set 1023 - # CONFIG_SENSORS_ADM1031 is not set 1024 - # CONFIG_SENSORS_ADM9240 is not set 1025 - # CONFIG_SENSORS_ASB100 is not set 1026 - # CONFIG_SENSORS_ATXP1 is not set 1027 - # CONFIG_SENSORS_DS1621 is not set 1028 - # CONFIG_SENSORS_F71805F is not set 1029 - # CONFIG_SENSORS_FSCHER is not set 1030 - # CONFIG_SENSORS_FSCPOS is not set 1031 - # CONFIG_SENSORS_GL518SM is not set 1032 - # CONFIG_SENSORS_GL520SM is not set 1033 - CONFIG_SENSORS_IT87=y 1034 - # CONFIG_SENSORS_LM63 is not set 1035 - # CONFIG_SENSORS_LM75 is not set 1036 - # CONFIG_SENSORS_LM77 is not set 1037 - # CONFIG_SENSORS_LM78 is not set 1038 - # CONFIG_SENSORS_LM80 is not set 1039 - # CONFIG_SENSORS_LM83 is not set 1040 - # CONFIG_SENSORS_LM85 is not set 1041 - # CONFIG_SENSORS_LM87 is not set 1042 - # CONFIG_SENSORS_LM90 is not set 1043 - # CONFIG_SENSORS_LM92 is not set 1044 - # CONFIG_SENSORS_MAX1619 is not set 1045 - # CONFIG_SENSORS_PC87360 is not set 1046 - # CONFIG_SENSORS_SIS5595 is not set 1047 - # CONFIG_SENSORS_SMSC47M1 is not set 1048 - # CONFIG_SENSORS_SMSC47B397 is not set 1049 - # CONFIG_SENSORS_VIA686A is not set 1050 - # CONFIG_SENSORS_VT8231 is not set 1051 - # CONFIG_SENSORS_W83781D is not set 1052 - # CONFIG_SENSORS_W83792D is not set 1053 - # CONFIG_SENSORS_W83L785TS is not set 1054 - # CONFIG_SENSORS_W83627HF is not set 1055 - # CONFIG_SENSORS_W83627EHF is not set 1056 - # CONFIG_SENSORS_HDAPS is not set 1057 - # CONFIG_HWMON_DEBUG_CHIP is not set 938 + # CONFIG_HWMON is not set 939 + # CONFIG_HWMON_VID is not set 1058 940 1059 941 # 1060 942 # Misc devices ··· 1023 983 # CONFIG_IBM_ASM is not set 1024 984 1025 985 # 1026 - # Multimedia Capabilities Port drivers 1027 - # 1028 - 1029 - # 1030 986 # Multimedia devices 1031 987 # 1032 - CONFIG_VIDEO_DEV=y 1033 - 1034 - # 1035 - # Video For Linux 1036 - # 1037 - 1038 - # 1039 - # Video Adapters 1040 - # 1041 - # CONFIG_VIDEO_ADV_DEBUG is not set 1042 - # CONFIG_VIDEO_BT848 is not set 1043 - # CONFIG_VIDEO_BWQCAM is not set 1044 - # CONFIG_VIDEO_CQCAM is not set 1045 - # CONFIG_VIDEO_W9966 is not set 1046 - # CONFIG_VIDEO_CPIA is not set 1047 - # CONFIG_VIDEO_SAA5246A is not set 1048 - # CONFIG_VIDEO_SAA5249 is not set 1049 - # CONFIG_TUNER_3036 is not set 1050 - # CONFIG_VIDEO_STRADIS is not set 1051 - # CONFIG_VIDEO_ZORAN is not set 1052 - CONFIG_VIDEO_SAA7134=y 1053 - # CONFIG_VIDEO_SAA7134_ALSA is not set 1054 - # CONFIG_VIDEO_MXB is not set 1055 - # CONFIG_VIDEO_DPC is not set 1056 - # CONFIG_VIDEO_HEXIUM_ORION is not set 1057 - # CONFIG_VIDEO_HEXIUM_GEMINI is not set 1058 - # CONFIG_VIDEO_CX88 is not set 1059 - # CONFIG_VIDEO_EM28XX is not set 1060 - # CONFIG_VIDEO_OVCAMCHIP is not set 1061 - # CONFIG_VIDEO_AUDIO_DECODER is not set 1062 - # CONFIG_VIDEO_DECODER is not set 1063 - 1064 - # 1065 - # Radio Adapters 1066 - # 1067 - # CONFIG_RADIO_GEMTEK_PCI is not set 1068 - # CONFIG_RADIO_MAXIRADIO is not set 1069 - # CONFIG_RADIO_MAESTRO is not set 988 + # CONFIG_VIDEO_DEV is not set 989 + CONFIG_VIDEO_V4L2=y 1070 990 1071 991 # 1072 992 # Digital Video Broadcasting Devices 1073 993 # 1074 994 # CONFIG_DVB is not set 1075 - CONFIG_VIDEO_TUNER=y 1076 - CONFIG_VIDEO_BUF=y 1077 - CONFIG_VIDEO_IR=y 995 + # CONFIG_USB_DABUSB is not set 1078 996 1079 997 # 1080 998 # Graphics support 1081 999 # 1082 - CONFIG_FB=y 1083 - CONFIG_FB_CFB_FILLRECT=y 1084 - CONFIG_FB_CFB_COPYAREA=y 1085 - CONFIG_FB_CFB_IMAGEBLIT=y 1086 - # CONFIG_FB_MACMODES is not set 1087 - CONFIG_FB_MODE_HELPERS=y 1088 - # CONFIG_FB_TILEBLITTING is not set 1089 - # CONFIG_FB_CIRRUS is not set 1090 - # CONFIG_FB_PM2 is not set 1091 - # CONFIG_FB_CYBER2000 is not set 1092 - # CONFIG_FB_ARC is not set 1093 - # CONFIG_FB_ASILIANT is not set 1094 - # CONFIG_FB_IMSTT is not set 1095 - # CONFIG_FB_VGA16 is not set 1096 - # CONFIG_FB_VESA is not set 1097 - CONFIG_VIDEO_SELECT=y 1098 - # CONFIG_FB_HGA is not set 1099 - # CONFIG_FB_S1D13XXX is not set 1100 - # CONFIG_FB_NVIDIA is not set 1101 - # CONFIG_FB_RIVA is not set 1102 - # CONFIG_FB_I810 is not set 1103 - # CONFIG_FB_INTEL is not set 1104 - # CONFIG_FB_MATROX is not set 1105 - # CONFIG_FB_RADEON_OLD is not set 1106 - CONFIG_FB_RADEON=y 1107 - CONFIG_FB_RADEON_I2C=y 1108 - # CONFIG_FB_RADEON_DEBUG is not set 1109 - # CONFIG_FB_ATY128 is not set 1110 - # CONFIG_FB_ATY is not set 1111 - # CONFIG_FB_SAVAGE is not set 1112 - # CONFIG_FB_SIS is not set 1113 - # CONFIG_FB_NEOMAGIC is not set 1114 - # CONFIG_FB_KYRO is not set 1115 - # CONFIG_FB_3DFX is not set 1116 - # CONFIG_FB_VOODOO1 is not set 1117 - # CONFIG_FB_CYBLA is not set 1118 - # CONFIG_FB_TRIDENT is not set 1119 - # CONFIG_FB_GEODE is not set 1120 - # CONFIG_FB_VIRTUAL is not set 1000 + CONFIG_FIRMWARE_EDID=y 1001 + # CONFIG_FB is not set 1121 1002 1122 1003 # 1123 1004 # Console display driver support 1124 1005 # 1125 1006 CONFIG_VGA_CONSOLE=y 1007 + CONFIG_VGACON_SOFT_SCROLLBACK=y 1008 + CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=128 1009 + CONFIG_VIDEO_SELECT=y 1126 1010 CONFIG_DUMMY_CONSOLE=y 1127 - CONFIG_FRAMEBUFFER_CONSOLE=y 1128 - # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set 1129 - # CONFIG_FONTS is not set 1130 - CONFIG_FONT_8x8=y 1131 - CONFIG_FONT_8x16=y 1132 - 1133 - # 1134 - # Logo configuration 1135 - # 1136 - # CONFIG_LOGO is not set 1137 1011 # CONFIG_BACKLIGHT_LCD_SUPPORT is not set 1138 1012 1139 1013 # ··· 1058 1104 # 1059 1105 # Advanced Linux Sound Architecture 1060 1106 # 1061 - CONFIG_SND=y 1062 - CONFIG_SND_TIMER=y 1063 - CONFIG_SND_PCM=y 1064 - CONFIG_SND_RAWMIDI=y 1065 - CONFIG_SND_SEQUENCER=y 1066 - # CONFIG_SND_SEQ_DUMMY is not set 1067 - # CONFIG_SND_MIXER_OSS is not set 1068 - # CONFIG_SND_PCM_OSS is not set 1069 - # CONFIG_SND_SEQUENCER_OSS is not set 1070 - CONFIG_SND_RTCTIMER=y 1071 - CONFIG_SND_SEQ_RTCTIMER_DEFAULT=y 1072 - # CONFIG_SND_DYNAMIC_MINORS is not set 1073 - # CONFIG_SND_SUPPORT_OLD_API is not set 1074 - # CONFIG_SND_VERBOSE_PRINTK is not set 1075 - # CONFIG_SND_DEBUG is not set 1076 - 1077 - # 1078 - # Generic devices 1079 - # 1080 - CONFIG_SND_MPU401_UART=y 1081 - CONFIG_SND_AC97_CODEC=y 1082 - CONFIG_SND_AC97_BUS=y 1083 - # CONFIG_SND_DUMMY is not set 1084 - # CONFIG_SND_VIRMIDI is not set 1085 - # CONFIG_SND_MTPAV is not set 1086 - # CONFIG_SND_SERIAL_U16550 is not set 1087 - # CONFIG_SND_MPU401 is not set 1088 - 1089 - # 1090 - # PCI devices 1091 - # 1092 - # CONFIG_SND_AD1889 is not set 1093 - # CONFIG_SND_ALS4000 is not set 1094 - # CONFIG_SND_ALI5451 is not set 1095 - # CONFIG_SND_ATIIXP is not set 1096 - # CONFIG_SND_ATIIXP_MODEM is not set 1097 - # CONFIG_SND_AU8810 is not set 1098 - # CONFIG_SND_AU8820 is not set 1099 - # CONFIG_SND_AU8830 is not set 1100 - # CONFIG_SND_AZT3328 is not set 1101 - # CONFIG_SND_BT87X is not set 1102 - # CONFIG_SND_CA0106 is not set 1103 - # CONFIG_SND_CMIPCI is not set 1104 - # CONFIG_SND_CS4281 is not set 1105 - # CONFIG_SND_CS46XX is not set 1106 - # CONFIG_SND_CS5535AUDIO is not set 1107 - # CONFIG_SND_EMU10K1 is not set 1108 - # CONFIG_SND_EMU10K1X is not set 1109 - # CONFIG_SND_ENS1370 is not set 1110 - # CONFIG_SND_ENS1371 is not set 1111 - # CONFIG_SND_ES1938 is not set 1112 - # CONFIG_SND_ES1968 is not set 1113 - # CONFIG_SND_FM801 is not set 1114 - # CONFIG_SND_HDA_INTEL is not set 1115 - # CONFIG_SND_HDSP is not set 1116 - # CONFIG_SND_HDSPM is not set 1117 - # CONFIG_SND_ICE1712 is not set 1118 - # CONFIG_SND_ICE1724 is not set 1119 - # CONFIG_SND_INTEL8X0 is not set 1120 - # CONFIG_SND_INTEL8X0M is not set 1121 - # CONFIG_SND_KORG1212 is not set 1122 - # CONFIG_SND_MAESTRO3 is not set 1123 - # CONFIG_SND_MIXART is not set 1124 - # CONFIG_SND_NM256 is not set 1125 - # CONFIG_SND_PCXHR is not set 1126 - # CONFIG_SND_RME32 is not set 1127 - # CONFIG_SND_RME96 is not set 1128 - # CONFIG_SND_RME9652 is not set 1129 - # CONFIG_SND_SONICVIBES is not set 1130 - # CONFIG_SND_TRIDENT is not set 1131 - CONFIG_SND_VIA82XX=y 1132 - # CONFIG_SND_VIA82XX_MODEM is not set 1133 - # CONFIG_SND_VX222 is not set 1134 - # CONFIG_SND_YMFPCI is not set 1135 - 1136 - # 1137 - # USB devices 1138 - # 1139 - # CONFIG_SND_USB_AUDIO is not set 1140 - # CONFIG_SND_USB_USX2Y is not set 1107 + # CONFIG_SND is not set 1141 1108 1142 1109 # 1143 1110 # Open Sound System 1144 1111 # 1145 - # CONFIG_SOUND_PRIME is not set 1112 + CONFIG_SOUND_PRIME=y 1113 + CONFIG_OSS_OBSOLETE_DRIVER=y 1114 + # CONFIG_SOUND_BT878 is not set 1115 + # CONFIG_SOUND_EMU10K1 is not set 1116 + # CONFIG_SOUND_FUSION is not set 1117 + # CONFIG_SOUND_ES1371 is not set 1118 + CONFIG_SOUND_ICH=y 1119 + # CONFIG_SOUND_TRIDENT is not set 1120 + # CONFIG_SOUND_MSNDCLAS is not set 1121 + # CONFIG_SOUND_MSNDPIN is not set 1122 + # CONFIG_SOUND_VIA82CXXX is not set 1123 + # CONFIG_SOUND_OSS is not set 1146 1124 1147 1125 # 1148 1126 # USB support 1149 1127 # 1150 1128 CONFIG_USB_ARCH_HAS_HCD=y 1151 1129 CONFIG_USB_ARCH_HAS_OHCI=y 1130 + CONFIG_USB_ARCH_HAS_EHCI=y 1152 1131 CONFIG_USB=y 1153 1132 # CONFIG_USB_DEBUG is not set 1154 1133 ··· 1100 1213 CONFIG_USB_EHCI_HCD=y 1101 1214 # CONFIG_USB_EHCI_SPLIT_ISO is not set 1102 1215 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1216 + # CONFIG_USB_EHCI_TT_NEWSCHED is not set 1103 1217 # CONFIG_USB_ISP116X_HCD is not set 1104 - # CONFIG_USB_OHCI_HCD is not set 1218 + CONFIG_USB_OHCI_HCD=y 1219 + # CONFIG_USB_OHCI_BIG_ENDIAN is not set 1220 + CONFIG_USB_OHCI_LITTLE_ENDIAN=y 1105 1221 CONFIG_USB_UHCI_HCD=y 1106 1222 # CONFIG_USB_SL811_HCD is not set 1107 1223 1108 1224 # 1109 1225 # USB Device Class drivers 1110 1226 # 1111 - # CONFIG_OBSOLETE_OSS_USB_DRIVER is not set 1112 1227 # CONFIG_USB_ACM is not set 1113 - # CONFIG_USB_PRINTER is not set 1228 + CONFIG_USB_PRINTER=y 1114 1229 1115 1230 # 1116 1231 # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' ··· 1137 1248 # 1138 1249 # USB Input Devices 1139 1250 # 1140 - # CONFIG_USB_HID is not set 1141 - 1142 - # 1143 - # USB HID Boot Protocol drivers 1144 - # 1145 - # CONFIG_USB_KBD is not set 1146 - # CONFIG_USB_MOUSE is not set 1251 + CONFIG_USB_HID=y 1252 + CONFIG_USB_HIDINPUT=y 1253 + # CONFIG_USB_HIDINPUT_POWERBOOK is not set 1254 + # CONFIG_HID_FF is not set 1255 + # CONFIG_USB_HIDDEV is not set 1147 1256 # CONFIG_USB_AIPTEK is not set 1148 1257 # CONFIG_USB_WACOM is not set 1149 1258 # CONFIG_USB_ACECAD is not set 1150 1259 # CONFIG_USB_KBTAB is not set 1151 1260 # CONFIG_USB_POWERMATE is not set 1152 - # CONFIG_USB_MTOUCH is not set 1153 - # CONFIG_USB_ITMTOUCH is not set 1154 - # CONFIG_USB_EGALAX is not set 1261 + # CONFIG_USB_TOUCHSCREEN is not set 1155 1262 # CONFIG_USB_YEALINK is not set 1156 1263 # CONFIG_USB_XPAD is not set 1157 1264 # CONFIG_USB_ATI_REMOTE is not set ··· 1162 1277 # CONFIG_USB_MICROTEK is not set 1163 1278 1164 1279 # 1165 - # USB Multimedia devices 1166 - # 1167 - # CONFIG_USB_DABUSB is not set 1168 - # CONFIG_USB_VICAM is not set 1169 - # CONFIG_USB_DSBR is not set 1170 - # CONFIG_USB_ET61X251 is not set 1171 - # CONFIG_USB_IBMCAM is not set 1172 - # CONFIG_USB_KONICAWC is not set 1173 - # CONFIG_USB_OV511 is not set 1174 - # CONFIG_USB_SE401 is not set 1175 - # CONFIG_USB_SN9C102 is not set 1176 - # CONFIG_USB_STV680 is not set 1177 - # CONFIG_USB_PWC is not set 1178 - 1179 - # 1180 1280 # USB Network Adapters 1181 1281 # 1182 1282 # CONFIG_USB_CATC is not set ··· 1169 1299 # CONFIG_USB_PEGASUS is not set 1170 1300 # CONFIG_USB_RTL8150 is not set 1171 1301 # CONFIG_USB_USBNET is not set 1172 - # CONFIG_USB_MON is not set 1302 + CONFIG_USB_MON=y 1173 1303 1174 1304 # 1175 1305 # USB port drivers 1176 1306 # 1177 - # CONFIG_USB_USS720 is not set 1178 1307 1179 1308 # 1180 1309 # USB Serial Converter support ··· 1190 1321 # CONFIG_USB_LEGOTOWER is not set 1191 1322 # CONFIG_USB_LCD is not set 1192 1323 # CONFIG_USB_LED is not set 1324 + # CONFIG_USB_CYPRESS_CY7C63 is not set 1193 1325 # CONFIG_USB_CYTHERM is not set 1194 1326 # CONFIG_USB_PHIDGETKIT is not set 1195 1327 # CONFIG_USB_PHIDGETSERVO is not set 1196 1328 # CONFIG_USB_IDMOUSE is not set 1329 + # CONFIG_USB_APPLEDISPLAY is not set 1197 1330 # CONFIG_USB_SISUSBVGA is not set 1198 1331 # CONFIG_USB_LD is not set 1199 1332 # CONFIG_USB_TEST is not set ··· 1215 1344 # CONFIG_MMC is not set 1216 1345 1217 1346 # 1347 + # LED devices 1348 + # 1349 + # CONFIG_NEW_LEDS is not set 1350 + 1351 + # 1352 + # LED drivers 1353 + # 1354 + 1355 + # 1356 + # LED Triggers 1357 + # 1358 + 1359 + # 1218 1360 # InfiniBand support 1219 1361 # 1220 1362 # CONFIG_INFINIBAND is not set 1221 1363 1222 1364 # 1223 - # SN Devices 1365 + # EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 1366 + # 1367 + # CONFIG_EDAC is not set 1368 + 1369 + # 1370 + # Real Time Clock 1371 + # 1372 + # CONFIG_RTC_CLASS is not set 1373 + 1374 + # 1375 + # DMA Engine support 1376 + # 1377 + # CONFIG_DMA_ENGINE is not set 1378 + 1379 + # 1380 + # DMA Clients 1224 1381 # 1225 1382 1226 1383 # 1227 - # EDAC - error detection and reporting (RAS) 1384 + # DMA Devices 1228 1385 # 1229 - # CONFIG_EDAC is not set 1230 1386 1231 1387 # 1232 1388 # File systems 1233 1389 # 1234 1390 CONFIG_EXT2_FS=y 1235 - # CONFIG_EXT2_FS_XATTR is not set 1391 + CONFIG_EXT2_FS_XATTR=y 1392 + CONFIG_EXT2_FS_POSIX_ACL=y 1393 + # CONFIG_EXT2_FS_SECURITY is not set 1236 1394 # CONFIG_EXT2_FS_XIP is not set 1237 - # CONFIG_EXT3_FS is not set 1238 - # CONFIG_REISERFS_FS is not set 1395 + CONFIG_EXT3_FS=y 1396 + CONFIG_EXT3_FS_XATTR=y 1397 + CONFIG_EXT3_FS_POSIX_ACL=y 1398 + # CONFIG_EXT3_FS_SECURITY is not set 1399 + CONFIG_JBD=y 1400 + # CONFIG_JBD_DEBUG is not set 1401 + CONFIG_FS_MBCACHE=y 1402 + CONFIG_REISERFS_FS=y 1403 + # CONFIG_REISERFS_CHECK is not set 1404 + # CONFIG_REISERFS_PROC_INFO is not set 1405 + CONFIG_REISERFS_FS_XATTR=y 1406 + CONFIG_REISERFS_FS_POSIX_ACL=y 1407 + # CONFIG_REISERFS_FS_SECURITY is not set 1239 1408 # CONFIG_JFS_FS is not set 1240 - # CONFIG_FS_POSIX_ACL is not set 1409 + CONFIG_FS_POSIX_ACL=y 1241 1410 # CONFIG_XFS_FS is not set 1242 1411 # CONFIG_OCFS2_FS is not set 1243 1412 # CONFIG_MINIX_FS is not set 1244 1413 # CONFIG_ROMFS_FS is not set 1245 - # CONFIG_INOTIFY is not set 1414 + CONFIG_INOTIFY=y 1415 + CONFIG_INOTIFY_USER=y 1246 1416 # CONFIG_QUOTA is not set 1247 1417 CONFIG_DNOTIFY=y 1248 1418 # CONFIG_AUTOFS_FS is not set 1249 - # CONFIG_AUTOFS4_FS is not set 1419 + CONFIG_AUTOFS4_FS=y 1250 1420 # CONFIG_FUSE_FS is not set 1251 1421 1252 1422 # 1253 1423 # CD-ROM/DVD Filesystems 1254 1424 # 1255 1425 CONFIG_ISO9660_FS=y 1256 - CONFIG_JOLIET=y 1257 - CONFIG_ZISOFS=y 1258 - CONFIG_ZISOFS_FS=y 1426 + # CONFIG_JOLIET is not set 1427 + # CONFIG_ZISOFS is not set 1259 1428 # CONFIG_UDF_FS is not set 1260 1429 1261 1430 # 1262 1431 # DOS/FAT/NT Filesystems 1263 1432 # 1264 1433 CONFIG_FAT_FS=y 1265 - # CONFIG_MSDOS_FS is not set 1434 + CONFIG_MSDOS_FS=y 1266 1435 CONFIG_VFAT_FS=y 1267 - CONFIG_FAT_DEFAULT_CODEPAGE=850 1436 + CONFIG_FAT_DEFAULT_CODEPAGE=437 1268 1437 CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 1269 1438 # CONFIG_NTFS_FS is not set 1270 1439 ··· 1315 1404 CONFIG_PROC_KCORE=y 1316 1405 CONFIG_SYSFS=y 1317 1406 CONFIG_TMPFS=y 1318 - # CONFIG_HUGETLBFS is not set 1319 - # CONFIG_HUGETLB_PAGE is not set 1407 + CONFIG_HUGETLBFS=y 1408 + CONFIG_HUGETLB_PAGE=y 1320 1409 CONFIG_RAMFS=y 1321 - # CONFIG_RELAYFS_FS is not set 1322 1410 # CONFIG_CONFIGFS_FS is not set 1323 1411 1324 1412 # ··· 1340 1430 # 1341 1431 # Network File Systems 1342 1432 # 1343 - # CONFIG_NFS_FS is not set 1344 - # CONFIG_NFSD is not set 1433 + CONFIG_NFS_FS=y 1434 + CONFIG_NFS_V3=y 1435 + # CONFIG_NFS_V3_ACL is not set 1436 + # CONFIG_NFS_V4 is not set 1437 + # CONFIG_NFS_DIRECTIO is not set 1438 + CONFIG_NFSD=y 1439 + CONFIG_NFSD_V3=y 1440 + # CONFIG_NFSD_V3_ACL is not set 1441 + # CONFIG_NFSD_V4 is not set 1442 + CONFIG_NFSD_TCP=y 1443 + CONFIG_ROOT_NFS=y 1444 + CONFIG_LOCKD=y 1445 + CONFIG_LOCKD_V4=y 1446 + CONFIG_EXPORTFS=y 1447 + CONFIG_NFS_COMMON=y 1448 + CONFIG_SUNRPC=y 1449 + # CONFIG_RPCSEC_GSS_KRB5 is not set 1450 + # CONFIG_RPCSEC_GSS_SPKM3 is not set 1345 1451 # CONFIG_SMB_FS is not set 1346 - CONFIG_CIFS=y 1347 - # CONFIG_CIFS_STATS is not set 1348 - # CONFIG_CIFS_XATTR is not set 1349 - # CONFIG_CIFS_EXPERIMENTAL is not set 1452 + # CONFIG_CIFS is not set 1350 1453 # CONFIG_NCP_FS is not set 1351 1454 # CONFIG_CODA_FS is not set 1352 1455 # CONFIG_AFS_FS is not set ··· 1368 1445 # 1369 1446 # Partition Types 1370 1447 # 1371 - CONFIG_PARTITION_ADVANCED=y 1372 - # CONFIG_ACORN_PARTITION is not set 1373 - # CONFIG_OSF_PARTITION is not set 1374 - # CONFIG_AMIGA_PARTITION is not set 1375 - # CONFIG_ATARI_PARTITION is not set 1376 - # CONFIG_MAC_PARTITION is not set 1448 + # CONFIG_PARTITION_ADVANCED is not set 1377 1449 CONFIG_MSDOS_PARTITION=y 1378 - # CONFIG_BSD_DISKLABEL is not set 1379 - # CONFIG_MINIX_SUBPARTITION is not set 1380 - # CONFIG_SOLARIS_X86_PARTITION is not set 1381 - # CONFIG_UNIXWARE_DISKLABEL is not set 1382 - # CONFIG_LDM_PARTITION is not set 1383 - # CONFIG_SGI_PARTITION is not set 1384 - # CONFIG_ULTRIX_PARTITION is not set 1385 - # CONFIG_SUN_PARTITION is not set 1386 - # CONFIG_KARMA_PARTITION is not set 1387 - # CONFIG_EFI_PARTITION is not set 1388 1450 1389 1451 # 1390 1452 # Native Language Support 1391 1453 # 1392 1454 CONFIG_NLS=y 1393 - CONFIG_NLS_DEFAULT="iso8859-15" 1394 - # CONFIG_NLS_CODEPAGE_437 is not set 1455 + CONFIG_NLS_DEFAULT="iso8859-1" 1456 + CONFIG_NLS_CODEPAGE_437=y 1395 1457 # CONFIG_NLS_CODEPAGE_737 is not set 1396 1458 # CONFIG_NLS_CODEPAGE_775 is not set 1397 - CONFIG_NLS_CODEPAGE_850=y 1459 + # CONFIG_NLS_CODEPAGE_850 is not set 1398 1460 # CONFIG_NLS_CODEPAGE_852 is not set 1399 1461 # CONFIG_NLS_CODEPAGE_855 is not set 1400 1462 # CONFIG_NLS_CODEPAGE_857 is not set ··· 1399 1491 # CONFIG_NLS_ISO8859_8 is not set 1400 1492 # CONFIG_NLS_CODEPAGE_1250 is not set 1401 1493 # CONFIG_NLS_CODEPAGE_1251 is not set 1402 - # CONFIG_NLS_ASCII is not set 1494 + CONFIG_NLS_ASCII=y 1403 1495 CONFIG_NLS_ISO8859_1=y 1404 1496 # CONFIG_NLS_ISO8859_2 is not set 1405 1497 # CONFIG_NLS_ISO8859_3 is not set ··· 1418 1510 # 1419 1511 # Instrumentation Support 1420 1512 # 1421 - # CONFIG_PROFILING is not set 1422 - # CONFIG_KPROBES is not set 1513 + CONFIG_PROFILING=y 1514 + CONFIG_OPROFILE=y 1515 + CONFIG_KPROBES=y 1423 1516 1424 1517 # 1425 1518 # Kernel hacking 1426 1519 # 1520 + CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1427 1521 # CONFIG_PRINTK_TIME is not set 1428 1522 CONFIG_MAGIC_SYSRQ=y 1429 - # CONFIG_DEBUG_KERNEL is not set 1430 - CONFIG_LOG_BUF_SHIFT=14 1523 + CONFIG_UNUSED_SYMBOLS=y 1524 + CONFIG_DEBUG_KERNEL=y 1525 + CONFIG_LOG_BUF_SHIFT=18 1526 + CONFIG_DETECT_SOFTLOCKUP=y 1527 + # CONFIG_SCHEDSTATS is not set 1528 + # CONFIG_DEBUG_SLAB is not set 1529 + # CONFIG_DEBUG_RT_MUTEXES is not set 1530 + # CONFIG_RT_MUTEX_TESTER is not set 1531 + # CONFIG_DEBUG_SPINLOCK is not set 1532 + # CONFIG_DEBUG_MUTEXES is not set 1533 + # CONFIG_DEBUG_RWSEMS is not set 1534 + # CONFIG_DEBUG_LOCK_ALLOC is not set 1535 + # CONFIG_PROVE_LOCKING is not set 1536 + # CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1537 + # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1538 + # CONFIG_DEBUG_KOBJECT is not set 1539 + # CONFIG_DEBUG_HIGHMEM is not set 1431 1540 CONFIG_DEBUG_BUGVERBOSE=y 1541 + # CONFIG_DEBUG_INFO is not set 1542 + # CONFIG_DEBUG_FS is not set 1543 + # CONFIG_DEBUG_VM is not set 1544 + # CONFIG_FRAME_POINTER is not set 1545 + CONFIG_UNWIND_INFO=y 1546 + CONFIG_STACK_UNWIND=y 1547 + # CONFIG_FORCED_INLINING is not set 1548 + # CONFIG_RCU_TORTURE_TEST is not set 1432 1549 CONFIG_EARLY_PRINTK=y 1550 + CONFIG_DEBUG_STACKOVERFLOW=y 1551 + # CONFIG_DEBUG_STACK_USAGE is not set 1552 + # CONFIG_DEBUG_RODATA is not set 1553 + # CONFIG_4KSTACKS is not set 1433 1554 CONFIG_X86_FIND_SMP_CONFIG=y 1434 1555 CONFIG_X86_MPPARSE=y 1556 + CONFIG_DOUBLEFAULT=y 1435 1557 1436 1558 # 1437 1559 # Security options ··· 1475 1537 # CONFIG_CRYPTO is not set 1476 1538 1477 1539 # 1478 - # Hardware crypto devices 1479 - # 1480 - 1481 - # 1482 1540 # Library routines 1483 1541 # 1484 1542 # CONFIG_CRC_CCITT is not set ··· 1482 1548 CONFIG_CRC32=y 1483 1549 # CONFIG_LIBCRC32C is not set 1484 1550 CONFIG_ZLIB_INFLATE=y 1551 + CONFIG_PLIST=y 1485 1552 CONFIG_GENERIC_HARDIRQS=y 1486 1553 CONFIG_GENERIC_IRQ_PROBE=y 1554 + CONFIG_GENERIC_PENDING_IRQ=y 1555 + CONFIG_X86_SMP=y 1556 + CONFIG_X86_HT=y 1487 1557 CONFIG_X86_BIOS_REBOOT=y 1558 + CONFIG_X86_TRAMPOLINE=y 1488 1559 CONFIG_KTIME_SCALAR=y
+2 -1
arch/i386/kernel/Makefile
··· 4 4 5 5 extra-y := head.o init_task.o vmlinux.lds 6 6 7 - obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \ 7 + obj-y := process.o signal.o entry.o traps.o irq.o \ 8 8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \ 9 9 pci-dma.o i386_ksyms.o i387.o bootflag.o \ 10 10 quirks.o i8237.o topology.o alternative.o i8253.o tsc.o ··· 81 81 $(call if_changed,syscall) 82 82 83 83 k8-y += ../../x86_64/kernel/k8.o 84 + stacktrace-y += ../../x86_64/kernel/stacktrace.o 84 85
+2
arch/i386/kernel/acpi/Makefile
··· 1 1 obj-$(CONFIG_ACPI) += boot.o 2 + ifneq ($(CONFIG_PCI),) 2 3 obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o 4 + endif 3 5 obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o 4 6 5 7 ifneq ($(CONFIG_ACPI_PROCESSOR),)
+172 -9
arch/i386/kernel/acpi/boot.c
··· 26 26 #include <linux/init.h> 27 27 #include <linux/acpi.h> 28 28 #include <linux/efi.h> 29 + #include <linux/cpumask.h> 29 30 #include <linux/module.h> 30 31 #include <linux/dmi.h> 31 32 #include <linux/irq.h> 33 + #include <linux/bootmem.h> 34 + #include <linux/ioport.h> 32 35 33 36 #include <asm/pgtable.h> 34 37 #include <asm/io_apic.h> ··· 39 36 #include <asm/io.h> 40 37 #include <asm/mpspec.h> 41 38 39 + static int __initdata acpi_force = 0; 40 + 41 + #ifdef CONFIG_ACPI 42 + int acpi_disabled = 0; 43 + #else 44 + int acpi_disabled = 1; 45 + #endif 46 + EXPORT_SYMBOL(acpi_disabled); 47 + 42 48 #ifdef CONFIG_X86_64 43 49 44 - extern void __init clustered_apic_check(void); 45 - 46 - extern int gsi_irq_sharing(int gsi); 47 50 #include <asm/proto.h> 48 51 49 52 static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) { return 0; } ··· 515 506 #ifdef CONFIG_ACPI_HOTPLUG_CPU 516 507 int acpi_map_lsapic(acpi_handle handle, int *pcpu) 517 508 { 518 - /* TBD */ 519 - return -EINVAL; 509 + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 510 + union acpi_object *obj; 511 + struct acpi_table_lapic *lapic; 512 + cpumask_t tmp_map, new_map; 513 + u8 physid; 514 + int cpu; 515 + 516 + if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) 517 + return -EINVAL; 518 + 519 + if (!buffer.length || !buffer.pointer) 520 + return -EINVAL; 521 + 522 + obj = buffer.pointer; 523 + if (obj->type != ACPI_TYPE_BUFFER || 524 + obj->buffer.length < sizeof(*lapic)) { 525 + kfree(buffer.pointer); 526 + return -EINVAL; 527 + } 528 + 529 + lapic = (struct acpi_table_lapic *)obj->buffer.pointer; 530 + 531 + if ((lapic->header.type != ACPI_MADT_LAPIC) || 532 + (!lapic->flags.enabled)) { 533 + kfree(buffer.pointer); 534 + return -EINVAL; 535 + } 536 + 537 + physid = lapic->id; 538 + 539 + kfree(buffer.pointer); 540 + buffer.length = ACPI_ALLOCATE_BUFFER; 541 + buffer.pointer = NULL; 542 + 543 + tmp_map = cpu_present_map; 544 + mp_register_lapic(physid, lapic->flags.enabled); 545 + 546 + /* 547 + * If mp_register_lapic successfully generates a new logical cpu 548 + * number, then the following will get us exactly what was mapped 549 + */ 550 + cpus_andnot(new_map, cpu_present_map, tmp_map); 551 + if (cpus_empty(new_map)) { 552 + printk ("Unable to map lapic to logical cpu number\n"); 553 + return -EINVAL; 554 + } 555 + 556 + cpu = first_cpu(new_map); 557 + 558 + *pcpu = cpu; 559 + return 0; 520 560 } 521 561 522 562 EXPORT_SYMBOL(acpi_map_lsapic); 523 563 524 564 int acpi_unmap_lsapic(int cpu) 525 565 { 526 - /* TBD */ 527 - return -EINVAL; 566 + int i; 567 + 568 + for_each_possible_cpu(i) { 569 + if (x86_acpiid_to_apicid[i] == x86_cpu_to_apicid[cpu]) { 570 + x86_acpiid_to_apicid[i] = -1; 571 + break; 572 + } 573 + } 574 + x86_cpu_to_apicid[cpu] = -1; 575 + cpu_clear(cpu, cpu_present_map); 576 + num_processors--; 577 + 578 + return (0); 528 579 } 529 580 530 581 EXPORT_SYMBOL(acpi_unmap_lsapic); ··· 648 579 static int __init acpi_parse_hpet(unsigned long phys, unsigned long size) 649 580 { 650 581 struct acpi_table_hpet *hpet_tbl; 582 + struct resource *hpet_res; 583 + resource_size_t res_start; 651 584 652 585 if (!phys || !size) 653 586 return -EINVAL; ··· 665 594 "memory.\n"); 666 595 return -1; 667 596 } 597 + 598 + #define HPET_RESOURCE_NAME_SIZE 9 599 + hpet_res = alloc_bootmem(sizeof(*hpet_res) + HPET_RESOURCE_NAME_SIZE); 600 + if (hpet_res) { 601 + memset(hpet_res, 0, sizeof(*hpet_res)); 602 + hpet_res->name = (void *)&hpet_res[1]; 603 + hpet_res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; 604 + snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE, 605 + "HPET %u", hpet_tbl->number); 606 + hpet_res->end = (1 * 1024) - 1; 607 + } 608 + 668 609 #ifdef CONFIG_X86_64 669 610 vxtime.hpet_address = hpet_tbl->addr.addrl | 670 611 ((long)hpet_tbl->addr.addrh << 32); 671 612 672 613 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 673 614 hpet_tbl->id, vxtime.hpet_address); 615 + 616 + res_start = vxtime.hpet_address; 674 617 #else /* X86 */ 675 618 { 676 619 extern unsigned long hpet_address; ··· 692 607 hpet_address = hpet_tbl->addr.addrl; 693 608 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 694 609 hpet_tbl->id, hpet_address); 610 + 611 + res_start = hpet_address; 695 612 } 696 613 #endif /* X86 */ 614 + 615 + if (hpet_res) { 616 + hpet_res->start = res_start; 617 + hpet_res->end += res_start; 618 + insert_resource(&iomem_resource, hpet_res); 619 + } 697 620 698 621 return 0; 699 622 } ··· 952 859 #endif 953 860 return; 954 861 } 955 - 956 - extern int acpi_force; 957 862 958 863 #ifdef __i386__ 959 864 ··· 1254 1163 1255 1164 return 0; 1256 1165 } 1166 + 1167 + static int __init parse_acpi(char *arg) 1168 + { 1169 + if (!arg) 1170 + return -EINVAL; 1171 + 1172 + /* "acpi=off" disables both ACPI table parsing and interpreter */ 1173 + if (strcmp(arg, "off") == 0) { 1174 + disable_acpi(); 1175 + } 1176 + /* acpi=force to over-ride black-list */ 1177 + else if (strcmp(arg, "force") == 0) { 1178 + acpi_force = 1; 1179 + acpi_ht = 1; 1180 + acpi_disabled = 0; 1181 + } 1182 + /* acpi=strict disables out-of-spec workarounds */ 1183 + else if (strcmp(arg, "strict") == 0) { 1184 + acpi_strict = 1; 1185 + } 1186 + /* Limit ACPI just to boot-time to enable HT */ 1187 + else if (strcmp(arg, "ht") == 0) { 1188 + if (!acpi_force) 1189 + disable_acpi(); 1190 + acpi_ht = 1; 1191 + } 1192 + /* "acpi=noirq" disables ACPI interrupt routing */ 1193 + else if (strcmp(arg, "noirq") == 0) { 1194 + acpi_noirq_set(); 1195 + } else { 1196 + /* Core will printk when we return error. */ 1197 + return -EINVAL; 1198 + } 1199 + return 0; 1200 + } 1201 + early_param("acpi", parse_acpi); 1202 + 1203 + /* FIXME: Using pci= for an ACPI parameter is a travesty. */ 1204 + static int __init parse_pci(char *arg) 1205 + { 1206 + if (arg && strcmp(arg, "noacpi") == 0) 1207 + acpi_disable_pci(); 1208 + return 0; 1209 + } 1210 + early_param("pci", parse_pci); 1211 + 1212 + #ifdef CONFIG_X86_IO_APIC 1213 + static int __init parse_acpi_skip_timer_override(char *arg) 1214 + { 1215 + acpi_skip_timer_override = 1; 1216 + return 0; 1217 + } 1218 + early_param("acpi_skip_timer_override", parse_acpi_skip_timer_override); 1219 + #endif /* CONFIG_X86_IO_APIC */ 1220 + 1221 + static int __init setup_acpi_sci(char *s) 1222 + { 1223 + if (!s) 1224 + return -EINVAL; 1225 + if (!strcmp(s, "edge")) 1226 + acpi_sci_flags.trigger = 1; 1227 + else if (!strcmp(s, "level")) 1228 + acpi_sci_flags.trigger = 3; 1229 + else if (!strcmp(s, "high")) 1230 + acpi_sci_flags.polarity = 1; 1231 + else if (!strcmp(s, "low")) 1232 + acpi_sci_flags.polarity = 3; 1233 + else 1234 + return -EINVAL; 1235 + return 0; 1236 + } 1237 + early_param("acpi_sci", setup_acpi_sci);
+5 -1
arch/i386/kernel/acpi/earlyquirk.c
··· 48 48 int num, slot, func; 49 49 50 50 /* Assume the machine supports type 1. If not it will 51 - always read ffffffff and should not have any side effect. */ 51 + always read ffffffff and should not have any side effect. 52 + Actually a few buggy systems can machine check. Allow the user 53 + to disable it by command line option at least -AK */ 54 + if (!early_pci_allowed()) 55 + return; 52 56 53 57 /* Poor man's PCI discovery */ 54 58 for (num = 0; num < 32; num++) {
+28 -3
arch/i386/kernel/apic.c
··· 52 52 /* 53 53 * Knob to control our willingness to enable the local APIC. 54 54 */ 55 - int enable_local_apic __initdata = 0; /* -1=force-disable, +1=force-enable */ 55 + static int enable_local_apic __initdata = 0; /* -1=force-disable, +1=force-enable */ 56 + 57 + static inline void lapic_disable(void) 58 + { 59 + enable_local_apic = -1; 60 + clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability); 61 + } 62 + 63 + static inline void lapic_enable(void) 64 + { 65 + enable_local_apic = 1; 66 + } 56 67 57 68 /* 58 69 * Debug level ··· 597 586 printk("No ESR for 82489DX.\n"); 598 587 } 599 588 600 - if (nmi_watchdog == NMI_LOCAL_APIC) 601 - setup_apic_nmi_watchdog(); 589 + setup_apic_nmi_watchdog(NULL); 602 590 apic_pm_activate(); 603 591 } 604 592 ··· 1383 1373 1384 1374 return 0; 1385 1375 } 1376 + 1377 + static int __init parse_lapic(char *arg) 1378 + { 1379 + lapic_enable(); 1380 + return 0; 1381 + } 1382 + early_param("lapic", parse_lapic); 1383 + 1384 + static int __init parse_nolapic(char *arg) 1385 + { 1386 + lapic_disable(); 1387 + return 0; 1388 + } 1389 + early_param("nolapic", parse_nolapic); 1390 +
+3 -4
arch/i386/kernel/cpu/amd.c
··· 22 22 extern void vide(void); 23 23 __asm__(".align 4\nvide: ret"); 24 24 25 - static void __init init_amd(struct cpuinfo_x86 *c) 25 + static void __cpuinit init_amd(struct cpuinfo_x86 *c) 26 26 { 27 27 u32 l, h; 28 28 int mbytes = num_physpages >> (20-PAGE_SHIFT); ··· 246 246 num_cache_leaves = 3; 247 247 } 248 248 249 - static unsigned int amd_size_cache(struct cpuinfo_x86 * c, unsigned int size) 249 + static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 * c, unsigned int size) 250 250 { 251 251 /* AMD errata T13 (order #21922) */ 252 252 if ((c->x86 == 6)) { ··· 259 259 return size; 260 260 } 261 261 262 - static struct cpu_dev amd_cpu_dev __initdata = { 262 + static struct cpu_dev amd_cpu_dev __cpuinitdata = { 263 263 .c_vendor = "AMD", 264 264 .c_ident = { "AuthenticAMD" }, 265 265 .c_models = { ··· 275 275 }, 276 276 }, 277 277 .c_init = init_amd, 278 - .c_identify = generic_identify, 279 278 .c_size_cache = amd_size_cache, 280 279 }; 281 280
+12 -12
arch/i386/kernel/cpu/centaur.c
··· 9 9 10 10 #ifdef CONFIG_X86_OOSTORE 11 11 12 - static u32 __init power2(u32 x) 12 + static u32 __cpuinit power2(u32 x) 13 13 { 14 14 u32 s=1; 15 15 while(s<=x) ··· 22 22 * Set up an actual MCR 23 23 */ 24 24 25 - static void __init centaur_mcr_insert(int reg, u32 base, u32 size, int key) 25 + static void __cpuinit centaur_mcr_insert(int reg, u32 base, u32 size, int key) 26 26 { 27 27 u32 lo, hi; 28 28 ··· 40 40 * Shortcut: We know you can't put 4Gig of RAM on a winchip 41 41 */ 42 42 43 - static u32 __init ramtop(void) /* 16388 */ 43 + static u32 __cpuinit ramtop(void) /* 16388 */ 44 44 { 45 45 int i; 46 46 u32 top = 0; ··· 91 91 * Compute a set of MCR's to give maximum coverage 92 92 */ 93 93 94 - static int __init centaur_mcr_compute(int nr, int key) 94 + static int __cpuinit centaur_mcr_compute(int nr, int key) 95 95 { 96 96 u32 mem = ramtop(); 97 97 u32 root = power2(mem); ··· 166 166 return ct; 167 167 } 168 168 169 - static void __init centaur_create_optimal_mcr(void) 169 + static void __cpuinit centaur_create_optimal_mcr(void) 170 170 { 171 171 int i; 172 172 /* ··· 189 189 wrmsr(MSR_IDT_MCR0+i, 0, 0); 190 190 } 191 191 192 - static void __init winchip2_create_optimal_mcr(void) 192 + static void __cpuinit winchip2_create_optimal_mcr(void) 193 193 { 194 194 u32 lo, hi; 195 195 int i; ··· 227 227 * Handle the MCR key on the Winchip 2. 228 228 */ 229 229 230 - static void __init winchip2_unprotect_mcr(void) 230 + static void __cpuinit winchip2_unprotect_mcr(void) 231 231 { 232 232 u32 lo, hi; 233 233 u32 key; ··· 239 239 wrmsr(MSR_IDT_MCR_CTRL, lo, hi); 240 240 } 241 241 242 - static void __init winchip2_protect_mcr(void) 242 + static void __cpuinit winchip2_protect_mcr(void) 243 243 { 244 244 u32 lo, hi; 245 245 ··· 257 257 #define RNG_ENABLED (1 << 3) 258 258 #define RNG_ENABLE (1 << 6) /* MSR_VIA_RNG */ 259 259 260 - static void __init init_c3(struct cpuinfo_x86 *c) 260 + static void __cpuinit init_c3(struct cpuinfo_x86 *c) 261 261 { 262 262 u32 lo, hi; 263 263 ··· 303 303 display_cacheinfo(c); 304 304 } 305 305 306 - static void __init init_centaur(struct cpuinfo_x86 *c) 306 + static void __cpuinit init_centaur(struct cpuinfo_x86 *c) 307 307 { 308 308 enum { 309 309 ECX8=1<<1, ··· 442 442 } 443 443 } 444 444 445 - static unsigned int centaur_size_cache(struct cpuinfo_x86 * c, unsigned int size) 445 + static unsigned int __cpuinit centaur_size_cache(struct cpuinfo_x86 * c, unsigned int size) 446 446 { 447 447 /* VIA C3 CPUs (670-68F) need further shifting. */ 448 448 if ((c->x86 == 6) && ((c->x86_model == 7) || (c->x86_model == 8))) ··· 457 457 return size; 458 458 } 459 459 460 - static struct cpu_dev centaur_cpu_dev __initdata = { 460 + static struct cpu_dev centaur_cpu_dev __cpuinitdata = { 461 461 .c_vendor = "Centaur", 462 462 .c_ident = { "CentaurHauls" }, 463 463 .c_init = init_centaur,
+4 -4
arch/i386/kernel/cpu/common.c
··· 36 36 37 37 extern int disable_pse; 38 38 39 - static void default_init(struct cpuinfo_x86 * c) 39 + static void __cpuinit default_init(struct cpuinfo_x86 * c) 40 40 { 41 41 /* Not much we can do here... */ 42 42 /* Check if at least it has cpuid */ ··· 49 49 } 50 50 } 51 51 52 - static struct cpu_dev default_cpu = { 52 + static struct cpu_dev __cpuinitdata default_cpu = { 53 53 .c_init = default_init, 54 54 .c_vendor = "Unknown", 55 55 }; ··· 265 265 } 266 266 } 267 267 268 - void __cpuinit generic_identify(struct cpuinfo_x86 * c) 268 + static void __cpuinit generic_identify(struct cpuinfo_x86 * c) 269 269 { 270 270 u32 tfms, xlvl; 271 271 int ebx; ··· 675 675 #endif 676 676 677 677 /* Clear %fs and %gs. */ 678 - asm volatile ("xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs"); 678 + asm volatile ("movl %0, %%fs; movl %0, %%gs" : : "r" (0)); 679 679 680 680 /* Clear all 6 debug registers: */ 681 681 set_debugreg(0, 0);
-2
arch/i386/kernel/cpu/cpu.h
··· 24 24 extern int get_model_name(struct cpuinfo_x86 *c); 25 25 extern void display_cacheinfo(struct cpuinfo_x86 *c); 26 26 27 - extern void generic_identify(struct cpuinfo_x86 * c); 28 - 29 27 extern void early_intel_workaround(struct cpuinfo_x86 *c); 30 28
+20 -22
arch/i386/kernel/cpu/cyrix.c
··· 12 12 /* 13 13 * Read NSC/Cyrix DEVID registers (DIR) to get more detailed info. about the CPU 14 14 */ 15 - static void __init do_cyrix_devid(unsigned char *dir0, unsigned char *dir1) 15 + static void __cpuinit do_cyrix_devid(unsigned char *dir0, unsigned char *dir1) 16 16 { 17 17 unsigned char ccr2, ccr3; 18 18 unsigned long flags; ··· 52 52 * Actually since bugs.h doesn't even reference this perhaps someone should 53 53 * fix the documentation ??? 54 54 */ 55 - static unsigned char Cx86_dir0_msb __initdata = 0; 55 + static unsigned char Cx86_dir0_msb __cpuinitdata = 0; 56 56 57 - static char Cx86_model[][9] __initdata = { 57 + static char Cx86_model[][9] __cpuinitdata = { 58 58 "Cx486", "Cx486", "5x86 ", "6x86", "MediaGX ", "6x86MX ", 59 59 "M II ", "Unknown" 60 60 }; 61 - static char Cx486_name[][5] __initdata = { 61 + static char Cx486_name[][5] __cpuinitdata = { 62 62 "SLC", "DLC", "SLC2", "DLC2", "SRx", "DRx", 63 63 "SRx2", "DRx2" 64 64 }; 65 - static char Cx486S_name[][4] __initdata = { 65 + static char Cx486S_name[][4] __cpuinitdata = { 66 66 "S", "S2", "Se", "S2e" 67 67 }; 68 - static char Cx486D_name[][4] __initdata = { 68 + static char Cx486D_name[][4] __cpuinitdata = { 69 69 "DX", "DX2", "?", "?", "?", "DX4" 70 70 }; 71 - static char Cx86_cb[] __initdata = "?.5x Core/Bus Clock"; 72 - static char cyrix_model_mult1[] __initdata = "12??43"; 73 - static char cyrix_model_mult2[] __initdata = "12233445"; 71 + static char Cx86_cb[] __cpuinitdata = "?.5x Core/Bus Clock"; 72 + static char cyrix_model_mult1[] __cpuinitdata = "12??43"; 73 + static char cyrix_model_mult2[] __cpuinitdata = "12233445"; 74 74 75 75 /* 76 76 * Reset the slow-loop (SLOP) bit on the 686(L) which is set by some old ··· 82 82 83 83 extern void calibrate_delay(void) __init; 84 84 85 - static void __init check_cx686_slop(struct cpuinfo_x86 *c) 85 + static void __cpuinit check_cx686_slop(struct cpuinfo_x86 *c) 86 86 { 87 87 unsigned long flags; 88 88 ··· 107 107 } 108 108 109 109 110 - static void __init set_cx86_reorder(void) 110 + static void __cpuinit set_cx86_reorder(void) 111 111 { 112 112 u8 ccr3; 113 113 ··· 122 122 setCx86(CX86_CCR3, ccr3); 123 123 } 124 124 125 - static void __init set_cx86_memwb(void) 125 + static void __cpuinit set_cx86_memwb(void) 126 126 { 127 127 u32 cr0; 128 128 ··· 137 137 setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x14 ); 138 138 } 139 139 140 - static void __init set_cx86_inc(void) 140 + static void __cpuinit set_cx86_inc(void) 141 141 { 142 142 unsigned char ccr3; 143 143 ··· 158 158 * Configure later MediaGX and/or Geode processor. 159 159 */ 160 160 161 - static void __init geode_configure(void) 161 + static void __cpuinit geode_configure(void) 162 162 { 163 163 unsigned long flags; 164 164 u8 ccr3, ccr4; ··· 184 184 185 185 186 186 #ifdef CONFIG_PCI 187 - static struct pci_device_id __initdata cyrix_55x0[] = { 187 + static struct pci_device_id __cpuinitdata cyrix_55x0[] = { 188 188 { PCI_DEVICE(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5510) }, 189 189 { PCI_DEVICE(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5520) }, 190 190 { }, 191 191 }; 192 192 #endif 193 193 194 - static void __init init_cyrix(struct cpuinfo_x86 *c) 194 + static void __cpuinit init_cyrix(struct cpuinfo_x86 *c) 195 195 { 196 196 unsigned char dir0, dir0_msn, dir0_lsn, dir1 = 0; 197 197 char *buf = c->x86_model_id; ··· 346 346 /* 347 347 * Handle National Semiconductor branded processors 348 348 */ 349 - static void __init init_nsc(struct cpuinfo_x86 *c) 349 + static void __cpuinit init_nsc(struct cpuinfo_x86 *c) 350 350 { 351 351 /* There may be GX1 processors in the wild that are branded 352 352 * NSC and not Cyrix. ··· 394 394 return (unsigned char) (test >> 8) == 0x02; 395 395 } 396 396 397 - static void cyrix_identify(struct cpuinfo_x86 * c) 397 + static void __cpuinit cyrix_identify(struct cpuinfo_x86 * c) 398 398 { 399 399 /* Detect Cyrix with disabled CPUID */ 400 400 if ( c->x86 == 4 && test_cyrix_52div() ) { ··· 427 427 local_irq_restore(flags); 428 428 } 429 429 } 430 - generic_identify(c); 431 430 } 432 431 433 - static struct cpu_dev cyrix_cpu_dev __initdata = { 432 + static struct cpu_dev cyrix_cpu_dev __cpuinitdata = { 434 433 .c_vendor = "Cyrix", 435 434 .c_ident = { "CyrixInstead" }, 436 435 .c_init = init_cyrix, ··· 452 453 453 454 late_initcall(cyrix_exit_cpu); 454 455 455 - static struct cpu_dev nsc_cpu_dev __initdata = { 456 + static struct cpu_dev nsc_cpu_dev __cpuinitdata = { 456 457 .c_vendor = "NSC", 457 458 .c_ident = { "Geode by NSC" }, 458 459 .c_init = init_nsc, 459 - .c_identify = generic_identify, 460 460 }; 461 461 462 462 int __init nsc_init_cpu(void)
+1 -2
arch/i386/kernel/cpu/intel.c
··· 198 198 } 199 199 200 200 201 - static unsigned int intel_size_cache(struct cpuinfo_x86 * c, unsigned int size) 201 + static unsigned int __cpuinit intel_size_cache(struct cpuinfo_x86 * c, unsigned int size) 202 202 { 203 203 /* Intel PIII Tualatin. This comes in two flavours. 204 204 * One has 256kb of cache, the other 512. We have no way ··· 263 263 }, 264 264 }, 265 265 .c_init = init_intel, 266 - .c_identify = generic_identify, 267 266 .c_size_cache = intel_size_cache, 268 267 }; 269 268
+1 -1
arch/i386/kernel/cpu/mcheck/Makefile
··· 1 - obj-y = mce.o k7.o p4.o p5.o p6.o winchip.o 1 + obj-y = mce.o k7.o p4.o p5.o p6.o winchip.o therm_throt.o 2 2 obj-$(CONFIG_X86_MCE_NONFATAL) += non-fatal.o
+9 -17
arch/i386/kernel/cpu/mcheck/p4.c
··· 13 13 #include <asm/msr.h> 14 14 #include <asm/apic.h> 15 15 16 + #include <asm/therm_throt.h> 17 + 16 18 #include "mce.h" 17 19 18 20 /* as supported by the P4/Xeon family */ ··· 46 44 /* P4/Xeon Thermal transition interrupt handler */ 47 45 static void intel_thermal_interrupt(struct pt_regs *regs) 48 46 { 49 - u32 l, h; 50 - unsigned int cpu = smp_processor_id(); 51 - static unsigned long next[NR_CPUS]; 47 + __u64 msr_val; 52 48 53 49 ack_APIC_irq(); 54 50 55 - if (time_after(next[cpu], jiffies)) 56 - return; 57 - 58 - next[cpu] = jiffies + HZ*5; 59 - rdmsr(MSR_IA32_THERM_STATUS, l, h); 60 - if (l & 0x1) { 61 - printk(KERN_EMERG "CPU%d: Temperature above threshold\n", cpu); 62 - printk(KERN_EMERG "CPU%d: Running in modulated clock mode\n", 63 - cpu); 64 - add_taint(TAINT_MACHINE_CHECK); 65 - } else { 66 - printk(KERN_INFO "CPU%d: Temperature/speed normal\n", cpu); 67 - } 51 + rdmsrl(MSR_IA32_THERM_STATUS, msr_val); 52 + therm_throt_process(msr_val & 0x1); 68 53 } 69 54 70 55 /* Thermal interrupt handler for this CPU setup */ ··· 111 122 112 123 rdmsr (MSR_IA32_MISC_ENABLE, l, h); 113 124 wrmsr (MSR_IA32_MISC_ENABLE, l | (1<<3), h); 114 - 125 + 115 126 l = apic_read (APIC_LVTTHMR); 116 127 apic_write_around (APIC_LVTTHMR, l & ~APIC_LVT_MASKED); 117 128 printk (KERN_INFO "CPU%d: Thermal monitoring enabled\n", cpu); 129 + 130 + /* enable thermal throttle processing */ 131 + atomic_set(&therm_throt_en, 1); 118 132 return; 119 133 } 120 134 #endif /* CONFIG_X86_MCE_P4THERMAL */
+180
arch/i386/kernel/cpu/mcheck/therm_throt.c
··· 1 + /* 2 + * linux/arch/i386/kerne/cpu/mcheck/therm_throt.c 3 + * 4 + * Thermal throttle event support code (such as syslog messaging and rate 5 + * limiting) that was factored out from x86_64 (mce_intel.c) and i386 (p4.c). 6 + * This allows consistent reporting of CPU thermal throttle events. 7 + * 8 + * Maintains a counter in /sys that keeps track of the number of thermal 9 + * events, such that the user knows how bad the thermal problem might be 10 + * (since the logging to syslog and mcelog is rate limited). 11 + * 12 + * Author: Dmitriy Zavin (dmitriyz@google.com) 13 + * 14 + * Credits: Adapted from Zwane Mwaikambo's original code in mce_intel.c. 15 + * Inspired by Ross Biro's and Al Borchers' counter code. 16 + */ 17 + 18 + #include <linux/percpu.h> 19 + #include <linux/sysdev.h> 20 + #include <linux/cpu.h> 21 + #include <asm/cpu.h> 22 + #include <linux/notifier.h> 23 + #include <asm/therm_throt.h> 24 + 25 + /* How long to wait between reporting thermal events */ 26 + #define CHECK_INTERVAL (300 * HZ) 27 + 28 + static DEFINE_PER_CPU(__u64, next_check) = INITIAL_JIFFIES; 29 + static DEFINE_PER_CPU(unsigned long, thermal_throttle_count); 30 + atomic_t therm_throt_en = ATOMIC_INIT(0); 31 + 32 + #ifdef CONFIG_SYSFS 33 + #define define_therm_throt_sysdev_one_ro(_name) \ 34 + static SYSDEV_ATTR(_name, 0444, therm_throt_sysdev_show_##_name, NULL) 35 + 36 + #define define_therm_throt_sysdev_show_func(name) \ 37 + static ssize_t therm_throt_sysdev_show_##name(struct sys_device *dev, \ 38 + char *buf) \ 39 + { \ 40 + unsigned int cpu = dev->id; \ 41 + ssize_t ret; \ 42 + \ 43 + preempt_disable(); /* CPU hotplug */ \ 44 + if (cpu_online(cpu)) \ 45 + ret = sprintf(buf, "%lu\n", \ 46 + per_cpu(thermal_throttle_##name, cpu)); \ 47 + else \ 48 + ret = 0; \ 49 + preempt_enable(); \ 50 + \ 51 + return ret; \ 52 + } 53 + 54 + define_therm_throt_sysdev_show_func(count); 55 + define_therm_throt_sysdev_one_ro(count); 56 + 57 + static struct attribute *thermal_throttle_attrs[] = { 58 + &attr_count.attr, 59 + NULL 60 + }; 61 + 62 + static struct attribute_group thermal_throttle_attr_group = { 63 + .attrs = thermal_throttle_attrs, 64 + .name = "thermal_throttle" 65 + }; 66 + #endif /* CONFIG_SYSFS */ 67 + 68 + /*** 69 + * therm_throt_process - Process thermal throttling event from interrupt 70 + * @curr: Whether the condition is current or not (boolean), since the 71 + * thermal interrupt normally gets called both when the thermal 72 + * event begins and once the event has ended. 73 + * 74 + * This function is called by the thermal interrupt after the 75 + * IRQ has been acknowledged. 76 + * 77 + * It will take care of rate limiting and printing messages to the syslog. 78 + * 79 + * Returns: 0 : Event should NOT be further logged, i.e. still in 80 + * "timeout" from previous log message. 81 + * 1 : Event should be logged further, and a message has been 82 + * printed to the syslog. 83 + */ 84 + int therm_throt_process(int curr) 85 + { 86 + unsigned int cpu = smp_processor_id(); 87 + __u64 tmp_jiffs = get_jiffies_64(); 88 + 89 + if (curr) 90 + __get_cpu_var(thermal_throttle_count)++; 91 + 92 + if (time_before64(tmp_jiffs, __get_cpu_var(next_check))) 93 + return 0; 94 + 95 + __get_cpu_var(next_check) = tmp_jiffs + CHECK_INTERVAL; 96 + 97 + /* if we just entered the thermal event */ 98 + if (curr) { 99 + printk(KERN_CRIT "CPU%d: Temperature above threshold, " 100 + "cpu clock throttled (total events = %lu)\n", cpu, 101 + __get_cpu_var(thermal_throttle_count)); 102 + 103 + add_taint(TAINT_MACHINE_CHECK); 104 + } else { 105 + printk(KERN_CRIT "CPU%d: Temperature/speed normal\n", cpu); 106 + } 107 + 108 + return 1; 109 + } 110 + 111 + #ifdef CONFIG_SYSFS 112 + /* Add/Remove thermal_throttle interface for CPU device */ 113 + static __cpuinit int thermal_throttle_add_dev(struct sys_device * sys_dev) 114 + { 115 + sysfs_create_group(&sys_dev->kobj, &thermal_throttle_attr_group); 116 + return 0; 117 + } 118 + 119 + #ifdef CONFIG_HOTPLUG_CPU 120 + static __cpuinit int thermal_throttle_remove_dev(struct sys_device * sys_dev) 121 + { 122 + sysfs_remove_group(&sys_dev->kobj, &thermal_throttle_attr_group); 123 + return 0; 124 + } 125 + 126 + /* Mutex protecting device creation against CPU hotplug */ 127 + static DEFINE_MUTEX(therm_cpu_lock); 128 + 129 + /* Get notified when a cpu comes on/off. Be hotplug friendly. */ 130 + static __cpuinit int thermal_throttle_cpu_callback(struct notifier_block *nfb, 131 + unsigned long action, 132 + void *hcpu) 133 + { 134 + unsigned int cpu = (unsigned long)hcpu; 135 + struct sys_device *sys_dev; 136 + 137 + sys_dev = get_cpu_sysdev(cpu); 138 + mutex_lock(&therm_cpu_lock); 139 + switch (action) { 140 + case CPU_ONLINE: 141 + thermal_throttle_add_dev(sys_dev); 142 + break; 143 + case CPU_DEAD: 144 + thermal_throttle_remove_dev(sys_dev); 145 + break; 146 + } 147 + mutex_unlock(&therm_cpu_lock); 148 + return NOTIFY_OK; 149 + } 150 + 151 + static struct notifier_block thermal_throttle_cpu_notifier = 152 + { 153 + .notifier_call = thermal_throttle_cpu_callback, 154 + }; 155 + #endif /* CONFIG_HOTPLUG_CPU */ 156 + 157 + static __init int thermal_throttle_init_device(void) 158 + { 159 + unsigned int cpu = 0; 160 + 161 + if (!atomic_read(&therm_throt_en)) 162 + return 0; 163 + 164 + register_hotcpu_notifier(&thermal_throttle_cpu_notifier); 165 + 166 + #ifdef CONFIG_HOTPLUG_CPU 167 + mutex_lock(&therm_cpu_lock); 168 + #endif 169 + /* connect live CPUs to sysfs */ 170 + for_each_online_cpu(cpu) 171 + thermal_throttle_add_dev(get_cpu_sysdev(cpu)); 172 + #ifdef CONFIG_HOTPLUG_CPU 173 + mutex_unlock(&therm_cpu_lock); 174 + #endif 175 + 176 + return 0; 177 + } 178 + 179 + device_initcall(thermal_throttle_init_device); 180 + #endif /* CONFIG_SYSFS */
+4 -5
arch/i386/kernel/cpu/nexgen.c
··· 10 10 * to have CPUID. (Thanks to Herbert Oppmann) 11 11 */ 12 12 13 - static int __init deep_magic_nexgen_probe(void) 13 + static int __cpuinit deep_magic_nexgen_probe(void) 14 14 { 15 15 int ret; 16 16 ··· 27 27 return ret; 28 28 } 29 29 30 - static void __init init_nexgen(struct cpuinfo_x86 * c) 30 + static void __cpuinit init_nexgen(struct cpuinfo_x86 * c) 31 31 { 32 32 c->x86_cache_size = 256; /* A few had 1 MB... */ 33 33 } 34 34 35 - static void __init nexgen_identify(struct cpuinfo_x86 * c) 35 + static void __cpuinit nexgen_identify(struct cpuinfo_x86 * c) 36 36 { 37 37 /* Detect NexGen with old hypercode */ 38 38 if ( deep_magic_nexgen_probe() ) { 39 39 strcpy(c->x86_vendor_id, "NexGenDriven"); 40 40 } 41 - generic_identify(c); 42 41 } 43 42 44 - static struct cpu_dev nexgen_cpu_dev __initdata = { 43 + static struct cpu_dev nexgen_cpu_dev __cpuinitdata = { 45 44 .c_vendor = "Nexgen", 46 45 .c_ident = { "NexGenDriven" }, 47 46 .c_models = {
+2 -2
arch/i386/kernel/cpu/proc.c
··· 46 46 47 47 /* Intel-defined (#2) */ 48 48 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", 49 - "tm2", NULL, "cid", NULL, NULL, "cx16", "xtpr", NULL, 50 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 49 + "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, 50 + NULL, NULL, "dca", NULL, NULL, NULL, NULL, NULL, 51 51 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 52 52 53 53 /* VIA/Cyrix/Centaur-defined */
+2 -2
arch/i386/kernel/cpu/rise.c
··· 5 5 6 6 #include "cpu.h" 7 7 8 - static void __init init_rise(struct cpuinfo_x86 *c) 8 + static void __cpuinit init_rise(struct cpuinfo_x86 *c) 9 9 { 10 10 printk("CPU: Rise iDragon"); 11 11 if (c->x86_model > 2) ··· 28 28 set_bit(X86_FEATURE_CX8, c->x86_capability); 29 29 } 30 30 31 - static struct cpu_dev rise_cpu_dev __initdata = { 31 + static struct cpu_dev rise_cpu_dev __cpuinitdata = { 32 32 .c_vendor = "Rise", 33 33 .c_ident = { "RiseRiseRise" }, 34 34 .c_models = {
+3 -4
arch/i386/kernel/cpu/transmeta.c
··· 5 5 #include <asm/msr.h> 6 6 #include "cpu.h" 7 7 8 - static void __init init_transmeta(struct cpuinfo_x86 *c) 8 + static void __cpuinit init_transmeta(struct cpuinfo_x86 *c) 9 9 { 10 10 unsigned int cap_mask, uk, max, dummy; 11 11 unsigned int cms_rev1, cms_rev2; ··· 85 85 #endif 86 86 } 87 87 88 - static void __init transmeta_identify(struct cpuinfo_x86 * c) 88 + static void __cpuinit transmeta_identify(struct cpuinfo_x86 * c) 89 89 { 90 90 u32 xlvl; 91 - generic_identify(c); 92 91 93 92 /* Transmeta-defined flags: level 0x80860001 */ 94 93 xlvl = cpuid_eax(0x80860000); ··· 97 98 } 98 99 } 99 100 100 - static struct cpu_dev transmeta_cpu_dev __initdata = { 101 + static struct cpu_dev transmeta_cpu_dev __cpuinitdata = { 101 102 .c_vendor = "Transmeta", 102 103 .c_ident = { "GenuineTMx86", "TransmetaCPU" }, 103 104 .c_init = init_transmeta,
+1 -6
arch/i386/kernel/cpu/umc.c
··· 5 5 6 6 /* UMC chips appear to be only either 386 or 486, so no special init takes place. 7 7 */ 8 - static void __init init_umc(struct cpuinfo_x86 * c) 9 - { 10 8 11 - } 12 - 13 - static struct cpu_dev umc_cpu_dev __initdata = { 9 + static struct cpu_dev umc_cpu_dev __cpuinitdata = { 14 10 .c_vendor = "UMC", 15 11 .c_ident = { "UMC UMC UMC" }, 16 12 .c_models = { ··· 17 21 } 18 22 }, 19 23 }, 20 - .c_init = init_umc, 21 24 }; 22 25 23 26 int __init umc_init_cpu(void)
+19 -3
arch/i386/kernel/crash.c
··· 22 22 #include <asm/nmi.h> 23 23 #include <asm/hw_irq.h> 24 24 #include <asm/apic.h> 25 + #include <asm/kdebug.h> 26 + 25 27 #include <mach_ipi.h> 26 28 27 29 ··· 95 93 #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) 96 94 static atomic_t waiting_for_crash_ipi; 97 95 98 - static int crash_nmi_callback(struct pt_regs *regs, int cpu) 96 + static int crash_nmi_callback(struct notifier_block *self, 97 + unsigned long val, void *data) 99 98 { 99 + struct pt_regs *regs; 100 100 struct pt_regs fixed_regs; 101 + int cpu; 102 + 103 + if (val != DIE_NMI_IPI) 104 + return NOTIFY_OK; 105 + 106 + regs = ((struct die_args *)data)->regs; 107 + cpu = raw_smp_processor_id(); 101 108 102 109 /* Don't do anything if this handler is invoked on crashing cpu. 103 110 * Otherwise, system will completely hang. Crashing cpu can get 104 111 * an NMI if system was initially booted with nmi_watchdog parameter. 105 112 */ 106 113 if (cpu == crashing_cpu) 107 - return 1; 114 + return NOTIFY_STOP; 108 115 local_irq_disable(); 109 116 110 117 if (!user_mode_vm(regs)) { ··· 136 125 send_IPI_allbutself(NMI_VECTOR); 137 126 } 138 127 128 + static struct notifier_block crash_nmi_nb = { 129 + .notifier_call = crash_nmi_callback, 130 + }; 131 + 139 132 static void nmi_shootdown_cpus(void) 140 133 { 141 134 unsigned long msecs; 142 135 143 136 atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); 144 137 /* Would it be better to replace the trap vector here? */ 145 - set_nmi_callback(crash_nmi_callback); 138 + if (register_die_notifier(&crash_nmi_nb)) 139 + return; /* return what? */ 146 140 /* Ensure the new callback function is set before sending 147 141 * out the NMI 148 142 */
+74 -36
arch/i386/kernel/entry.S
··· 76 76 NT_MASK = 0x00004000 77 77 VM_MASK = 0x00020000 78 78 79 + /* These are replaces for paravirtualization */ 80 + #define DISABLE_INTERRUPTS cli 81 + #define ENABLE_INTERRUPTS sti 82 + #define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit 83 + #define INTERRUPT_RETURN iret 84 + #define GET_CR0_INTO_EAX movl %cr0, %eax 85 + 79 86 #ifdef CONFIG_PREEMPT 80 - #define preempt_stop cli; TRACE_IRQS_OFF 87 + #define preempt_stop DISABLE_INTERRUPTS; TRACE_IRQS_OFF 81 88 #else 82 89 #define preempt_stop 83 90 #define resume_kernel restore_nocheck ··· 183 176 184 177 #define RING0_INT_FRAME \ 185 178 CFI_STARTPROC simple;\ 179 + CFI_SIGNAL_FRAME;\ 186 180 CFI_DEF_CFA esp, 3*4;\ 187 181 /*CFI_OFFSET cs, -2*4;*/\ 188 182 CFI_OFFSET eip, -3*4 189 183 190 184 #define RING0_EC_FRAME \ 191 185 CFI_STARTPROC simple;\ 186 + CFI_SIGNAL_FRAME;\ 192 187 CFI_DEF_CFA esp, 4*4;\ 193 188 /*CFI_OFFSET cs, -2*4;*/\ 194 189 CFI_OFFSET eip, -3*4 195 190 196 191 #define RING0_PTREGS_FRAME \ 197 192 CFI_STARTPROC simple;\ 193 + CFI_SIGNAL_FRAME;\ 198 194 CFI_DEF_CFA esp, OLDESP-EBX;\ 199 195 /*CFI_OFFSET cs, CS-OLDESP;*/\ 200 196 CFI_OFFSET eip, EIP-OLDESP;\ ··· 243 233 check_userspace: 244 234 movl EFLAGS(%esp), %eax # mix EFLAGS and CS 245 235 movb CS(%esp), %al 246 - testl $(VM_MASK | 3), %eax 247 - jz resume_kernel 236 + andl $(VM_MASK | SEGMENT_RPL_MASK), %eax 237 + cmpl $USER_RPL, %eax 238 + jb resume_kernel # not returning to v8086 or userspace 248 239 ENTRY(resume_userspace) 249 - cli # make sure we don't miss an interrupt 240 + DISABLE_INTERRUPTS # make sure we don't miss an interrupt 250 241 # setting need_resched or sigpending 251 242 # between sampling and the iret 252 243 movl TI_flags(%ebp), %ecx ··· 258 247 259 248 #ifdef CONFIG_PREEMPT 260 249 ENTRY(resume_kernel) 261 - cli 250 + DISABLE_INTERRUPTS 262 251 cmpl $0,TI_preempt_count(%ebp) # non-zero preempt_count ? 263 252 jnz restore_nocheck 264 253 need_resched: ··· 278 267 # sysenter call handler stub 279 268 ENTRY(sysenter_entry) 280 269 CFI_STARTPROC simple 270 + CFI_SIGNAL_FRAME 281 271 CFI_DEF_CFA esp, 0 282 272 CFI_REGISTER esp, ebp 283 273 movl TSS_sysenter_esp0(%esp),%esp ··· 287 275 * No need to follow this irqs on/off section: the syscall 288 276 * disabled irqs and here we enable it straight after entry: 289 277 */ 290 - sti 278 + ENABLE_INTERRUPTS 291 279 pushl $(__USER_DS) 292 280 CFI_ADJUST_CFA_OFFSET 4 293 281 /*CFI_REL_OFFSET ss, 0*/ ··· 332 320 jae syscall_badsys 333 321 call *sys_call_table(,%eax,4) 334 322 movl %eax,EAX(%esp) 335 - cli 323 + DISABLE_INTERRUPTS 336 324 TRACE_IRQS_OFF 337 325 movl TI_flags(%ebp), %ecx 338 326 testw $_TIF_ALLWORK_MASK, %cx ··· 342 330 movl OLDESP(%esp), %ecx 343 331 xorl %ebp,%ebp 344 332 TRACE_IRQS_ON 345 - sti 346 - sysexit 333 + ENABLE_INTERRUPTS_SYSEXIT 347 334 CFI_ENDPROC 348 335 349 336 ··· 367 356 call *sys_call_table(,%eax,4) 368 357 movl %eax,EAX(%esp) # store the return value 369 358 syscall_exit: 370 - cli # make sure we don't miss an interrupt 359 + DISABLE_INTERRUPTS # make sure we don't miss an interrupt 371 360 # setting need_resched or sigpending 372 361 # between sampling and the iret 373 362 TRACE_IRQS_OFF ··· 382 371 # See comments in process.c:copy_thread() for details. 383 372 movb OLDSS(%esp), %ah 384 373 movb CS(%esp), %al 385 - andl $(VM_MASK | (4 << 8) | 3), %eax 386 - cmpl $((4 << 8) | 3), %eax 374 + andl $(VM_MASK | (SEGMENT_TI_MASK << 8) | SEGMENT_RPL_MASK), %eax 375 + cmpl $((SEGMENT_LDT << 8) | USER_RPL), %eax 387 376 CFI_REMEMBER_STATE 388 377 je ldt_ss # returning to user-space with LDT SS 389 378 restore_nocheck: ··· 392 381 RESTORE_REGS 393 382 addl $4, %esp 394 383 CFI_ADJUST_CFA_OFFSET -4 395 - 1: iret 384 + 1: INTERRUPT_RETURN 396 385 .section .fixup,"ax" 397 386 iret_exc: 398 387 TRACE_IRQS_ON 399 - sti 388 + ENABLE_INTERRUPTS 400 389 pushl $0 # no error code 401 390 pushl $do_iret_error 402 391 jmp error_code ··· 420 409 * dosemu and wine happy. */ 421 410 subl $8, %esp # reserve space for switch16 pointer 422 411 CFI_ADJUST_CFA_OFFSET 8 423 - cli 412 + DISABLE_INTERRUPTS 424 413 TRACE_IRQS_OFF 425 414 movl %esp, %eax 426 415 /* Set up the 16bit stack frame with switch32 pointer on top, ··· 430 419 TRACE_IRQS_IRET 431 420 RESTORE_REGS 432 421 lss 20+4(%esp), %esp # switch to 16bit stack 433 - 1: iret 422 + 1: INTERRUPT_RETURN 434 423 .section __ex_table,"a" 435 424 .align 4 436 425 .long 1b,iret_exc ··· 445 434 jz work_notifysig 446 435 work_resched: 447 436 call schedule 448 - cli # make sure we don't miss an interrupt 437 + DISABLE_INTERRUPTS # make sure we don't miss an interrupt 449 438 # setting need_resched or sigpending 450 439 # between sampling and the iret 451 440 TRACE_IRQS_OFF ··· 501 490 testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP), %cl 502 491 jz work_pending 503 492 TRACE_IRQS_ON 504 - sti # could let do_syscall_trace() call 493 + ENABLE_INTERRUPTS # could let do_syscall_trace() call 505 494 # schedule() instead 506 495 movl %esp, %eax 507 496 movl $1, %edx ··· 602 591 /* The include is where all of the SMP etc. interrupts come from */ 603 592 #include "entry_arch.h" 604 593 605 - ENTRY(divide_error) 606 - RING0_INT_FRAME 607 - pushl $0 # no error code 608 - CFI_ADJUST_CFA_OFFSET 4 609 - pushl $do_divide_error 594 + KPROBE_ENTRY(page_fault) 595 + RING0_EC_FRAME 596 + pushl $do_page_fault 610 597 CFI_ADJUST_CFA_OFFSET 4 611 598 ALIGN 612 599 error_code: ··· 654 645 call *%edi 655 646 jmp ret_from_exception 656 647 CFI_ENDPROC 648 + KPROBE_END(page_fault) 657 649 658 650 ENTRY(coprocessor_error) 659 651 RING0_INT_FRAME ··· 679 669 pushl $-1 # mark this as an int 680 670 CFI_ADJUST_CFA_OFFSET 4 681 671 SAVE_ALL 682 - movl %cr0, %eax 672 + GET_CR0_INTO_EAX 683 673 testl $0x4, %eax # EM (math emulation bit) 684 674 jne device_not_available_emulate 685 675 preempt_stop ··· 712 702 jne ok; \ 713 703 label: \ 714 704 movl TSS_sysenter_esp0+offset(%esp),%esp; \ 705 + CFI_DEF_CFA esp, 0; \ 706 + CFI_UNDEFINED eip; \ 715 707 pushfl; \ 708 + CFI_ADJUST_CFA_OFFSET 4; \ 716 709 pushl $__KERNEL_CS; \ 717 - pushl $sysenter_past_esp 710 + CFI_ADJUST_CFA_OFFSET 4; \ 711 + pushl $sysenter_past_esp; \ 712 + CFI_ADJUST_CFA_OFFSET 4; \ 713 + CFI_REL_OFFSET eip, 0 718 714 719 715 KPROBE_ENTRY(debug) 720 716 RING0_INT_FRAME ··· 736 720 call do_debug 737 721 jmp ret_from_exception 738 722 CFI_ENDPROC 739 - .previous .text 723 + KPROBE_END(debug) 724 + 740 725 /* 741 726 * NMI is doubly nasty. It can happen _while_ we're handling 742 727 * a debug fault, and the debug fault hasn't yet been able to ··· 746 729 * check whether we got an NMI on the debug path where the debug 747 730 * fault happened on the sysenter path. 748 731 */ 749 - ENTRY(nmi) 732 + KPROBE_ENTRY(nmi) 750 733 RING0_INT_FRAME 751 734 pushl %eax 752 735 CFI_ADJUST_CFA_OFFSET 4 ··· 771 754 cmpl $sysenter_entry,12(%esp) 772 755 je nmi_debug_stack_check 773 756 nmi_stack_correct: 757 + /* We have a RING0_INT_FRAME here */ 774 758 pushl %eax 775 759 CFI_ADJUST_CFA_OFFSET 4 776 760 SAVE_ALL ··· 782 764 CFI_ENDPROC 783 765 784 766 nmi_stack_fixup: 767 + RING0_INT_FRAME 785 768 FIX_STACK(12,nmi_stack_correct, 1) 786 769 jmp nmi_stack_correct 770 + 787 771 nmi_debug_stack_check: 772 + /* We have a RING0_INT_FRAME here */ 788 773 cmpw $__KERNEL_CS,16(%esp) 789 774 jne nmi_stack_correct 790 775 cmpl $debug,(%esp) ··· 798 777 jmp nmi_stack_correct 799 778 800 779 nmi_16bit_stack: 801 - RING0_INT_FRAME 802 - /* create the pointer to lss back */ 780 + /* We have a RING0_INT_FRAME here. 781 + * 782 + * create the pointer to lss back 783 + */ 803 784 pushl %ss 804 785 CFI_ADJUST_CFA_OFFSET 4 805 786 pushl %esp ··· 822 799 call do_nmi 823 800 RESTORE_REGS 824 801 lss 12+4(%esp), %esp # back to 16bit stack 825 - 1: iret 802 + 1: INTERRUPT_RETURN 826 803 CFI_ENDPROC 827 804 .section __ex_table,"a" 828 805 .align 4 829 806 .long 1b,iret_exc 830 807 .previous 808 + KPROBE_END(nmi) 831 809 832 810 KPROBE_ENTRY(int3) 833 811 RING0_INT_FRAME ··· 840 816 call do_int3 841 817 jmp ret_from_exception 842 818 CFI_ENDPROC 843 - .previous .text 819 + KPROBE_END(int3) 844 820 845 821 ENTRY(overflow) 846 822 RING0_INT_FRAME ··· 905 881 CFI_ADJUST_CFA_OFFSET 4 906 882 jmp error_code 907 883 CFI_ENDPROC 908 - .previous .text 884 + KPROBE_END(general_protection) 909 885 910 886 ENTRY(alignment_check) 911 887 RING0_EC_FRAME ··· 914 890 jmp error_code 915 891 CFI_ENDPROC 916 892 917 - KPROBE_ENTRY(page_fault) 918 - RING0_EC_FRAME 919 - pushl $do_page_fault 893 + ENTRY(divide_error) 894 + RING0_INT_FRAME 895 + pushl $0 # no error code 896 + CFI_ADJUST_CFA_OFFSET 4 897 + pushl $do_divide_error 920 898 CFI_ADJUST_CFA_OFFSET 4 921 899 jmp error_code 922 900 CFI_ENDPROC 923 - .previous .text 924 901 925 902 #ifdef CONFIG_X86_MCE 926 903 ENTRY(machine_check) ··· 973 948 CFI_ENDPROC 974 949 ENDPROC(arch_unwind_init_running) 975 950 #endif 951 + 952 + ENTRY(kernel_thread_helper) 953 + pushl $0 # fake return address for unwinder 954 + CFI_STARTPROC 955 + movl %edx,%eax 956 + push %edx 957 + CFI_ADJUST_CFA_OFFSET 4 958 + call *%ebx 959 + push %eax 960 + CFI_ADJUST_CFA_OFFSET 4 961 + call do_exit 962 + CFI_ENDPROC 963 + ENDPROC(kernel_thread_helper) 976 964 977 965 .section .rodata,"a" 978 966 #include "syscall_table.S"
+67
arch/i386/kernel/head.S
··· 371 371 addl $8,%edi 372 372 dec %ecx 373 373 jne rp_sidt 374 + 375 + .macro set_early_handler handler,trapno 376 + lea \handler,%edx 377 + movl $(__KERNEL_CS << 16),%eax 378 + movw %dx,%ax 379 + movw $0x8E00,%dx /* interrupt gate - dpl=0, present */ 380 + lea idt_table,%edi 381 + movl %eax,8*\trapno(%edi) 382 + movl %edx,8*\trapno+4(%edi) 383 + .endm 384 + 385 + set_early_handler handler=early_divide_err,trapno=0 386 + set_early_handler handler=early_illegal_opcode,trapno=6 387 + set_early_handler handler=early_protection_fault,trapno=13 388 + set_early_handler handler=early_page_fault,trapno=14 389 + 374 390 ret 391 + 392 + early_divide_err: 393 + xor %edx,%edx 394 + pushl $0 /* fake errcode */ 395 + jmp early_fault 396 + 397 + early_illegal_opcode: 398 + movl $6,%edx 399 + pushl $0 /* fake errcode */ 400 + jmp early_fault 401 + 402 + early_protection_fault: 403 + movl $13,%edx 404 + jmp early_fault 405 + 406 + early_page_fault: 407 + movl $14,%edx 408 + jmp early_fault 409 + 410 + early_fault: 411 + cld 412 + #ifdef CONFIG_PRINTK 413 + movl $(__KERNEL_DS),%eax 414 + movl %eax,%ds 415 + movl %eax,%es 416 + cmpl $2,early_recursion_flag 417 + je hlt_loop 418 + incl early_recursion_flag 419 + movl %cr2,%eax 420 + pushl %eax 421 + pushl %edx /* trapno */ 422 + pushl $fault_msg 423 + #ifdef CONFIG_EARLY_PRINTK 424 + call early_printk 425 + #else 426 + call printk 427 + #endif 428 + #endif 429 + hlt_loop: 430 + hlt 431 + jmp hlt_loop 375 432 376 433 /* This is the default interrupt "handler" :-) */ 377 434 ALIGN ··· 443 386 movl $(__KERNEL_DS),%eax 444 387 movl %eax,%ds 445 388 movl %eax,%es 389 + cmpl $2,early_recursion_flag 390 + je hlt_loop 391 + incl early_recursion_flag 446 392 pushl 16(%esp) 447 393 pushl 24(%esp) 448 394 pushl 32(%esp) ··· 491 431 492 432 ready: .byte 0 493 433 434 + early_recursion_flag: 435 + .long 0 436 + 494 437 int_msg: 495 438 .asciz "Unknown interrupt or fault at EIP %p %p %p\n" 439 + 440 + fault_msg: 441 + .ascii "Int %d: CR2 %p err %p EIP %p CS %p flags %p\n" 442 + .asciz "Stack: %p %p %p %p %p %p %p %p\n" 496 443 497 444 /* 498 445 * The IDT and GDT 'descriptors' are a strange 48-bit object
+5 -1
arch/i386/kernel/i8259.c
··· 45 45 46 46 #define shutdown_8259A_irq disable_8259A_irq 47 47 48 + static int i8259A_auto_eoi; 49 + 48 50 static void mask_and_ack_8259A(unsigned int); 49 51 50 52 unsigned int startup_8259A_irq(unsigned int irq) ··· 255 253 256 254 static int i8259A_resume(struct sys_device *dev) 257 255 { 258 - init_8259A(0); 256 + init_8259A(i8259A_auto_eoi); 259 257 restore_ELCR(irq_trigger); 260 258 return 0; 261 259 } ··· 302 300 void init_8259A(int auto_eoi) 303 301 { 304 302 unsigned long flags; 303 + 304 + i8259A_auto_eoi = auto_eoi; 305 305 306 306 spin_lock_irqsave(&i8259A_lock, flags); 307 307
+67 -58
arch/i386/kernel/io_apic.c
··· 40 40 #include <asm/nmi.h> 41 41 42 42 #include <mach_apic.h> 43 + #include <mach_apicdef.h> 43 44 44 45 #include "io_ports.h" 45 46 ··· 66 65 */ 67 66 int nr_ioapic_registers[MAX_IO_APICS]; 68 67 69 - int disable_timer_pin_1 __initdata; 68 + static int disable_timer_pin_1 __initdata; 70 69 71 70 /* 72 71 * Rough estimation of how many shared IRQs there are, can ··· 93 92 #else 94 93 #define vector_to_irq(vector) (vector) 95 94 #endif 95 + 96 + 97 + union entry_union { 98 + struct { u32 w1, w2; }; 99 + struct IO_APIC_route_entry entry; 100 + }; 101 + 102 + static struct IO_APIC_route_entry ioapic_read_entry(int apic, int pin) 103 + { 104 + union entry_union eu; 105 + unsigned long flags; 106 + spin_lock_irqsave(&ioapic_lock, flags); 107 + eu.w1 = io_apic_read(apic, 0x10 + 2 * pin); 108 + eu.w2 = io_apic_read(apic, 0x11 + 2 * pin); 109 + spin_unlock_irqrestore(&ioapic_lock, flags); 110 + return eu.entry; 111 + } 112 + 113 + static void ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e) 114 + { 115 + unsigned long flags; 116 + union entry_union eu; 117 + eu.entry = e; 118 + spin_lock_irqsave(&ioapic_lock, flags); 119 + io_apic_write(apic, 0x10 + 2*pin, eu.w1); 120 + io_apic_write(apic, 0x11 + 2*pin, eu.w2); 121 + spin_unlock_irqrestore(&ioapic_lock, flags); 122 + } 96 123 97 124 /* 98 125 * The common case is 1:1 IRQ<->pin mappings. Sometimes there are ··· 229 200 static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin) 230 201 { 231 202 struct IO_APIC_route_entry entry; 232 - unsigned long flags; 233 203 234 204 /* Check delivery_mode to be sure we're not clearing an SMI pin */ 235 - spin_lock_irqsave(&ioapic_lock, flags); 236 - *(((int*)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin); 237 - *(((int*)&entry) + 1) = io_apic_read(apic, 0x11 + 2 * pin); 238 - spin_unlock_irqrestore(&ioapic_lock, flags); 205 + entry = ioapic_read_entry(apic, pin); 239 206 if (entry.delivery_mode == dest_SMI) 240 207 return; 241 208 ··· 240 215 */ 241 216 memset(&entry, 0, sizeof(entry)); 242 217 entry.mask = 1; 243 - spin_lock_irqsave(&ioapic_lock, flags); 244 - io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry) + 0)); 245 - io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry) + 1)); 246 - spin_unlock_irqrestore(&ioapic_lock, flags); 218 + ioapic_write_entry(apic, pin, entry); 247 219 } 248 220 249 221 static void clear_IO_APIC (void) ··· 1305 1283 if (!apic && (irq < 16)) 1306 1284 disable_8259A_irq(irq); 1307 1285 } 1286 + ioapic_write_entry(apic, pin, entry); 1308 1287 spin_lock_irqsave(&ioapic_lock, flags); 1309 - io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1)); 1310 - io_apic_write(apic, 0x10+2*pin, *(((int *)&entry)+0)); 1311 1288 set_native_irq_info(irq, TARGET_CPUS); 1312 1289 spin_unlock_irqrestore(&ioapic_lock, flags); 1313 1290 } ··· 1322 1301 static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, int vector) 1323 1302 { 1324 1303 struct IO_APIC_route_entry entry; 1325 - unsigned long flags; 1326 1304 1327 1305 memset(&entry,0,sizeof(entry)); 1328 1306 ··· 1351 1331 /* 1352 1332 * Add it to the IO-APIC irq-routing table: 1353 1333 */ 1354 - spin_lock_irqsave(&ioapic_lock, flags); 1355 - io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1)); 1356 - io_apic_write(apic, 0x10+2*pin, *(((int *)&entry)+0)); 1357 - spin_unlock_irqrestore(&ioapic_lock, flags); 1334 + ioapic_write_entry(apic, pin, entry); 1358 1335 1359 1336 enable_8259A_irq(0); 1360 1337 } ··· 1461 1444 for (i = 0; i <= reg_01.bits.entries; i++) { 1462 1445 struct IO_APIC_route_entry entry; 1463 1446 1464 - spin_lock_irqsave(&ioapic_lock, flags); 1465 - *(((int *)&entry)+0) = io_apic_read(apic, 0x10+i*2); 1466 - *(((int *)&entry)+1) = io_apic_read(apic, 0x11+i*2); 1467 - spin_unlock_irqrestore(&ioapic_lock, flags); 1447 + entry = ioapic_read_entry(apic, i); 1468 1448 1469 1449 printk(KERN_DEBUG " %02x %03X %02X ", 1470 1450 i, ··· 1680 1666 /* See if any of the pins is in ExtINT mode */ 1681 1667 for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) { 1682 1668 struct IO_APIC_route_entry entry; 1683 - spin_lock_irqsave(&ioapic_lock, flags); 1684 - *(((int *)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin); 1685 - *(((int *)&entry) + 1) = io_apic_read(apic, 0x11 + 2 * pin); 1686 - spin_unlock_irqrestore(&ioapic_lock, flags); 1669 + entry = ioapic_read_entry(apic, pin); 1687 1670 1688 1671 1689 1672 /* If the interrupt line is enabled and in ExtInt mode ··· 1737 1726 */ 1738 1727 if (ioapic_i8259.pin != -1) { 1739 1728 struct IO_APIC_route_entry entry; 1740 - unsigned long flags; 1741 1729 1742 1730 memset(&entry, 0, sizeof(entry)); 1743 1731 entry.mask = 0; /* Enabled */ ··· 1753 1743 /* 1754 1744 * Add it to the IO-APIC irq-routing table: 1755 1745 */ 1756 - spin_lock_irqsave(&ioapic_lock, flags); 1757 - io_apic_write(ioapic_i8259.apic, 0x11+2*ioapic_i8259.pin, 1758 - *(((int *)&entry)+1)); 1759 - io_apic_write(ioapic_i8259.apic, 0x10+2*ioapic_i8259.pin, 1760 - *(((int *)&entry)+0)); 1761 - spin_unlock_irqrestore(&ioapic_lock, flags); 1746 + ioapic_write_entry(ioapic_i8259.apic, ioapic_i8259.pin, entry); 1762 1747 } 1763 1748 disconnect_bsp_APIC(ioapic_i8259.pin != -1); 1764 1749 } ··· 2218 2213 int apic, pin, i; 2219 2214 struct IO_APIC_route_entry entry0, entry1; 2220 2215 unsigned char save_control, save_freq_select; 2221 - unsigned long flags; 2222 2216 2223 2217 pin = find_isa_irq_pin(8, mp_INT); 2224 2218 apic = find_isa_irq_apic(8, mp_INT); 2225 2219 if (pin == -1) 2226 2220 return; 2227 2221 2228 - spin_lock_irqsave(&ioapic_lock, flags); 2229 - *(((int *)&entry0) + 1) = io_apic_read(apic, 0x11 + 2 * pin); 2230 - *(((int *)&entry0) + 0) = io_apic_read(apic, 0x10 + 2 * pin); 2231 - spin_unlock_irqrestore(&ioapic_lock, flags); 2222 + entry0 = ioapic_read_entry(apic, pin); 2232 2223 clear_IO_APIC_pin(apic, pin); 2233 2224 2234 2225 memset(&entry1, 0, sizeof(entry1)); ··· 2237 2236 entry1.trigger = 0; 2238 2237 entry1.vector = 0; 2239 2238 2240 - spin_lock_irqsave(&ioapic_lock, flags); 2241 - io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry1) + 1)); 2242 - io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry1) + 0)); 2243 - spin_unlock_irqrestore(&ioapic_lock, flags); 2239 + ioapic_write_entry(apic, pin, entry1); 2244 2240 2245 2241 save_control = CMOS_READ(RTC_CONTROL); 2246 2242 save_freq_select = CMOS_READ(RTC_FREQ_SELECT); ··· 2256 2258 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); 2257 2259 clear_IO_APIC_pin(apic, pin); 2258 2260 2259 - spin_lock_irqsave(&ioapic_lock, flags); 2260 - io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry0) + 1)); 2261 - io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry0) + 0)); 2262 - spin_unlock_irqrestore(&ioapic_lock, flags); 2261 + ioapic_write_entry(apic, pin, entry0); 2263 2262 } 2264 2263 2265 2264 int timer_uses_ioapic_pin_0; ··· 2456 2461 { 2457 2462 struct IO_APIC_route_entry *entry; 2458 2463 struct sysfs_ioapic_data *data; 2459 - unsigned long flags; 2460 2464 int i; 2461 2465 2462 2466 data = container_of(dev, struct sysfs_ioapic_data, dev); 2463 2467 entry = data->entry; 2464 - spin_lock_irqsave(&ioapic_lock, flags); 2465 - for (i = 0; i < nr_ioapic_registers[dev->id]; i ++, entry ++ ) { 2466 - *(((int *)entry) + 1) = io_apic_read(dev->id, 0x11 + 2 * i); 2467 - *(((int *)entry) + 0) = io_apic_read(dev->id, 0x10 + 2 * i); 2468 - } 2469 - spin_unlock_irqrestore(&ioapic_lock, flags); 2468 + for (i = 0; i < nr_ioapic_registers[dev->id]; i ++) 2469 + entry[i] = ioapic_read_entry(dev->id, i); 2470 2470 2471 2471 return 0; 2472 2472 } ··· 2483 2493 reg_00.bits.ID = mp_ioapics[dev->id].mpc_apicid; 2484 2494 io_apic_write(dev->id, 0, reg_00.raw); 2485 2495 } 2486 - for (i = 0; i < nr_ioapic_registers[dev->id]; i ++, entry ++ ) { 2487 - io_apic_write(dev->id, 0x11+2*i, *(((int *)entry)+1)); 2488 - io_apic_write(dev->id, 0x10+2*i, *(((int *)entry)+0)); 2489 - } 2490 2496 spin_unlock_irqrestore(&ioapic_lock, flags); 2497 + for (i = 0; i < nr_ioapic_registers[dev->id]; i ++) 2498 + ioapic_write_entry(dev->id, i, entry[i]); 2491 2499 2492 2500 return 0; 2493 2501 } ··· 2682 2694 if (!ioapic && (irq < 16)) 2683 2695 disable_8259A_irq(irq); 2684 2696 2697 + ioapic_write_entry(ioapic, pin, entry); 2685 2698 spin_lock_irqsave(&ioapic_lock, flags); 2686 - io_apic_write(ioapic, 0x11+2*pin, *(((int *)&entry)+1)); 2687 - io_apic_write(ioapic, 0x10+2*pin, *(((int *)&entry)+0)); 2688 2699 set_native_irq_info(use_pci_vector() ? entry.vector : irq, TARGET_CPUS); 2689 2700 spin_unlock_irqrestore(&ioapic_lock, flags); 2690 2701 ··· 2691 2704 } 2692 2705 2693 2706 #endif /* CONFIG_ACPI */ 2707 + 2708 + static int __init parse_disable_timer_pin_1(char *arg) 2709 + { 2710 + disable_timer_pin_1 = 1; 2711 + return 0; 2712 + } 2713 + early_param("disable_timer_pin_1", parse_disable_timer_pin_1); 2714 + 2715 + static int __init parse_enable_timer_pin_1(char *arg) 2716 + { 2717 + disable_timer_pin_1 = -1; 2718 + return 0; 2719 + } 2720 + early_param("enable_timer_pin_1", parse_enable_timer_pin_1); 2721 + 2722 + static int __init parse_noapic(char *arg) 2723 + { 2724 + /* disable IO-APIC */ 2725 + disable_ioapic_setup(); 2726 + return 0; 2727 + } 2728 + early_param("noapic", parse_noapic);
+49 -89
arch/i386/kernel/machine_kexec.c
··· 9 9 #include <linux/mm.h> 10 10 #include <linux/kexec.h> 11 11 #include <linux/delay.h> 12 + #include <linux/init.h> 12 13 #include <asm/pgtable.h> 13 14 #include <asm/pgalloc.h> 14 15 #include <asm/tlbflush.h> ··· 21 20 #include <asm/system.h> 22 21 23 22 #define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE))) 24 - 25 - #define L0_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) 26 - #define L1_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) 27 - #define L2_ATTR (_PAGE_PRESENT) 28 - 29 - #define LEVEL0_SIZE (1UL << 12UL) 30 - 31 - #ifndef CONFIG_X86_PAE 32 - #define LEVEL1_SIZE (1UL << 22UL) 33 - static u32 pgtable_level1[1024] PAGE_ALIGNED; 34 - 35 - static void identity_map_page(unsigned long address) 36 - { 37 - unsigned long level1_index, level2_index; 38 - u32 *pgtable_level2; 39 - 40 - /* Find the current page table */ 41 - pgtable_level2 = __va(read_cr3()); 42 - 43 - /* Find the indexes of the physical address to identity map */ 44 - level1_index = (address % LEVEL1_SIZE)/LEVEL0_SIZE; 45 - level2_index = address / LEVEL1_SIZE; 46 - 47 - /* Identity map the page table entry */ 48 - pgtable_level1[level1_index] = address | L0_ATTR; 49 - pgtable_level2[level2_index] = __pa(pgtable_level1) | L1_ATTR; 50 - 51 - /* Flush the tlb so the new mapping takes effect. 52 - * Global tlb entries are not flushed but that is not an issue. 53 - */ 54 - load_cr3(pgtable_level2); 55 - } 56 - 57 - #else 58 - #define LEVEL1_SIZE (1UL << 21UL) 59 - #define LEVEL2_SIZE (1UL << 30UL) 60 - static u64 pgtable_level1[512] PAGE_ALIGNED; 61 - static u64 pgtable_level2[512] PAGE_ALIGNED; 62 - 63 - static void identity_map_page(unsigned long address) 64 - { 65 - unsigned long level1_index, level2_index, level3_index; 66 - u64 *pgtable_level3; 67 - 68 - /* Find the current page table */ 69 - pgtable_level3 = __va(read_cr3()); 70 - 71 - /* Find the indexes of the physical address to identity map */ 72 - level1_index = (address % LEVEL1_SIZE)/LEVEL0_SIZE; 73 - level2_index = (address % LEVEL2_SIZE)/LEVEL1_SIZE; 74 - level3_index = address / LEVEL2_SIZE; 75 - 76 - /* Identity map the page table entry */ 77 - pgtable_level1[level1_index] = address | L0_ATTR; 78 - pgtable_level2[level2_index] = __pa(pgtable_level1) | L1_ATTR; 79 - set_64bit(&pgtable_level3[level3_index], 80 - __pa(pgtable_level2) | L2_ATTR); 81 - 82 - /* Flush the tlb so the new mapping takes effect. 83 - * Global tlb entries are not flushed but that is not an issue. 84 - */ 85 - load_cr3(pgtable_level3); 86 - } 23 + static u32 kexec_pgd[1024] PAGE_ALIGNED; 24 + #ifdef CONFIG_X86_PAE 25 + static u32 kexec_pmd0[1024] PAGE_ALIGNED; 26 + static u32 kexec_pmd1[1024] PAGE_ALIGNED; 87 27 #endif 28 + static u32 kexec_pte0[1024] PAGE_ALIGNED; 29 + static u32 kexec_pte1[1024] PAGE_ALIGNED; 88 30 89 31 static void set_idt(void *newidt, __u16 limit) 90 32 { ··· 71 127 #undef __STR 72 128 } 73 129 74 - typedef asmlinkage NORET_TYPE void (*relocate_new_kernel_t)( 75 - unsigned long indirection_page, 76 - unsigned long reboot_code_buffer, 77 - unsigned long start_address, 78 - unsigned int has_pae) ATTRIB_NORET; 79 - 80 - extern const unsigned char relocate_new_kernel[]; 81 - extern void relocate_new_kernel_end(void); 82 - extern const unsigned int relocate_new_kernel_size; 83 - 84 130 /* 85 131 * A architecture hook called to validate the 86 132 * proposed image and prepare the control pages ··· 103 169 */ 104 170 NORET_TYPE void machine_kexec(struct kimage *image) 105 171 { 106 - unsigned long page_list; 107 - unsigned long reboot_code_buffer; 108 - 109 - relocate_new_kernel_t rnk; 172 + unsigned long page_list[PAGES_NR]; 173 + void *control_page; 110 174 111 175 /* Interrupts aren't acceptable while we reboot */ 112 176 local_irq_disable(); 113 177 114 - /* Compute some offsets */ 115 - reboot_code_buffer = page_to_pfn(image->control_code_page) 116 - << PAGE_SHIFT; 117 - page_list = image->head; 178 + control_page = page_address(image->control_code_page); 179 + memcpy(control_page, relocate_kernel, PAGE_SIZE); 118 180 119 - /* Set up an identity mapping for the reboot_code_buffer */ 120 - identity_map_page(reboot_code_buffer); 121 - 122 - /* copy it out */ 123 - memcpy((void *)reboot_code_buffer, relocate_new_kernel, 124 - relocate_new_kernel_size); 181 + page_list[PA_CONTROL_PAGE] = __pa(control_page); 182 + page_list[VA_CONTROL_PAGE] = (unsigned long)relocate_kernel; 183 + page_list[PA_PGD] = __pa(kexec_pgd); 184 + page_list[VA_PGD] = (unsigned long)kexec_pgd; 185 + #ifdef CONFIG_X86_PAE 186 + page_list[PA_PMD_0] = __pa(kexec_pmd0); 187 + page_list[VA_PMD_0] = (unsigned long)kexec_pmd0; 188 + page_list[PA_PMD_1] = __pa(kexec_pmd1); 189 + page_list[VA_PMD_1] = (unsigned long)kexec_pmd1; 190 + #endif 191 + page_list[PA_PTE_0] = __pa(kexec_pte0); 192 + page_list[VA_PTE_0] = (unsigned long)kexec_pte0; 193 + page_list[PA_PTE_1] = __pa(kexec_pte1); 194 + page_list[VA_PTE_1] = (unsigned long)kexec_pte1; 125 195 126 196 /* The segment registers are funny things, they have both a 127 197 * visible and an invisible part. Whenever the visible part is ··· 144 206 set_idt(phys_to_virt(0),0); 145 207 146 208 /* now call it */ 147 - rnk = (relocate_new_kernel_t) reboot_code_buffer; 148 - (*rnk)(page_list, reboot_code_buffer, image->start, cpu_has_pae); 209 + relocate_kernel((unsigned long)image->head, (unsigned long)page_list, 210 + image->start, cpu_has_pae); 149 211 } 212 + 213 + /* crashkernel=size@addr specifies the location to reserve for 214 + * a crash kernel. By reserving this memory we guarantee 215 + * that linux never sets it up as a DMA target. 216 + * Useful for holding code to do something appropriate 217 + * after a kernel panic. 218 + */ 219 + static int __init parse_crashkernel(char *arg) 220 + { 221 + unsigned long size, base; 222 + size = memparse(arg, &arg); 223 + if (*arg == '@') { 224 + base = memparse(arg+1, &arg); 225 + /* FIXME: Do I want a sanity check 226 + * to validate the memory range? 227 + */ 228 + crashk_res.start = base; 229 + crashk_res.end = base + size - 1; 230 + } 231 + return 0; 232 + } 233 + early_param("crashkernel", parse_crashkernel);
+5 -3
arch/i386/kernel/mca.c
··· 42 42 #include <linux/errno.h> 43 43 #include <linux/kernel.h> 44 44 #include <linux/mca.h> 45 + #include <linux/kprobes.h> 45 46 #include <asm/system.h> 46 47 #include <asm/io.h> 47 48 #include <linux/proc_fs.h> ··· 415 414 416 415 /*--------------------------------------------------------------------*/ 417 416 418 - static void mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag) 417 + static __kprobes void 418 + mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag) 419 419 { 420 420 int slot = mca_dev->slot; 421 421 ··· 446 444 447 445 /*--------------------------------------------------------------------*/ 448 446 449 - static int mca_handle_nmi_callback(struct device *dev, void *data) 447 + static int __kprobes mca_handle_nmi_callback(struct device *dev, void *data) 450 448 { 451 449 struct mca_device *mca_dev = to_mca_device(dev); 452 450 unsigned char pos5; ··· 464 462 return 0; 465 463 } 466 464 467 - void mca_handle_nmi(void) 465 + void __kprobes mca_handle_nmi(void) 468 466 { 469 467 /* First try - scan the various adapters and see if a specific 470 468 * adapter was responsible for the error.
+21 -49
arch/i386/kernel/mpparse.c
··· 30 30 #include <asm/io_apic.h> 31 31 32 32 #include <mach_apic.h> 33 + #include <mach_apicdef.h> 33 34 #include <mach_mpparse.h> 34 35 #include <bios_ebda.h> 35 36 ··· 69 68 /* Processor that is doing the boot up */ 70 69 unsigned int boot_cpu_physical_apicid = -1U; 71 70 /* Internal processor count */ 72 - static unsigned int __devinitdata num_processors; 71 + unsigned int __cpuinitdata num_processors; 73 72 74 73 /* Bitmask of physically existing CPUs */ 75 74 physid_mask_t phys_cpu_present_map; ··· 229 228 230 229 mpc_oem_bus_info(m, str, translation_table[mpc_record]); 231 230 231 + #if MAX_MP_BUSSES < 256 232 232 if (m->mpc_busid >= MAX_MP_BUSSES) { 233 233 printk(KERN_WARNING "MP table busid value (%d) for bustype %s " 234 234 " is too large, max. supported is %d\n", 235 235 m->mpc_busid, str, MAX_MP_BUSSES - 1); 236 236 return; 237 237 } 238 + #endif 238 239 239 240 if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA)-1) == 0) { 240 241 mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA; ··· 296 293 m->mpc_irqtype, m->mpc_irqflag & 3, 297 294 (m->mpc_irqflag >> 2) &3, m->mpc_srcbusid, 298 295 m->mpc_srcbusirq, m->mpc_destapic, m->mpc_destapiclint); 299 - /* 300 - * Well it seems all SMP boards in existence 301 - * use ExtINT/LVT1 == LINT0 and 302 - * NMI/LVT2 == LINT1 - the following check 303 - * will show us if this assumptions is false. 304 - * Until then we do not have to add baggage. 305 - */ 306 - if ((m->mpc_irqtype == mp_ExtINT) && 307 - (m->mpc_destapiclint != 0)) 308 - BUG(); 309 - if ((m->mpc_irqtype == mp_NMI) && 310 - (m->mpc_destapiclint != 1)) 311 - BUG(); 312 296 } 313 297 314 298 #ifdef CONFIG_X86_NUMAQ ··· 812 822 813 823 #ifdef CONFIG_ACPI 814 824 815 - void __init mp_register_lapic_address ( 816 - u64 address) 825 + void __init mp_register_lapic_address(u64 address) 817 826 { 818 827 mp_lapic_addr = (unsigned long) address; 819 828 ··· 824 835 Dprintk("Boot CPU = %d\n", boot_cpu_physical_apicid); 825 836 } 826 837 827 - 828 - void __devinit mp_register_lapic ( 829 - u8 id, 830 - u8 enabled) 838 + void __devinit mp_register_lapic (u8 id, u8 enabled) 831 839 { 832 840 struct mpc_config_processor processor; 833 - int boot_cpu = 0; 841 + int boot_cpu = 0; 834 842 835 843 if (MAX_APICS - id <= 0) { 836 844 printk(KERN_WARNING "Processor #%d invalid (max %d)\n", ··· 864 878 u32 pin_programmed[4]; 865 879 } mp_ioapic_routing[MAX_IO_APICS]; 866 880 867 - 868 - static int mp_find_ioapic ( 869 - int gsi) 881 + static int mp_find_ioapic (int gsi) 870 882 { 871 - int i = 0; 883 + int i = 0; 872 884 873 885 /* Find the IOAPIC that manages this GSI. */ 874 886 for (i = 0; i < nr_ioapics; i++) { ··· 879 895 880 896 return -1; 881 897 } 882 - 883 898 884 - void __init mp_register_ioapic ( 885 - u8 id, 886 - u32 address, 887 - u32 gsi_base) 899 + void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base) 888 900 { 889 - int idx = 0; 890 - int tmpid; 901 + int idx = 0; 902 + int tmpid; 891 903 892 904 if (nr_ioapics >= MAX_IO_APICS) { 893 905 printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded " ··· 929 949 mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr, 930 950 mp_ioapic_routing[idx].gsi_base, 931 951 mp_ioapic_routing[idx].gsi_end); 932 - 933 - return; 934 952 } 935 953 936 - 937 - void __init mp_override_legacy_irq ( 938 - u8 bus_irq, 939 - u8 polarity, 940 - u8 trigger, 941 - u32 gsi) 954 + void __init 955 + mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) 942 956 { 943 957 struct mpc_config_intsrc intsrc; 944 958 int ioapic = -1; ··· 970 996 mp_irqs[mp_irq_entries] = intsrc; 971 997 if (++mp_irq_entries == MAX_IRQ_SOURCES) 972 998 panic("Max # of irq sources exceeded!\n"); 973 - 974 - return; 975 999 } 976 1000 977 1001 void __init mp_config_acpi_legacy_irqs (void) 978 1002 { 979 1003 struct mpc_config_intsrc intsrc; 980 - int i = 0; 981 - int ioapic = -1; 1004 + int i = 0; 1005 + int ioapic = -1; 982 1006 983 1007 /* 984 1008 * Fabricate the legacy ISA bus (bus #31). ··· 1045 1073 1046 1074 #define MAX_GSI_NUM 4096 1047 1075 1048 - int mp_register_gsi (u32 gsi, int triggering, int polarity) 1076 + int mp_register_gsi(u32 gsi, int triggering, int polarity) 1049 1077 { 1050 - int ioapic = -1; 1051 - int ioapic_pin = 0; 1052 - int idx, bit = 0; 1053 - static int pci_irq = 16; 1078 + int ioapic = -1; 1079 + int ioapic_pin = 0; 1080 + int idx, bit = 0; 1081 + static int pci_irq = 16; 1054 1082 /* 1055 1083 * Mapping between Global System Interrups, which 1056 1084 * represent all possible interrupts, and IRQs
+660 -298
arch/i386/kernel/nmi.c
··· 21 21 #include <linux/sysdev.h> 22 22 #include <linux/sysctl.h> 23 23 #include <linux/percpu.h> 24 + #include <linux/dmi.h> 25 + #include <linux/kprobes.h> 24 26 25 27 #include <asm/smp.h> 26 28 #include <asm/nmi.h> 29 + #include <asm/kdebug.h> 27 30 #include <asm/intel_arch_perfmon.h> 28 31 29 32 #include "mach_traps.h" 30 33 31 - unsigned int nmi_watchdog = NMI_NONE; 32 - extern int unknown_nmi_panic; 33 - static unsigned int nmi_hz = HZ; 34 - static unsigned int nmi_perfctr_msr; /* the MSR to reset in NMI handler */ 35 - static unsigned int nmi_p4_cccr_val; 36 - extern void show_registers(struct pt_regs *regs); 37 - 38 - /* 39 - * lapic_nmi_owner tracks the ownership of the lapic NMI hardware: 40 - * - it may be reserved by some other driver, or not 41 - * - when not reserved by some other driver, it may be used for 42 - * the NMI watchdog, or not 43 - * 44 - * This is maintained separately from nmi_active because the NMI 45 - * watchdog may also be driven from the I/O APIC timer. 34 + /* perfctr_nmi_owner tracks the ownership of the perfctr registers: 35 + * evtsel_nmi_owner tracks the ownership of the event selection 36 + * - different performance counters/ event selection may be reserved for 37 + * different subsystems this reservation system just tries to coordinate 38 + * things a little 46 39 */ 47 - static DEFINE_SPINLOCK(lapic_nmi_owner_lock); 48 - static unsigned int lapic_nmi_owner; 49 - #define LAPIC_NMI_WATCHDOG (1<<0) 50 - #define LAPIC_NMI_RESERVED (1<<1) 40 + static DEFINE_PER_CPU(unsigned long, perfctr_nmi_owner); 41 + static DEFINE_PER_CPU(unsigned long, evntsel_nmi_owner[3]); 42 + 43 + /* this number is calculated from Intel's MSR_P4_CRU_ESCR5 register and it's 44 + * offset from MSR_P4_BSU_ESCR0. It will be the max for all platforms (for now) 45 + */ 46 + #define NMI_MAX_COUNTER_BITS 66 51 47 52 48 /* nmi_active: 53 - * +1: the lapic NMI watchdog is active, but can be disabled 54 - * 0: the lapic NMI watchdog has not been set up, and cannot 49 + * >0: the lapic NMI watchdog is active, but can be disabled 50 + * <0: the lapic NMI watchdog has not been set up, and cannot 55 51 * be enabled 56 - * -1: the lapic NMI watchdog is disabled, but can be enabled 52 + * 0: the lapic NMI watchdog is disabled, but can be enabled 57 53 */ 58 - int nmi_active; 54 + atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */ 59 55 60 - #define K7_EVNTSEL_ENABLE (1 << 22) 61 - #define K7_EVNTSEL_INT (1 << 20) 62 - #define K7_EVNTSEL_OS (1 << 17) 63 - #define K7_EVNTSEL_USR (1 << 16) 64 - #define K7_EVENT_CYCLES_PROCESSOR_IS_RUNNING 0x76 65 - #define K7_NMI_EVENT K7_EVENT_CYCLES_PROCESSOR_IS_RUNNING 56 + unsigned int nmi_watchdog = NMI_DEFAULT; 57 + static unsigned int nmi_hz = HZ; 66 58 67 - #define P6_EVNTSEL0_ENABLE (1 << 22) 68 - #define P6_EVNTSEL_INT (1 << 20) 69 - #define P6_EVNTSEL_OS (1 << 17) 70 - #define P6_EVNTSEL_USR (1 << 16) 71 - #define P6_EVENT_CPU_CLOCKS_NOT_HALTED 0x79 72 - #define P6_NMI_EVENT P6_EVENT_CPU_CLOCKS_NOT_HALTED 59 + struct nmi_watchdog_ctlblk { 60 + int enabled; 61 + u64 check_bit; 62 + unsigned int cccr_msr; 63 + unsigned int perfctr_msr; /* the MSR to reset in NMI handler */ 64 + unsigned int evntsel_msr; /* the MSR to select the events to handle */ 65 + }; 66 + static DEFINE_PER_CPU(struct nmi_watchdog_ctlblk, nmi_watchdog_ctlblk); 73 67 74 - #define MSR_P4_MISC_ENABLE 0x1A0 75 - #define MSR_P4_MISC_ENABLE_PERF_AVAIL (1<<7) 76 - #define MSR_P4_MISC_ENABLE_PEBS_UNAVAIL (1<<12) 77 - #define MSR_P4_PERFCTR0 0x300 78 - #define MSR_P4_CCCR0 0x360 79 - #define P4_ESCR_EVENT_SELECT(N) ((N)<<25) 80 - #define P4_ESCR_OS (1<<3) 81 - #define P4_ESCR_USR (1<<2) 82 - #define P4_CCCR_OVF_PMI0 (1<<26) 83 - #define P4_CCCR_OVF_PMI1 (1<<27) 84 - #define P4_CCCR_THRESHOLD(N) ((N)<<20) 85 - #define P4_CCCR_COMPLEMENT (1<<19) 86 - #define P4_CCCR_COMPARE (1<<18) 87 - #define P4_CCCR_REQUIRED (3<<16) 88 - #define P4_CCCR_ESCR_SELECT(N) ((N)<<13) 89 - #define P4_CCCR_ENABLE (1<<12) 90 - /* Set up IQ_COUNTER0 to behave like a clock, by having IQ_CCCR0 filter 91 - CRU_ESCR0 (with any non-null event selector) through a complemented 92 - max threshold. [IA32-Vol3, Section 14.9.9] */ 93 - #define MSR_P4_IQ_COUNTER0 0x30C 94 - #define P4_NMI_CRU_ESCR0 (P4_ESCR_EVENT_SELECT(0x3F)|P4_ESCR_OS|P4_ESCR_USR) 95 - #define P4_NMI_IQ_CCCR0 \ 96 - (P4_CCCR_OVF_PMI0|P4_CCCR_THRESHOLD(15)|P4_CCCR_COMPLEMENT| \ 97 - P4_CCCR_COMPARE|P4_CCCR_REQUIRED|P4_CCCR_ESCR_SELECT(4)|P4_CCCR_ENABLE) 68 + /* local prototypes */ 69 + static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu); 98 70 99 - #define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 100 - #define ARCH_PERFMON_NMI_EVENT_UMASK ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK 71 + extern void show_registers(struct pt_regs *regs); 72 + extern int unknown_nmi_panic; 73 + 74 + /* converts an msr to an appropriate reservation bit */ 75 + static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr) 76 + { 77 + /* returns the bit offset of the performance counter register */ 78 + switch (boot_cpu_data.x86_vendor) { 79 + case X86_VENDOR_AMD: 80 + return (msr - MSR_K7_PERFCTR0); 81 + case X86_VENDOR_INTEL: 82 + if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) 83 + return (msr - MSR_ARCH_PERFMON_PERFCTR0); 84 + 85 + switch (boot_cpu_data.x86) { 86 + case 6: 87 + return (msr - MSR_P6_PERFCTR0); 88 + case 15: 89 + return (msr - MSR_P4_BPU_PERFCTR0); 90 + } 91 + } 92 + return 0; 93 + } 94 + 95 + /* converts an msr to an appropriate reservation bit */ 96 + static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr) 97 + { 98 + /* returns the bit offset of the event selection register */ 99 + switch (boot_cpu_data.x86_vendor) { 100 + case X86_VENDOR_AMD: 101 + return (msr - MSR_K7_EVNTSEL0); 102 + case X86_VENDOR_INTEL: 103 + if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) 104 + return (msr - MSR_ARCH_PERFMON_EVENTSEL0); 105 + 106 + switch (boot_cpu_data.x86) { 107 + case 6: 108 + return (msr - MSR_P6_EVNTSEL0); 109 + case 15: 110 + return (msr - MSR_P4_BSU_ESCR0); 111 + } 112 + } 113 + return 0; 114 + } 115 + 116 + /* checks for a bit availability (hack for oprofile) */ 117 + int avail_to_resrv_perfctr_nmi_bit(unsigned int counter) 118 + { 119 + BUG_ON(counter > NMI_MAX_COUNTER_BITS); 120 + 121 + return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 122 + } 123 + 124 + /* checks the an msr for availability */ 125 + int avail_to_resrv_perfctr_nmi(unsigned int msr) 126 + { 127 + unsigned int counter; 128 + 129 + counter = nmi_perfctr_msr_to_bit(msr); 130 + BUG_ON(counter > NMI_MAX_COUNTER_BITS); 131 + 132 + return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 133 + } 134 + 135 + int reserve_perfctr_nmi(unsigned int msr) 136 + { 137 + unsigned int counter; 138 + 139 + counter = nmi_perfctr_msr_to_bit(msr); 140 + BUG_ON(counter > NMI_MAX_COUNTER_BITS); 141 + 142 + if (!test_and_set_bit(counter, &__get_cpu_var(perfctr_nmi_owner))) 143 + return 1; 144 + return 0; 145 + } 146 + 147 + void release_perfctr_nmi(unsigned int msr) 148 + { 149 + unsigned int counter; 150 + 151 + counter = nmi_perfctr_msr_to_bit(msr); 152 + BUG_ON(counter > NMI_MAX_COUNTER_BITS); 153 + 154 + clear_bit(counter, &__get_cpu_var(perfctr_nmi_owner)); 155 + } 156 + 157 + int reserve_evntsel_nmi(unsigned int msr) 158 + { 159 + unsigned int counter; 160 + 161 + counter = nmi_evntsel_msr_to_bit(msr); 162 + BUG_ON(counter > NMI_MAX_COUNTER_BITS); 163 + 164 + if (!test_and_set_bit(counter, &__get_cpu_var(evntsel_nmi_owner)[0])) 165 + return 1; 166 + return 0; 167 + } 168 + 169 + void release_evntsel_nmi(unsigned int msr) 170 + { 171 + unsigned int counter; 172 + 173 + counter = nmi_evntsel_msr_to_bit(msr); 174 + BUG_ON(counter > NMI_MAX_COUNTER_BITS); 175 + 176 + clear_bit(counter, &__get_cpu_var(evntsel_nmi_owner)[0]); 177 + } 178 + 179 + static __cpuinit inline int nmi_known_cpu(void) 180 + { 181 + switch (boot_cpu_data.x86_vendor) { 182 + case X86_VENDOR_AMD: 183 + return ((boot_cpu_data.x86 == 15) || (boot_cpu_data.x86 == 6)); 184 + case X86_VENDOR_INTEL: 185 + if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) 186 + return 1; 187 + else 188 + return ((boot_cpu_data.x86 == 15) || (boot_cpu_data.x86 == 6)); 189 + } 190 + return 0; 191 + } 101 192 102 193 #ifdef CONFIG_SMP 103 194 /* The performance counters used by NMI_LOCAL_APIC don't trigger when ··· 216 125 unsigned int *prev_nmi_count; 217 126 int cpu; 218 127 219 - if (nmi_watchdog == NMI_NONE) 128 + /* Enable NMI watchdog for newer systems. 129 + Actually it should be safe for most systems before 2004 too except 130 + for some IBM systems that corrupt registers when NMI happens 131 + during SMM. Unfortunately we don't have more exact information 132 + on these and use this coarse check. */ 133 + if (nmi_watchdog == NMI_DEFAULT && dmi_get_year(DMI_BIOS_DATE) >= 2004) 134 + nmi_watchdog = NMI_LOCAL_APIC; 135 + 136 + if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT)) 137 + return 0; 138 + 139 + if (!atomic_read(&nmi_active)) 220 140 return 0; 221 141 222 142 prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL); ··· 251 149 if (!cpu_isset(cpu, cpu_callin_map)) 252 150 continue; 253 151 #endif 152 + if (!per_cpu(nmi_watchdog_ctlblk, cpu).enabled) 153 + continue; 254 154 if (nmi_count(cpu) - prev_nmi_count[cpu] <= 5) { 255 - endflag = 1; 256 155 printk("CPU#%d: NMI appears to be stuck (%d->%d)!\n", 257 156 cpu, 258 157 prev_nmi_count[cpu], 259 158 nmi_count(cpu)); 260 - nmi_active = 0; 261 - lapic_nmi_owner &= ~LAPIC_NMI_WATCHDOG; 262 - kfree(prev_nmi_count); 263 - return -1; 159 + per_cpu(nmi_watchdog_ctlblk, cpu).enabled = 0; 160 + atomic_dec(&nmi_active); 264 161 } 162 + } 163 + if (!atomic_read(&nmi_active)) { 164 + kfree(prev_nmi_count); 165 + atomic_set(&nmi_active, -1); 166 + return -1; 265 167 } 266 168 endflag = 1; 267 169 printk("OK.\n"); 268 170 269 171 /* now that we know it works we can reduce NMI frequency to 270 172 something more reasonable; makes a difference in some configs */ 271 - if (nmi_watchdog == NMI_LOCAL_APIC) 173 + if (nmi_watchdog == NMI_LOCAL_APIC) { 174 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 175 + 272 176 nmi_hz = 1; 177 + /* 178 + * On Intel CPUs with ARCH_PERFMON only 32 bits in the counter 179 + * are writable, with higher bits sign extending from bit 31. 180 + * So, we can only program the counter with 31 bit values and 181 + * 32nd bit should be 1, for 33.. to be 1. 182 + * Find the appropriate nmi_hz 183 + */ 184 + if (wd->perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0 && 185 + ((u64)cpu_khz * 1000) > 0x7fffffffULL) { 186 + u64 count = (u64)cpu_khz * 1000; 187 + do_div(count, 0x7fffffffUL); 188 + nmi_hz = count + 1; 189 + } 190 + } 273 191 274 192 kfree(prev_nmi_count); 275 193 return 0; ··· 303 181 304 182 get_option(&str, &nmi); 305 183 306 - if (nmi >= NMI_INVALID) 184 + if ((nmi >= NMI_INVALID) || (nmi < NMI_NONE)) 307 185 return 0; 308 - if (nmi == NMI_NONE) 309 - nmi_watchdog = nmi; 310 186 /* 311 187 * If any other x86 CPU has a local APIC, then 312 188 * please test the NMI stuff there and send me the 313 189 * missing bits. Right now Intel P6/P4 and AMD K7 only. 314 190 */ 315 - if ((nmi == NMI_LOCAL_APIC) && 316 - (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && 317 - (boot_cpu_data.x86 == 6 || boot_cpu_data.x86 == 15)) 318 - nmi_watchdog = nmi; 319 - if ((nmi == NMI_LOCAL_APIC) && 320 - (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && 321 - (boot_cpu_data.x86 == 6 || boot_cpu_data.x86 == 15)) 322 - nmi_watchdog = nmi; 323 - /* 324 - * We can enable the IO-APIC watchdog 325 - * unconditionally. 326 - */ 327 - if (nmi == NMI_IO_APIC) { 328 - nmi_active = 1; 329 - nmi_watchdog = nmi; 330 - } 191 + if ((nmi == NMI_LOCAL_APIC) && (nmi_known_cpu() == 0)) 192 + return 0; /* no lapic support */ 193 + nmi_watchdog = nmi; 331 194 return 1; 332 195 } 333 196 334 197 __setup("nmi_watchdog=", setup_nmi_watchdog); 335 198 336 - static void disable_intel_arch_watchdog(void); 337 - 338 199 static void disable_lapic_nmi_watchdog(void) 339 200 { 340 - if (nmi_active <= 0) 201 + BUG_ON(nmi_watchdog != NMI_LOCAL_APIC); 202 + 203 + if (atomic_read(&nmi_active) <= 0) 341 204 return; 342 - switch (boot_cpu_data.x86_vendor) { 343 - case X86_VENDOR_AMD: 344 - wrmsr(MSR_K7_EVNTSEL0, 0, 0); 345 - break; 346 - case X86_VENDOR_INTEL: 347 - if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) { 348 - disable_intel_arch_watchdog(); 349 - break; 350 - } 351 - switch (boot_cpu_data.x86) { 352 - case 6: 353 - if (boot_cpu_data.x86_model > 0xd) 354 - break; 355 205 356 - wrmsr(MSR_P6_EVNTSEL0, 0, 0); 357 - break; 358 - case 15: 359 - if (boot_cpu_data.x86_model > 0x4) 360 - break; 206 + on_each_cpu(stop_apic_nmi_watchdog, NULL, 0, 1); 361 207 362 - wrmsr(MSR_P4_IQ_CCCR0, 0, 0); 363 - wrmsr(MSR_P4_CRU_ESCR0, 0, 0); 364 - break; 365 - } 366 - break; 367 - } 368 - nmi_active = -1; 369 - /* tell do_nmi() and others that we're not active any more */ 370 - nmi_watchdog = 0; 208 + BUG_ON(atomic_read(&nmi_active) != 0); 371 209 } 372 210 373 211 static void enable_lapic_nmi_watchdog(void) 374 212 { 375 - if (nmi_active < 0) { 376 - nmi_watchdog = NMI_LOCAL_APIC; 377 - setup_apic_nmi_watchdog(); 378 - } 379 - } 213 + BUG_ON(nmi_watchdog != NMI_LOCAL_APIC); 380 214 381 - int reserve_lapic_nmi(void) 382 - { 383 - unsigned int old_owner; 215 + /* are we already enabled */ 216 + if (atomic_read(&nmi_active) != 0) 217 + return; 384 218 385 - spin_lock(&lapic_nmi_owner_lock); 386 - old_owner = lapic_nmi_owner; 387 - lapic_nmi_owner |= LAPIC_NMI_RESERVED; 388 - spin_unlock(&lapic_nmi_owner_lock); 389 - if (old_owner & LAPIC_NMI_RESERVED) 390 - return -EBUSY; 391 - if (old_owner & LAPIC_NMI_WATCHDOG) 392 - disable_lapic_nmi_watchdog(); 393 - return 0; 394 - } 219 + /* are we lapic aware */ 220 + if (nmi_known_cpu() <= 0) 221 + return; 395 222 396 - void release_lapic_nmi(void) 397 - { 398 - unsigned int new_owner; 399 - 400 - spin_lock(&lapic_nmi_owner_lock); 401 - new_owner = lapic_nmi_owner & ~LAPIC_NMI_RESERVED; 402 - lapic_nmi_owner = new_owner; 403 - spin_unlock(&lapic_nmi_owner_lock); 404 - if (new_owner & LAPIC_NMI_WATCHDOG) 405 - enable_lapic_nmi_watchdog(); 223 + on_each_cpu(setup_apic_nmi_watchdog, NULL, 0, 1); 224 + touch_nmi_watchdog(); 406 225 } 407 226 408 227 void disable_timer_nmi_watchdog(void) 409 228 { 410 - if ((nmi_watchdog != NMI_IO_APIC) || (nmi_active <= 0)) 229 + BUG_ON(nmi_watchdog != NMI_IO_APIC); 230 + 231 + if (atomic_read(&nmi_active) <= 0) 411 232 return; 412 233 413 - unset_nmi_callback(); 414 - nmi_active = -1; 415 - nmi_watchdog = NMI_NONE; 234 + disable_irq(0); 235 + on_each_cpu(stop_apic_nmi_watchdog, NULL, 0, 1); 236 + 237 + BUG_ON(atomic_read(&nmi_active) != 0); 416 238 } 417 239 418 240 void enable_timer_nmi_watchdog(void) 419 241 { 420 - if (nmi_active < 0) { 421 - nmi_watchdog = NMI_IO_APIC; 242 + BUG_ON(nmi_watchdog != NMI_IO_APIC); 243 + 244 + if (atomic_read(&nmi_active) == 0) { 422 245 touch_nmi_watchdog(); 423 - nmi_active = 1; 246 + on_each_cpu(setup_apic_nmi_watchdog, NULL, 0, 1); 247 + enable_irq(0); 424 248 } 425 249 } 426 250 ··· 376 308 377 309 static int lapic_nmi_suspend(struct sys_device *dev, pm_message_t state) 378 310 { 379 - nmi_pm_active = nmi_active; 380 - disable_lapic_nmi_watchdog(); 311 + /* only CPU0 goes here, other CPUs should be offline */ 312 + nmi_pm_active = atomic_read(&nmi_active); 313 + stop_apic_nmi_watchdog(NULL); 314 + BUG_ON(atomic_read(&nmi_active) != 0); 381 315 return 0; 382 316 } 383 317 384 318 static int lapic_nmi_resume(struct sys_device *dev) 385 319 { 386 - if (nmi_pm_active > 0) 387 - enable_lapic_nmi_watchdog(); 320 + /* only CPU0 goes here, other CPUs should be offline */ 321 + if (nmi_pm_active > 0) { 322 + setup_apic_nmi_watchdog(NULL); 323 + touch_nmi_watchdog(); 324 + } 388 325 return 0; 389 326 } 390 327 ··· 409 336 { 410 337 int error; 411 338 412 - if (nmi_active == 0 || nmi_watchdog != NMI_LOCAL_APIC) 339 + /* should really be a BUG_ON but b/c this is an 340 + * init call, it just doesn't work. -dcz 341 + */ 342 + if (nmi_watchdog != NMI_LOCAL_APIC) 343 + return 0; 344 + 345 + if ( atomic_read(&nmi_active) < 0 ) 413 346 return 0; 414 347 415 348 error = sysdev_class_register(&nmi_sysclass); ··· 433 354 * Original code written by Keith Owens. 434 355 */ 435 356 436 - static void clear_msr_range(unsigned int base, unsigned int n) 437 - { 438 - unsigned int i; 439 - 440 - for(i = 0; i < n; ++i) 441 - wrmsr(base+i, 0, 0); 442 - } 443 - 444 - static void write_watchdog_counter(const char *descr) 357 + static void write_watchdog_counter(unsigned int perfctr_msr, const char *descr) 445 358 { 446 359 u64 count = (u64)cpu_khz * 1000; 447 360 448 361 do_div(count, nmi_hz); 449 362 if(descr) 450 363 Dprintk("setting %s to -0x%08Lx\n", descr, count); 451 - wrmsrl(nmi_perfctr_msr, 0 - count); 364 + wrmsrl(perfctr_msr, 0 - count); 452 365 } 453 366 454 - static void setup_k7_watchdog(void) 367 + /* Note that these events don't tick when the CPU idles. This means 368 + the frequency varies with CPU load. */ 369 + 370 + #define K7_EVNTSEL_ENABLE (1 << 22) 371 + #define K7_EVNTSEL_INT (1 << 20) 372 + #define K7_EVNTSEL_OS (1 << 17) 373 + #define K7_EVNTSEL_USR (1 << 16) 374 + #define K7_EVENT_CYCLES_PROCESSOR_IS_RUNNING 0x76 375 + #define K7_NMI_EVENT K7_EVENT_CYCLES_PROCESSOR_IS_RUNNING 376 + 377 + static int setup_k7_watchdog(void) 455 378 { 379 + unsigned int perfctr_msr, evntsel_msr; 456 380 unsigned int evntsel; 381 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 457 382 458 - nmi_perfctr_msr = MSR_K7_PERFCTR0; 383 + perfctr_msr = MSR_K7_PERFCTR0; 384 + evntsel_msr = MSR_K7_EVNTSEL0; 385 + if (!reserve_perfctr_nmi(perfctr_msr)) 386 + goto fail; 459 387 460 - clear_msr_range(MSR_K7_EVNTSEL0, 4); 461 - clear_msr_range(MSR_K7_PERFCTR0, 4); 388 + if (!reserve_evntsel_nmi(evntsel_msr)) 389 + goto fail1; 390 + 391 + wrmsrl(perfctr_msr, 0UL); 462 392 463 393 evntsel = K7_EVNTSEL_INT 464 394 | K7_EVNTSEL_OS 465 395 | K7_EVNTSEL_USR 466 396 | K7_NMI_EVENT; 467 397 468 - wrmsr(MSR_K7_EVNTSEL0, evntsel, 0); 469 - write_watchdog_counter("K7_PERFCTR0"); 398 + /* setup the timer */ 399 + wrmsr(evntsel_msr, evntsel, 0); 400 + write_watchdog_counter(perfctr_msr, "K7_PERFCTR0"); 470 401 apic_write(APIC_LVTPC, APIC_DM_NMI); 471 402 evntsel |= K7_EVNTSEL_ENABLE; 472 - wrmsr(MSR_K7_EVNTSEL0, evntsel, 0); 403 + wrmsr(evntsel_msr, evntsel, 0); 404 + 405 + wd->perfctr_msr = perfctr_msr; 406 + wd->evntsel_msr = evntsel_msr; 407 + wd->cccr_msr = 0; //unused 408 + wd->check_bit = 1ULL<<63; 409 + return 1; 410 + fail1: 411 + release_perfctr_nmi(perfctr_msr); 412 + fail: 413 + return 0; 473 414 } 474 415 475 - static void setup_p6_watchdog(void) 416 + static void stop_k7_watchdog(void) 476 417 { 418 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 419 + 420 + wrmsr(wd->evntsel_msr, 0, 0); 421 + 422 + release_evntsel_nmi(wd->evntsel_msr); 423 + release_perfctr_nmi(wd->perfctr_msr); 424 + } 425 + 426 + #define P6_EVNTSEL0_ENABLE (1 << 22) 427 + #define P6_EVNTSEL_INT (1 << 20) 428 + #define P6_EVNTSEL_OS (1 << 17) 429 + #define P6_EVNTSEL_USR (1 << 16) 430 + #define P6_EVENT_CPU_CLOCKS_NOT_HALTED 0x79 431 + #define P6_NMI_EVENT P6_EVENT_CPU_CLOCKS_NOT_HALTED 432 + 433 + static int setup_p6_watchdog(void) 434 + { 435 + unsigned int perfctr_msr, evntsel_msr; 477 436 unsigned int evntsel; 437 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 478 438 479 - nmi_perfctr_msr = MSR_P6_PERFCTR0; 439 + perfctr_msr = MSR_P6_PERFCTR0; 440 + evntsel_msr = MSR_P6_EVNTSEL0; 441 + if (!reserve_perfctr_nmi(perfctr_msr)) 442 + goto fail; 480 443 481 - clear_msr_range(MSR_P6_EVNTSEL0, 2); 482 - clear_msr_range(MSR_P6_PERFCTR0, 2); 444 + if (!reserve_evntsel_nmi(evntsel_msr)) 445 + goto fail1; 446 + 447 + wrmsrl(perfctr_msr, 0UL); 483 448 484 449 evntsel = P6_EVNTSEL_INT 485 450 | P6_EVNTSEL_OS 486 451 | P6_EVNTSEL_USR 487 452 | P6_NMI_EVENT; 488 453 489 - wrmsr(MSR_P6_EVNTSEL0, evntsel, 0); 490 - write_watchdog_counter("P6_PERFCTR0"); 454 + /* setup the timer */ 455 + wrmsr(evntsel_msr, evntsel, 0); 456 + write_watchdog_counter(perfctr_msr, "P6_PERFCTR0"); 491 457 apic_write(APIC_LVTPC, APIC_DM_NMI); 492 458 evntsel |= P6_EVNTSEL0_ENABLE; 493 - wrmsr(MSR_P6_EVNTSEL0, evntsel, 0); 459 + wrmsr(evntsel_msr, evntsel, 0); 460 + 461 + wd->perfctr_msr = perfctr_msr; 462 + wd->evntsel_msr = evntsel_msr; 463 + wd->cccr_msr = 0; //unused 464 + wd->check_bit = 1ULL<<39; 465 + return 1; 466 + fail1: 467 + release_perfctr_nmi(perfctr_msr); 468 + fail: 469 + return 0; 494 470 } 471 + 472 + static void stop_p6_watchdog(void) 473 + { 474 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 475 + 476 + wrmsr(wd->evntsel_msr, 0, 0); 477 + 478 + release_evntsel_nmi(wd->evntsel_msr); 479 + release_perfctr_nmi(wd->perfctr_msr); 480 + } 481 + 482 + /* Note that these events don't tick when the CPU idles. This means 483 + the frequency varies with CPU load. */ 484 + 485 + #define MSR_P4_MISC_ENABLE_PERF_AVAIL (1<<7) 486 + #define P4_ESCR_EVENT_SELECT(N) ((N)<<25) 487 + #define P4_ESCR_OS (1<<3) 488 + #define P4_ESCR_USR (1<<2) 489 + #define P4_CCCR_OVF_PMI0 (1<<26) 490 + #define P4_CCCR_OVF_PMI1 (1<<27) 491 + #define P4_CCCR_THRESHOLD(N) ((N)<<20) 492 + #define P4_CCCR_COMPLEMENT (1<<19) 493 + #define P4_CCCR_COMPARE (1<<18) 494 + #define P4_CCCR_REQUIRED (3<<16) 495 + #define P4_CCCR_ESCR_SELECT(N) ((N)<<13) 496 + #define P4_CCCR_ENABLE (1<<12) 497 + #define P4_CCCR_OVF (1<<31) 498 + /* Set up IQ_COUNTER0 to behave like a clock, by having IQ_CCCR0 filter 499 + CRU_ESCR0 (with any non-null event selector) through a complemented 500 + max threshold. [IA32-Vol3, Section 14.9.9] */ 495 501 496 502 static int setup_p4_watchdog(void) 497 503 { 504 + unsigned int perfctr_msr, evntsel_msr, cccr_msr; 505 + unsigned int evntsel, cccr_val; 498 506 unsigned int misc_enable, dummy; 507 + unsigned int ht_num; 508 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 499 509 500 - rdmsr(MSR_P4_MISC_ENABLE, misc_enable, dummy); 510 + rdmsr(MSR_IA32_MISC_ENABLE, misc_enable, dummy); 501 511 if (!(misc_enable & MSR_P4_MISC_ENABLE_PERF_AVAIL)) 502 512 return 0; 503 513 504 - nmi_perfctr_msr = MSR_P4_IQ_COUNTER0; 505 - nmi_p4_cccr_val = P4_NMI_IQ_CCCR0; 506 514 #ifdef CONFIG_SMP 507 - if (smp_num_siblings == 2) 508 - nmi_p4_cccr_val |= P4_CCCR_OVF_PMI1; 515 + /* detect which hyperthread we are on */ 516 + if (smp_num_siblings == 2) { 517 + unsigned int ebx, apicid; 518 + 519 + ebx = cpuid_ebx(1); 520 + apicid = (ebx >> 24) & 0xff; 521 + ht_num = apicid & 1; 522 + } else 509 523 #endif 524 + ht_num = 0; 510 525 511 - if (!(misc_enable & MSR_P4_MISC_ENABLE_PEBS_UNAVAIL)) 512 - clear_msr_range(0x3F1, 2); 513 - /* MSR 0x3F0 seems to have a default value of 0xFC00, but current 514 - docs doesn't fully define it, so leave it alone for now. */ 515 - if (boot_cpu_data.x86_model >= 0x3) { 516 - /* MSR_P4_IQ_ESCR0/1 (0x3ba/0x3bb) removed */ 517 - clear_msr_range(0x3A0, 26); 518 - clear_msr_range(0x3BC, 3); 519 - } else { 520 - clear_msr_range(0x3A0, 31); 521 - } 522 - clear_msr_range(0x3C0, 6); 523 - clear_msr_range(0x3C8, 6); 524 - clear_msr_range(0x3E0, 2); 525 - clear_msr_range(MSR_P4_CCCR0, 18); 526 - clear_msr_range(MSR_P4_PERFCTR0, 18); 527 - 528 - wrmsr(MSR_P4_CRU_ESCR0, P4_NMI_CRU_ESCR0, 0); 529 - wrmsr(MSR_P4_IQ_CCCR0, P4_NMI_IQ_CCCR0 & ~P4_CCCR_ENABLE, 0); 530 - write_watchdog_counter("P4_IQ_COUNTER0"); 531 - apic_write(APIC_LVTPC, APIC_DM_NMI); 532 - wrmsr(MSR_P4_IQ_CCCR0, nmi_p4_cccr_val, 0); 533 - return 1; 534 - } 535 - 536 - static void disable_intel_arch_watchdog(void) 537 - { 538 - unsigned ebx; 539 - 540 - /* 541 - * Check whether the Architectural PerfMon supports 542 - * Unhalted Core Cycles Event or not. 543 - * NOTE: Corresponding bit = 0 in ebp indicates event present. 526 + /* performance counters are shared resources 527 + * assign each hyperthread its own set 528 + * (re-use the ESCR0 register, seems safe 529 + * and keeps the cccr_val the same) 544 530 */ 545 - ebx = cpuid_ebx(10); 546 - if (!(ebx & ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT)) 547 - wrmsr(MSR_ARCH_PERFMON_EVENTSEL0, 0, 0); 531 + if (!ht_num) { 532 + /* logical cpu 0 */ 533 + perfctr_msr = MSR_P4_IQ_PERFCTR0; 534 + evntsel_msr = MSR_P4_CRU_ESCR0; 535 + cccr_msr = MSR_P4_IQ_CCCR0; 536 + cccr_val = P4_CCCR_OVF_PMI0 | P4_CCCR_ESCR_SELECT(4); 537 + } else { 538 + /* logical cpu 1 */ 539 + perfctr_msr = MSR_P4_IQ_PERFCTR1; 540 + evntsel_msr = MSR_P4_CRU_ESCR0; 541 + cccr_msr = MSR_P4_IQ_CCCR1; 542 + cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4); 543 + } 544 + 545 + if (!reserve_perfctr_nmi(perfctr_msr)) 546 + goto fail; 547 + 548 + if (!reserve_evntsel_nmi(evntsel_msr)) 549 + goto fail1; 550 + 551 + evntsel = P4_ESCR_EVENT_SELECT(0x3F) 552 + | P4_ESCR_OS 553 + | P4_ESCR_USR; 554 + 555 + cccr_val |= P4_CCCR_THRESHOLD(15) 556 + | P4_CCCR_COMPLEMENT 557 + | P4_CCCR_COMPARE 558 + | P4_CCCR_REQUIRED; 559 + 560 + wrmsr(evntsel_msr, evntsel, 0); 561 + wrmsr(cccr_msr, cccr_val, 0); 562 + write_watchdog_counter(perfctr_msr, "P4_IQ_COUNTER0"); 563 + apic_write(APIC_LVTPC, APIC_DM_NMI); 564 + cccr_val |= P4_CCCR_ENABLE; 565 + wrmsr(cccr_msr, cccr_val, 0); 566 + wd->perfctr_msr = perfctr_msr; 567 + wd->evntsel_msr = evntsel_msr; 568 + wd->cccr_msr = cccr_msr; 569 + wd->check_bit = 1ULL<<39; 570 + return 1; 571 + fail1: 572 + release_perfctr_nmi(perfctr_msr); 573 + fail: 574 + return 0; 548 575 } 576 + 577 + static void stop_p4_watchdog(void) 578 + { 579 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 580 + 581 + wrmsr(wd->cccr_msr, 0, 0); 582 + wrmsr(wd->evntsel_msr, 0, 0); 583 + 584 + release_evntsel_nmi(wd->evntsel_msr); 585 + release_perfctr_nmi(wd->perfctr_msr); 586 + } 587 + 588 + #define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 589 + #define ARCH_PERFMON_NMI_EVENT_UMASK ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK 549 590 550 591 static int setup_intel_arch_watchdog(void) 551 592 { 593 + unsigned int ebx; 594 + union cpuid10_eax eax; 595 + unsigned int unused; 596 + unsigned int perfctr_msr, evntsel_msr; 552 597 unsigned int evntsel; 553 - unsigned ebx; 598 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 554 599 555 600 /* 556 601 * Check whether the Architectural PerfMon supports 557 602 * Unhalted Core Cycles Event or not. 558 - * NOTE: Corresponding bit = 0 in ebp indicates event present. 603 + * NOTE: Corresponding bit = 0 in ebx indicates event present. 559 604 */ 560 - ebx = cpuid_ebx(10); 561 - if ((ebx & ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT)) 562 - return 0; 605 + cpuid(10, &(eax.full), &ebx, &unused, &unused); 606 + if ((eax.split.mask_length < (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX+1)) || 607 + (ebx & ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT)) 608 + goto fail; 563 609 564 - nmi_perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0; 610 + perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0; 611 + evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0; 565 612 566 - clear_msr_range(MSR_ARCH_PERFMON_EVENTSEL0, 2); 567 - clear_msr_range(MSR_ARCH_PERFMON_PERFCTR0, 2); 613 + if (!reserve_perfctr_nmi(perfctr_msr)) 614 + goto fail; 615 + 616 + if (!reserve_evntsel_nmi(evntsel_msr)) 617 + goto fail1; 618 + 619 + wrmsrl(perfctr_msr, 0UL); 568 620 569 621 evntsel = ARCH_PERFMON_EVENTSEL_INT 570 622 | ARCH_PERFMON_EVENTSEL_OS ··· 703 493 | ARCH_PERFMON_NMI_EVENT_SEL 704 494 | ARCH_PERFMON_NMI_EVENT_UMASK; 705 495 706 - wrmsr(MSR_ARCH_PERFMON_EVENTSEL0, evntsel, 0); 707 - write_watchdog_counter("INTEL_ARCH_PERFCTR0"); 496 + /* setup the timer */ 497 + wrmsr(evntsel_msr, evntsel, 0); 498 + write_watchdog_counter(perfctr_msr, "INTEL_ARCH_PERFCTR0"); 708 499 apic_write(APIC_LVTPC, APIC_DM_NMI); 709 500 evntsel |= ARCH_PERFMON_EVENTSEL0_ENABLE; 710 - wrmsr(MSR_ARCH_PERFMON_EVENTSEL0, evntsel, 0); 501 + wrmsr(evntsel_msr, evntsel, 0); 502 + 503 + wd->perfctr_msr = perfctr_msr; 504 + wd->evntsel_msr = evntsel_msr; 505 + wd->cccr_msr = 0; //unused 506 + wd->check_bit = 1ULL << (eax.split.bit_width - 1); 711 507 return 1; 508 + fail1: 509 + release_perfctr_nmi(perfctr_msr); 510 + fail: 511 + return 0; 712 512 } 713 513 714 - void setup_apic_nmi_watchdog (void) 514 + static void stop_intel_arch_watchdog(void) 715 515 { 716 - switch (boot_cpu_data.x86_vendor) { 717 - case X86_VENDOR_AMD: 718 - if (boot_cpu_data.x86 != 6 && boot_cpu_data.x86 != 15) 719 - return; 720 - setup_k7_watchdog(); 721 - break; 722 - case X86_VENDOR_INTEL: 723 - if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) { 724 - if (!setup_intel_arch_watchdog()) 516 + unsigned int ebx; 517 + union cpuid10_eax eax; 518 + unsigned int unused; 519 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 520 + 521 + /* 522 + * Check whether the Architectural PerfMon supports 523 + * Unhalted Core Cycles Event or not. 524 + * NOTE: Corresponding bit = 0 in ebx indicates event present. 525 + */ 526 + cpuid(10, &(eax.full), &ebx, &unused, &unused); 527 + if ((eax.split.mask_length < (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX+1)) || 528 + (ebx & ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT)) 529 + return; 530 + 531 + wrmsr(wd->evntsel_msr, 0, 0); 532 + release_evntsel_nmi(wd->evntsel_msr); 533 + release_perfctr_nmi(wd->perfctr_msr); 534 + } 535 + 536 + void setup_apic_nmi_watchdog (void *unused) 537 + { 538 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 539 + 540 + /* only support LOCAL and IO APICs for now */ 541 + if ((nmi_watchdog != NMI_LOCAL_APIC) && 542 + (nmi_watchdog != NMI_IO_APIC)) 543 + return; 544 + 545 + if (wd->enabled == 1) 546 + return; 547 + 548 + /* cheap hack to support suspend/resume */ 549 + /* if cpu0 is not active neither should the other cpus */ 550 + if ((smp_processor_id() != 0) && (atomic_read(&nmi_active) <= 0)) 551 + return; 552 + 553 + if (nmi_watchdog == NMI_LOCAL_APIC) { 554 + switch (boot_cpu_data.x86_vendor) { 555 + case X86_VENDOR_AMD: 556 + if (boot_cpu_data.x86 != 6 && boot_cpu_data.x86 != 15) 557 + return; 558 + if (!setup_k7_watchdog()) 725 559 return; 726 560 break; 727 - } 728 - switch (boot_cpu_data.x86) { 729 - case 6: 730 - if (boot_cpu_data.x86_model > 0xd) 731 - return; 561 + case X86_VENDOR_INTEL: 562 + if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) { 563 + if (!setup_intel_arch_watchdog()) 564 + return; 565 + break; 566 + } 567 + switch (boot_cpu_data.x86) { 568 + case 6: 569 + if (boot_cpu_data.x86_model > 0xd) 570 + return; 732 571 733 - setup_p6_watchdog(); 734 - break; 735 - case 15: 736 - if (boot_cpu_data.x86_model > 0x4) 737 - return; 572 + if (!setup_p6_watchdog()) 573 + return; 574 + break; 575 + case 15: 576 + if (boot_cpu_data.x86_model > 0x4) 577 + return; 738 578 739 - if (!setup_p4_watchdog()) 579 + if (!setup_p4_watchdog()) 580 + return; 581 + break; 582 + default: 740 583 return; 584 + } 741 585 break; 742 586 default: 743 587 return; 744 588 } 745 - break; 746 - default: 747 - return; 748 589 } 749 - lapic_nmi_owner = LAPIC_NMI_WATCHDOG; 750 - nmi_active = 1; 590 + wd->enabled = 1; 591 + atomic_inc(&nmi_active); 592 + } 593 + 594 + void stop_apic_nmi_watchdog(void *unused) 595 + { 596 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 597 + 598 + /* only support LOCAL and IO APICs for now */ 599 + if ((nmi_watchdog != NMI_LOCAL_APIC) && 600 + (nmi_watchdog != NMI_IO_APIC)) 601 + return; 602 + 603 + if (wd->enabled == 0) 604 + return; 605 + 606 + if (nmi_watchdog == NMI_LOCAL_APIC) { 607 + switch (boot_cpu_data.x86_vendor) { 608 + case X86_VENDOR_AMD: 609 + stop_k7_watchdog(); 610 + break; 611 + case X86_VENDOR_INTEL: 612 + if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) { 613 + stop_intel_arch_watchdog(); 614 + break; 615 + } 616 + switch (boot_cpu_data.x86) { 617 + case 6: 618 + if (boot_cpu_data.x86_model > 0xd) 619 + break; 620 + stop_p6_watchdog(); 621 + break; 622 + case 15: 623 + if (boot_cpu_data.x86_model > 0x4) 624 + break; 625 + stop_p4_watchdog(); 626 + break; 627 + } 628 + break; 629 + default: 630 + return; 631 + } 632 + } 633 + wd->enabled = 0; 634 + atomic_dec(&nmi_active); 751 635 } 752 636 753 637 /* ··· 883 579 884 580 extern void die_nmi(struct pt_regs *, const char *msg); 885 581 886 - void nmi_watchdog_tick (struct pt_regs * regs) 582 + __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason) 887 583 { 888 584 889 585 /* ··· 892 588 * smp_processor_id(). 893 589 */ 894 590 unsigned int sum; 591 + int touched = 0; 895 592 int cpu = smp_processor_id(); 593 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 594 + u64 dummy; 595 + int rc=0; 596 + 597 + /* check for other users first */ 598 + if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) 599 + == NOTIFY_STOP) { 600 + rc = 1; 601 + touched = 1; 602 + } 896 603 897 604 sum = per_cpu(irq_stat, cpu).apic_timer_irqs; 898 605 899 - if (last_irq_sums[cpu] == sum) { 606 + /* if the apic timer isn't firing, this cpu isn't doing much */ 607 + if (!touched && last_irq_sums[cpu] == sum) { 900 608 /* 901 609 * Ayiee, looks like this CPU is stuck ... 902 610 * wait a few IRQs (5 seconds) before doing the oops ... ··· 923 607 last_irq_sums[cpu] = sum; 924 608 alert_counter[cpu] = 0; 925 609 } 926 - if (nmi_perfctr_msr) { 927 - if (nmi_perfctr_msr == MSR_P4_IQ_COUNTER0) { 928 - /* 929 - * P4 quirks: 930 - * - An overflown perfctr will assert its interrupt 931 - * until the OVF flag in its CCCR is cleared. 932 - * - LVTPC is masked on interrupt and must be 933 - * unmasked by the LVTPC handler. 610 + /* see if the nmi watchdog went off */ 611 + if (wd->enabled) { 612 + if (nmi_watchdog == NMI_LOCAL_APIC) { 613 + rdmsrl(wd->perfctr_msr, dummy); 614 + if (dummy & wd->check_bit){ 615 + /* this wasn't a watchdog timer interrupt */ 616 + goto done; 617 + } 618 + 619 + /* only Intel P4 uses the cccr msr */ 620 + if (wd->cccr_msr != 0) { 621 + /* 622 + * P4 quirks: 623 + * - An overflown perfctr will assert its interrupt 624 + * until the OVF flag in its CCCR is cleared. 625 + * - LVTPC is masked on interrupt and must be 626 + * unmasked by the LVTPC handler. 627 + */ 628 + rdmsrl(wd->cccr_msr, dummy); 629 + dummy &= ~P4_CCCR_OVF; 630 + wrmsrl(wd->cccr_msr, dummy); 631 + apic_write(APIC_LVTPC, APIC_DM_NMI); 632 + } 633 + else if (wd->perfctr_msr == MSR_P6_PERFCTR0 || 634 + wd->perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0) { 635 + /* P6 based Pentium M need to re-unmask 636 + * the apic vector but it doesn't hurt 637 + * other P6 variant. 638 + * ArchPerfom/Core Duo also needs this */ 639 + apic_write(APIC_LVTPC, APIC_DM_NMI); 640 + } 641 + /* start the cycle over again */ 642 + write_watchdog_counter(wd->perfctr_msr, NULL); 643 + rc = 1; 644 + } else if (nmi_watchdog == NMI_IO_APIC) { 645 + /* don't know how to accurately check for this. 646 + * just assume it was a watchdog timer interrupt 647 + * This matches the old behaviour. 934 648 */ 935 - wrmsr(MSR_P4_IQ_CCCR0, nmi_p4_cccr_val, 0); 936 - apic_write(APIC_LVTPC, APIC_DM_NMI); 649 + rc = 1; 937 650 } 938 - else if (nmi_perfctr_msr == MSR_P6_PERFCTR0 || 939 - nmi_perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0) { 940 - /* Only P6 based Pentium M need to re-unmask 941 - * the apic vector but it doesn't hurt 942 - * other P6 variant */ 943 - apic_write(APIC_LVTPC, APIC_DM_NMI); 944 - } 945 - write_watchdog_counter(NULL); 946 651 } 652 + done: 653 + return rc; 654 + } 655 + 656 + int do_nmi_callback(struct pt_regs * regs, int cpu) 657 + { 658 + #ifdef CONFIG_SYSCTL 659 + if (unknown_nmi_panic) 660 + return unknown_nmi_panic_callback(regs, cpu); 661 + #endif 662 + return 0; 947 663 } 948 664 949 665 #ifdef CONFIG_SYSCTL ··· 985 637 unsigned char reason = get_nmi_reason(); 986 638 char buf[64]; 987 639 988 - if (!(reason & 0xc0)) { 989 - sprintf(buf, "NMI received for unknown reason %02x\n", reason); 990 - die_nmi(regs, buf); 991 - } 640 + sprintf(buf, "NMI received for unknown reason %02x\n", reason); 641 + die_nmi(regs, buf); 992 642 return 0; 993 643 } 994 644 995 645 /* 996 - * proc handler for /proc/sys/kernel/unknown_nmi_panic 646 + * proc handler for /proc/sys/kernel/nmi 997 647 */ 998 - int proc_unknown_nmi_panic(ctl_table *table, int write, struct file *file, 648 + int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file, 999 649 void __user *buffer, size_t *length, loff_t *ppos) 1000 650 { 1001 651 int old_state; 1002 652 1003 - old_state = unknown_nmi_panic; 653 + nmi_watchdog_enabled = (atomic_read(&nmi_active) > 0) ? 1 : 0; 654 + old_state = nmi_watchdog_enabled; 1004 655 proc_dointvec(table, write, file, buffer, length, ppos); 1005 - if (!!old_state == !!unknown_nmi_panic) 656 + if (!!old_state == !!nmi_watchdog_enabled) 1006 657 return 0; 1007 658 1008 - if (unknown_nmi_panic) { 1009 - if (reserve_lapic_nmi() < 0) { 1010 - unknown_nmi_panic = 0; 1011 - return -EBUSY; 1012 - } else { 1013 - set_nmi_callback(unknown_nmi_panic_callback); 1014 - } 659 + if (atomic_read(&nmi_active) < 0) { 660 + printk( KERN_WARNING "NMI watchdog is permanently disabled\n"); 661 + return -EIO; 662 + } 663 + 664 + if (nmi_watchdog == NMI_DEFAULT) { 665 + if (nmi_known_cpu() > 0) 666 + nmi_watchdog = NMI_LOCAL_APIC; 667 + else 668 + nmi_watchdog = NMI_IO_APIC; 669 + } 670 + 671 + if (nmi_watchdog == NMI_LOCAL_APIC) { 672 + if (nmi_watchdog_enabled) 673 + enable_lapic_nmi_watchdog(); 674 + else 675 + disable_lapic_nmi_watchdog(); 1015 676 } else { 1016 - release_lapic_nmi(); 1017 - unset_nmi_callback(); 677 + printk( KERN_WARNING 678 + "NMI watchdog doesn't know what hardware to touch\n"); 679 + return -EIO; 1018 680 } 1019 681 return 0; 1020 682 } ··· 1033 675 1034 676 EXPORT_SYMBOL(nmi_active); 1035 677 EXPORT_SYMBOL(nmi_watchdog); 1036 - EXPORT_SYMBOL(reserve_lapic_nmi); 1037 - EXPORT_SYMBOL(release_lapic_nmi); 678 + EXPORT_SYMBOL(avail_to_resrv_perfctr_nmi); 679 + EXPORT_SYMBOL(avail_to_resrv_perfctr_nmi_bit); 680 + EXPORT_SYMBOL(reserve_perfctr_nmi); 681 + EXPORT_SYMBOL(release_perfctr_nmi); 682 + EXPORT_SYMBOL(reserve_evntsel_nmi); 683 + EXPORT_SYMBOL(release_evntsel_nmi); 1038 684 EXPORT_SYMBOL(disable_timer_nmi_watchdog); 1039 685 EXPORT_SYMBOL(enable_timer_nmi_watchdog);
+3 -11
arch/i386/kernel/process.c
··· 37 37 #include <linux/kallsyms.h> 38 38 #include <linux/ptrace.h> 39 39 #include <linux/random.h> 40 + #include <linux/personality.h> 40 41 41 42 #include <asm/uaccess.h> 42 43 #include <asm/pgtable.h> ··· 321 320 * the "args". 322 321 */ 323 322 extern void kernel_thread_helper(void); 324 - __asm__(".section .text\n" 325 - ".align 4\n" 326 - "kernel_thread_helper:\n\t" 327 - "movl %edx,%eax\n\t" 328 - "pushl %edx\n\t" 329 - "call *%ebx\n\t" 330 - "pushl %eax\n\t" 331 - "call do_exit\n" 332 - ".previous"); 333 323 334 324 /* 335 325 * Create a kernel thread ··· 338 346 regs.xes = __USER_DS; 339 347 regs.orig_eax = -1; 340 348 regs.eip = (unsigned long) kernel_thread_helper; 341 - regs.xcs = __KERNEL_CS; 349 + regs.xcs = __KERNEL_CS | get_kernel_rpl(); 342 350 regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2; 343 351 344 352 /* Ok, create the new process.. */ ··· 897 905 898 906 unsigned long arch_align_stack(unsigned long sp) 899 907 { 900 - if (randomize_va_space) 908 + if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) 901 909 sp -= get_random_int() % 8192; 902 910 return sp & ~0xf; 903 911 }
+5 -5
arch/i386/kernel/ptrace.c
··· 185 185 return addr; 186 186 } 187 187 188 - static inline int is_at_popf(struct task_struct *child, struct pt_regs *regs) 188 + static inline int is_setting_trap_flag(struct task_struct *child, struct pt_regs *regs) 189 189 { 190 190 int i, copied; 191 - unsigned char opcode[16]; 191 + unsigned char opcode[15]; 192 192 unsigned long addr = convert_eip_to_linear(child, regs); 193 193 194 194 copied = access_process_vm(child, addr, opcode, sizeof(opcode), 0); 195 195 for (i = 0; i < copied; i++) { 196 196 switch (opcode[i]) { 197 - /* popf */ 198 - case 0x9d: 197 + /* popf and iret */ 198 + case 0x9d: case 0xcf: 199 199 return 1; 200 200 /* opcode and address size prefixes */ 201 201 case 0x66: case 0x67: ··· 247 247 * don't mark it as being "us" that set it, so that we 248 248 * won't clear it by hand later. 249 249 */ 250 - if (is_at_popf(child, regs)) 250 + if (is_setting_trap_flag(child, regs)) 251 251 return; 252 252 253 253 child->ptrace |= PT_DTRACE;
+147 -15
arch/i386/kernel/relocate_kernel.S
··· 7 7 */ 8 8 9 9 #include <linux/linkage.h> 10 + #include <asm/page.h> 11 + #include <asm/kexec.h> 10 12 11 - /* 12 - * Must be relocatable PIC code callable as a C function, that once 13 - * it starts can not use the previous processes stack. 14 - */ 15 - .globl relocate_new_kernel 13 + /* 14 + * Must be relocatable PIC code callable as a C function 15 + */ 16 + 17 + #define PTR(x) (x << 2) 18 + #define PAGE_ALIGNED (1 << PAGE_SHIFT) 19 + #define PAGE_ATTR 0x63 /* _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY */ 20 + #define PAE_PGD_ATTR 0x01 /* _PAGE_PRESENT */ 21 + 22 + .text 23 + .align PAGE_ALIGNED 24 + .globl relocate_kernel 25 + relocate_kernel: 26 + movl 8(%esp), %ebp /* list of pages */ 27 + 28 + #ifdef CONFIG_X86_PAE 29 + /* map the control page at its virtual address */ 30 + 31 + movl PTR(VA_PGD)(%ebp), %edi 32 + movl PTR(VA_CONTROL_PAGE)(%ebp), %eax 33 + andl $0xc0000000, %eax 34 + shrl $27, %eax 35 + addl %edi, %eax 36 + 37 + movl PTR(PA_PMD_0)(%ebp), %edx 38 + orl $PAE_PGD_ATTR, %edx 39 + movl %edx, (%eax) 40 + 41 + movl PTR(VA_PMD_0)(%ebp), %edi 42 + movl PTR(VA_CONTROL_PAGE)(%ebp), %eax 43 + andl $0x3fe00000, %eax 44 + shrl $18, %eax 45 + addl %edi, %eax 46 + 47 + movl PTR(PA_PTE_0)(%ebp), %edx 48 + orl $PAGE_ATTR, %edx 49 + movl %edx, (%eax) 50 + 51 + movl PTR(VA_PTE_0)(%ebp), %edi 52 + movl PTR(VA_CONTROL_PAGE)(%ebp), %eax 53 + andl $0x001ff000, %eax 54 + shrl $9, %eax 55 + addl %edi, %eax 56 + 57 + movl PTR(PA_CONTROL_PAGE)(%ebp), %edx 58 + orl $PAGE_ATTR, %edx 59 + movl %edx, (%eax) 60 + 61 + /* identity map the control page at its physical address */ 62 + 63 + movl PTR(VA_PGD)(%ebp), %edi 64 + movl PTR(PA_CONTROL_PAGE)(%ebp), %eax 65 + andl $0xc0000000, %eax 66 + shrl $27, %eax 67 + addl %edi, %eax 68 + 69 + movl PTR(PA_PMD_1)(%ebp), %edx 70 + orl $PAE_PGD_ATTR, %edx 71 + movl %edx, (%eax) 72 + 73 + movl PTR(VA_PMD_1)(%ebp), %edi 74 + movl PTR(PA_CONTROL_PAGE)(%ebp), %eax 75 + andl $0x3fe00000, %eax 76 + shrl $18, %eax 77 + addl %edi, %eax 78 + 79 + movl PTR(PA_PTE_1)(%ebp), %edx 80 + orl $PAGE_ATTR, %edx 81 + movl %edx, (%eax) 82 + 83 + movl PTR(VA_PTE_1)(%ebp), %edi 84 + movl PTR(PA_CONTROL_PAGE)(%ebp), %eax 85 + andl $0x001ff000, %eax 86 + shrl $9, %eax 87 + addl %edi, %eax 88 + 89 + movl PTR(PA_CONTROL_PAGE)(%ebp), %edx 90 + orl $PAGE_ATTR, %edx 91 + movl %edx, (%eax) 92 + #else 93 + /* map the control page at its virtual address */ 94 + 95 + movl PTR(VA_PGD)(%ebp), %edi 96 + movl PTR(VA_CONTROL_PAGE)(%ebp), %eax 97 + andl $0xffc00000, %eax 98 + shrl $20, %eax 99 + addl %edi, %eax 100 + 101 + movl PTR(PA_PTE_0)(%ebp), %edx 102 + orl $PAGE_ATTR, %edx 103 + movl %edx, (%eax) 104 + 105 + movl PTR(VA_PTE_0)(%ebp), %edi 106 + movl PTR(VA_CONTROL_PAGE)(%ebp), %eax 107 + andl $0x003ff000, %eax 108 + shrl $10, %eax 109 + addl %edi, %eax 110 + 111 + movl PTR(PA_CONTROL_PAGE)(%ebp), %edx 112 + orl $PAGE_ATTR, %edx 113 + movl %edx, (%eax) 114 + 115 + /* identity map the control page at its physical address */ 116 + 117 + movl PTR(VA_PGD)(%ebp), %edi 118 + movl PTR(PA_CONTROL_PAGE)(%ebp), %eax 119 + andl $0xffc00000, %eax 120 + shrl $20, %eax 121 + addl %edi, %eax 122 + 123 + movl PTR(PA_PTE_1)(%ebp), %edx 124 + orl $PAGE_ATTR, %edx 125 + movl %edx, (%eax) 126 + 127 + movl PTR(VA_PTE_1)(%ebp), %edi 128 + movl PTR(PA_CONTROL_PAGE)(%ebp), %eax 129 + andl $0x003ff000, %eax 130 + shrl $10, %eax 131 + addl %edi, %eax 132 + 133 + movl PTR(PA_CONTROL_PAGE)(%ebp), %edx 134 + orl $PAGE_ATTR, %edx 135 + movl %edx, (%eax) 136 + #endif 137 + 16 138 relocate_new_kernel: 17 139 /* read the arguments and say goodbye to the stack */ 18 140 movl 4(%esp), %ebx /* page_list */ 19 - movl 8(%esp), %ebp /* reboot_code_buffer */ 141 + movl 8(%esp), %ebp /* list of pages */ 20 142 movl 12(%esp), %edx /* start address */ 21 143 movl 16(%esp), %ecx /* cpu_has_pae */ 22 144 ··· 146 24 pushl $0 147 25 popfl 148 26 149 - /* set a new stack at the bottom of our page... */ 150 - lea 4096(%ebp), %esp 27 + /* get physical address of control page now */ 28 + /* this is impossible after page table switch */ 29 + movl PTR(PA_CONTROL_PAGE)(%ebp), %edi 151 30 152 - /* store the parameters back on the stack */ 153 - pushl %edx /* store the start address */ 31 + /* switch to new set of page tables */ 32 + movl PTR(PA_PGD)(%ebp), %eax 33 + movl %eax, %cr3 34 + 35 + /* setup a new stack at the end of the physical control page */ 36 + lea 4096(%edi), %esp 37 + 38 + /* jump to identity mapped page */ 39 + movl %edi, %eax 40 + addl $(identity_mapped - relocate_kernel), %eax 41 + pushl %eax 42 + ret 43 + 44 + identity_mapped: 45 + /* store the start address on the stack */ 46 + pushl %edx 154 47 155 48 /* Set cr0 to a known state: 156 49 * 31 0 == Paging disabled ··· 250 113 xorl %edi, %edi 251 114 xorl %ebp, %ebp 252 115 ret 253 - relocate_new_kernel_end: 254 - 255 - .globl relocate_new_kernel_size 256 - relocate_new_kernel_size: 257 - .long relocate_new_kernel_end - relocate_new_kernel
-134
arch/i386/kernel/semaphore.c
··· 1 - /* 2 - * i386 semaphore implementation. 3 - * 4 - * (C) Copyright 1999 Linus Torvalds 5 - * 6 - * Portions Copyright 1999 Red Hat, Inc. 7 - * 8 - * This program is free software; you can redistribute it and/or 9 - * modify it under the terms of the GNU General Public License 10 - * as published by the Free Software Foundation; either version 11 - * 2 of the License, or (at your option) any later version. 12 - * 13 - * rw semaphores implemented November 1999 by Benjamin LaHaise <bcrl@kvack.org> 14 - */ 15 - #include <asm/semaphore.h> 16 - 17 - /* 18 - * The semaphore operations have a special calling sequence that 19 - * allow us to do a simpler in-line version of them. These routines 20 - * need to convert that sequence back into the C sequence when 21 - * there is contention on the semaphore. 22 - * 23 - * %eax contains the semaphore pointer on entry. Save the C-clobbered 24 - * registers (%eax, %edx and %ecx) except %eax whish is either a return 25 - * value or just clobbered.. 26 - */ 27 - asm( 28 - ".section .sched.text\n" 29 - ".align 4\n" 30 - ".globl __down_failed\n" 31 - "__down_failed:\n\t" 32 - #if defined(CONFIG_FRAME_POINTER) 33 - "pushl %ebp\n\t" 34 - "movl %esp,%ebp\n\t" 35 - #endif 36 - "pushl %edx\n\t" 37 - "pushl %ecx\n\t" 38 - "call __down\n\t" 39 - "popl %ecx\n\t" 40 - "popl %edx\n\t" 41 - #if defined(CONFIG_FRAME_POINTER) 42 - "movl %ebp,%esp\n\t" 43 - "popl %ebp\n\t" 44 - #endif 45 - "ret" 46 - ); 47 - 48 - asm( 49 - ".section .sched.text\n" 50 - ".align 4\n" 51 - ".globl __down_failed_interruptible\n" 52 - "__down_failed_interruptible:\n\t" 53 - #if defined(CONFIG_FRAME_POINTER) 54 - "pushl %ebp\n\t" 55 - "movl %esp,%ebp\n\t" 56 - #endif 57 - "pushl %edx\n\t" 58 - "pushl %ecx\n\t" 59 - "call __down_interruptible\n\t" 60 - "popl %ecx\n\t" 61 - "popl %edx\n\t" 62 - #if defined(CONFIG_FRAME_POINTER) 63 - "movl %ebp,%esp\n\t" 64 - "popl %ebp\n\t" 65 - #endif 66 - "ret" 67 - ); 68 - 69 - asm( 70 - ".section .sched.text\n" 71 - ".align 4\n" 72 - ".globl __down_failed_trylock\n" 73 - "__down_failed_trylock:\n\t" 74 - #if defined(CONFIG_FRAME_POINTER) 75 - "pushl %ebp\n\t" 76 - "movl %esp,%ebp\n\t" 77 - #endif 78 - "pushl %edx\n\t" 79 - "pushl %ecx\n\t" 80 - "call __down_trylock\n\t" 81 - "popl %ecx\n\t" 82 - "popl %edx\n\t" 83 - #if defined(CONFIG_FRAME_POINTER) 84 - "movl %ebp,%esp\n\t" 85 - "popl %ebp\n\t" 86 - #endif 87 - "ret" 88 - ); 89 - 90 - asm( 91 - ".section .sched.text\n" 92 - ".align 4\n" 93 - ".globl __up_wakeup\n" 94 - "__up_wakeup:\n\t" 95 - "pushl %edx\n\t" 96 - "pushl %ecx\n\t" 97 - "call __up\n\t" 98 - "popl %ecx\n\t" 99 - "popl %edx\n\t" 100 - "ret" 101 - ); 102 - 103 - /* 104 - * rw spinlock fallbacks 105 - */ 106 - #if defined(CONFIG_SMP) 107 - asm( 108 - ".section .sched.text\n" 109 - ".align 4\n" 110 - ".globl __write_lock_failed\n" 111 - "__write_lock_failed:\n\t" 112 - LOCK_PREFIX "addl $" RW_LOCK_BIAS_STR ",(%eax)\n" 113 - "1: rep; nop\n\t" 114 - "cmpl $" RW_LOCK_BIAS_STR ",(%eax)\n\t" 115 - "jne 1b\n\t" 116 - LOCK_PREFIX "subl $" RW_LOCK_BIAS_STR ",(%eax)\n\t" 117 - "jnz __write_lock_failed\n\t" 118 - "ret" 119 - ); 120 - 121 - asm( 122 - ".section .sched.text\n" 123 - ".align 4\n" 124 - ".globl __read_lock_failed\n" 125 - "__read_lock_failed:\n\t" 126 - LOCK_PREFIX "incl (%eax)\n" 127 - "1: rep; nop\n\t" 128 - "cmpl $1,(%eax)\n\t" 129 - "js 1b\n\t" 130 - LOCK_PREFIX "decl (%eax)\n\t" 131 - "js __read_lock_failed\n\t" 132 - "ret" 133 - ); 134 - #endif
+138 -249
arch/i386/kernel/setup.c
··· 90 90 91 91 unsigned long mmu_cr4_features; 92 92 93 - #ifdef CONFIG_ACPI 94 - int acpi_disabled = 0; 95 - #else 96 - int acpi_disabled = 1; 97 - #endif 98 - EXPORT_SYMBOL(acpi_disabled); 99 - 100 - #ifdef CONFIG_ACPI 101 - int __initdata acpi_force = 0; 102 - extern acpi_interrupt_flags acpi_sci_flags; 103 - #endif 104 - 105 93 /* for MCA, but anyone else can use it if they want */ 106 94 unsigned int machine_id; 107 95 #ifdef CONFIG_MCA ··· 137 149 struct e820map e820; 138 150 139 151 extern void early_cpu_init(void); 140 - extern void generic_apic_probe(char *); 141 152 extern int root_mountflags; 142 153 143 154 unsigned long saved_videomode; ··· 688 701 } 689 702 #endif 690 703 691 - static void __init parse_cmdline_early (char ** cmdline_p) 704 + static int __initdata user_defined_memmap = 0; 705 + 706 + /* 707 + * "mem=nopentium" disables the 4MB page tables. 708 + * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM 709 + * to <mem>, overriding the bios size. 710 + * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from 711 + * <start> to <start>+<mem>, overriding the bios size. 712 + * 713 + * HPA tells me bootloaders need to parse mem=, so no new 714 + * option should be mem= [also see Documentation/i386/boot.txt] 715 + */ 716 + static int __init parse_mem(char *arg) 692 717 { 693 - char c = ' ', *to = command_line, *from = saved_command_line; 694 - int len = 0; 695 - int userdef = 0; 718 + if (!arg) 719 + return -EINVAL; 696 720 697 - /* Save unparsed command line copy for /proc/cmdline */ 698 - saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; 699 - 700 - for (;;) { 701 - if (c != ' ') 702 - goto next_char; 703 - /* 704 - * "mem=nopentium" disables the 4MB page tables. 705 - * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM 706 - * to <mem>, overriding the bios size. 707 - * "memmap=XXX[KkmM]@XXX[KkmM]" defines a memory region from 708 - * <start> to <start>+<mem>, overriding the bios size. 709 - * 710 - * HPA tells me bootloaders need to parse mem=, so no new 711 - * option should be mem= [also see Documentation/i386/boot.txt] 721 + if (strcmp(arg, "nopentium") == 0) { 722 + clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability); 723 + disable_pse = 1; 724 + } else { 725 + /* If the user specifies memory size, we 726 + * limit the BIOS-provided memory map to 727 + * that size. exactmap can be used to specify 728 + * the exact map. mem=number can be used to 729 + * trim the existing memory map. 712 730 */ 713 - if (!memcmp(from, "mem=", 4)) { 714 - if (to != command_line) 715 - to--; 716 - if (!memcmp(from+4, "nopentium", 9)) { 717 - from += 9+4; 718 - clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability); 719 - disable_pse = 1; 720 - } else { 721 - /* If the user specifies memory size, we 722 - * limit the BIOS-provided memory map to 723 - * that size. exactmap can be used to specify 724 - * the exact map. mem=number can be used to 725 - * trim the existing memory map. 726 - */ 727 - unsigned long long mem_size; 731 + unsigned long long mem_size; 728 732 729 - mem_size = memparse(from+4, &from); 730 - limit_regions(mem_size); 731 - userdef=1; 732 - } 733 - } 734 - 735 - else if (!memcmp(from, "memmap=", 7)) { 736 - if (to != command_line) 737 - to--; 738 - if (!memcmp(from+7, "exactmap", 8)) { 739 - #ifdef CONFIG_CRASH_DUMP 740 - /* If we are doing a crash dump, we 741 - * still need to know the real mem 742 - * size before original memory map is 743 - * reset. 744 - */ 745 - find_max_pfn(); 746 - saved_max_pfn = max_pfn; 747 - #endif 748 - from += 8+7; 749 - e820.nr_map = 0; 750 - userdef = 1; 751 - } else { 752 - /* If the user specifies memory size, we 753 - * limit the BIOS-provided memory map to 754 - * that size. exactmap can be used to specify 755 - * the exact map. mem=number can be used to 756 - * trim the existing memory map. 757 - */ 758 - unsigned long long start_at, mem_size; 759 - 760 - mem_size = memparse(from+7, &from); 761 - if (*from == '@') { 762 - start_at = memparse(from+1, &from); 763 - add_memory_region(start_at, mem_size, E820_RAM); 764 - } else if (*from == '#') { 765 - start_at = memparse(from+1, &from); 766 - add_memory_region(start_at, mem_size, E820_ACPI); 767 - } else if (*from == '$') { 768 - start_at = memparse(from+1, &from); 769 - add_memory_region(start_at, mem_size, E820_RESERVED); 770 - } else { 771 - limit_regions(mem_size); 772 - userdef=1; 773 - } 774 - } 775 - } 776 - 777 - else if (!memcmp(from, "noexec=", 7)) 778 - noexec_setup(from + 7); 779 - 780 - 781 - #ifdef CONFIG_X86_SMP 782 - /* 783 - * If the BIOS enumerates physical processors before logical, 784 - * maxcpus=N at enumeration-time can be used to disable HT. 785 - */ 786 - else if (!memcmp(from, "maxcpus=", 8)) { 787 - extern unsigned int maxcpus; 788 - 789 - maxcpus = simple_strtoul(from + 8, NULL, 0); 790 - } 791 - #endif 792 - 793 - #ifdef CONFIG_ACPI 794 - /* "acpi=off" disables both ACPI table parsing and interpreter */ 795 - else if (!memcmp(from, "acpi=off", 8)) { 796 - disable_acpi(); 797 - } 798 - 799 - /* acpi=force to over-ride black-list */ 800 - else if (!memcmp(from, "acpi=force", 10)) { 801 - acpi_force = 1; 802 - acpi_ht = 1; 803 - acpi_disabled = 0; 804 - } 805 - 806 - /* acpi=strict disables out-of-spec workarounds */ 807 - else if (!memcmp(from, "acpi=strict", 11)) { 808 - acpi_strict = 1; 809 - } 810 - 811 - /* Limit ACPI just to boot-time to enable HT */ 812 - else if (!memcmp(from, "acpi=ht", 7)) { 813 - if (!acpi_force) 814 - disable_acpi(); 815 - acpi_ht = 1; 816 - } 817 - 818 - /* "pci=noacpi" disable ACPI IRQ routing and PCI scan */ 819 - else if (!memcmp(from, "pci=noacpi", 10)) { 820 - acpi_disable_pci(); 821 - } 822 - /* "acpi=noirq" disables ACPI interrupt routing */ 823 - else if (!memcmp(from, "acpi=noirq", 10)) { 824 - acpi_noirq_set(); 825 - } 826 - 827 - else if (!memcmp(from, "acpi_sci=edge", 13)) 828 - acpi_sci_flags.trigger = 1; 829 - 830 - else if (!memcmp(from, "acpi_sci=level", 14)) 831 - acpi_sci_flags.trigger = 3; 832 - 833 - else if (!memcmp(from, "acpi_sci=high", 13)) 834 - acpi_sci_flags.polarity = 1; 835 - 836 - else if (!memcmp(from, "acpi_sci=low", 12)) 837 - acpi_sci_flags.polarity = 3; 838 - 839 - #ifdef CONFIG_X86_IO_APIC 840 - else if (!memcmp(from, "acpi_skip_timer_override", 24)) 841 - acpi_skip_timer_override = 1; 842 - 843 - if (!memcmp(from, "disable_timer_pin_1", 19)) 844 - disable_timer_pin_1 = 1; 845 - if (!memcmp(from, "enable_timer_pin_1", 18)) 846 - disable_timer_pin_1 = -1; 847 - 848 - /* disable IO-APIC */ 849 - else if (!memcmp(from, "noapic", 6)) 850 - disable_ioapic_setup(); 851 - #endif /* CONFIG_X86_IO_APIC */ 852 - #endif /* CONFIG_ACPI */ 853 - 854 - #ifdef CONFIG_X86_LOCAL_APIC 855 - /* enable local APIC */ 856 - else if (!memcmp(from, "lapic", 5)) 857 - lapic_enable(); 858 - 859 - /* disable local APIC */ 860 - else if (!memcmp(from, "nolapic", 6)) 861 - lapic_disable(); 862 - #endif /* CONFIG_X86_LOCAL_APIC */ 863 - 864 - #ifdef CONFIG_KEXEC 865 - /* crashkernel=size@addr specifies the location to reserve for 866 - * a crash kernel. By reserving this memory we guarantee 867 - * that linux never set's it up as a DMA target. 868 - * Useful for holding code to do something appropriate 869 - * after a kernel panic. 870 - */ 871 - else if (!memcmp(from, "crashkernel=", 12)) { 872 - unsigned long size, base; 873 - size = memparse(from+12, &from); 874 - if (*from == '@') { 875 - base = memparse(from+1, &from); 876 - /* FIXME: Do I want a sanity check 877 - * to validate the memory range? 878 - */ 879 - crashk_res.start = base; 880 - crashk_res.end = base + size - 1; 881 - } 882 - } 883 - #endif 884 - #ifdef CONFIG_PROC_VMCORE 885 - /* elfcorehdr= specifies the location of elf core header 886 - * stored by the crashed kernel. 887 - */ 888 - else if (!memcmp(from, "elfcorehdr=", 11)) 889 - elfcorehdr_addr = memparse(from+11, &from); 890 - #endif 891 - 892 - /* 893 - * highmem=size forces highmem to be exactly 'size' bytes. 894 - * This works even on boxes that have no highmem otherwise. 895 - * This also works to reduce highmem size on bigger boxes. 896 - */ 897 - else if (!memcmp(from, "highmem=", 8)) 898 - highmem_pages = memparse(from+8, &from) >> PAGE_SHIFT; 899 - 900 - /* 901 - * vmalloc=size forces the vmalloc area to be exactly 'size' 902 - * bytes. This can be used to increase (or decrease) the 903 - * vmalloc area - the default is 128m. 904 - */ 905 - else if (!memcmp(from, "vmalloc=", 8)) 906 - __VMALLOC_RESERVE = memparse(from+8, &from); 907 - 908 - next_char: 909 - c = *(from++); 910 - if (!c) 911 - break; 912 - if (COMMAND_LINE_SIZE <= ++len) 913 - break; 914 - *(to++) = c; 733 + mem_size = memparse(arg, &arg); 734 + limit_regions(mem_size); 735 + user_defined_memmap = 1; 915 736 } 916 - *to = '\0'; 917 - *cmdline_p = command_line; 918 - if (userdef) { 919 - printk(KERN_INFO "user-defined physical RAM map:\n"); 920 - print_memory_map("user"); 921 - } 737 + return 0; 922 738 } 739 + early_param("mem", parse_mem); 740 + 741 + static int __init parse_memmap(char *arg) 742 + { 743 + if (!arg) 744 + return -EINVAL; 745 + 746 + if (strcmp(arg, "exactmap") == 0) { 747 + #ifdef CONFIG_CRASH_DUMP 748 + /* If we are doing a crash dump, we 749 + * still need to know the real mem 750 + * size before original memory map is 751 + * reset. 752 + */ 753 + find_max_pfn(); 754 + saved_max_pfn = max_pfn; 755 + #endif 756 + e820.nr_map = 0; 757 + user_defined_memmap = 1; 758 + } else { 759 + /* If the user specifies memory size, we 760 + * limit the BIOS-provided memory map to 761 + * that size. exactmap can be used to specify 762 + * the exact map. mem=number can be used to 763 + * trim the existing memory map. 764 + */ 765 + unsigned long long start_at, mem_size; 766 + 767 + mem_size = memparse(arg, &arg); 768 + if (*arg == '@') { 769 + start_at = memparse(arg+1, &arg); 770 + add_memory_region(start_at, mem_size, E820_RAM); 771 + } else if (*arg == '#') { 772 + start_at = memparse(arg+1, &arg); 773 + add_memory_region(start_at, mem_size, E820_ACPI); 774 + } else if (*arg == '$') { 775 + start_at = memparse(arg+1, &arg); 776 + add_memory_region(start_at, mem_size, E820_RESERVED); 777 + } else { 778 + limit_regions(mem_size); 779 + user_defined_memmap = 1; 780 + } 781 + } 782 + return 0; 783 + } 784 + early_param("memmap", parse_memmap); 785 + 786 + #ifdef CONFIG_PROC_VMCORE 787 + /* elfcorehdr= specifies the location of elf core header 788 + * stored by the crashed kernel. 789 + */ 790 + static int __init parse_elfcorehdr(char *arg) 791 + { 792 + if (!arg) 793 + return -EINVAL; 794 + 795 + elfcorehdr_addr = memparse(arg, &arg); 796 + return 0; 797 + } 798 + early_param("elfcorehdr", parse_elfcorehdr); 799 + #endif /* CONFIG_PROC_VMCORE */ 800 + 801 + /* 802 + * highmem=size forces highmem to be exactly 'size' bytes. 803 + * This works even on boxes that have no highmem otherwise. 804 + * This also works to reduce highmem size on bigger boxes. 805 + */ 806 + static int __init parse_highmem(char *arg) 807 + { 808 + if (!arg) 809 + return -EINVAL; 810 + 811 + highmem_pages = memparse(arg, &arg) >> PAGE_SHIFT; 812 + return 0; 813 + } 814 + early_param("highmem", parse_highmem); 815 + 816 + /* 817 + * vmalloc=size forces the vmalloc area to be exactly 'size' 818 + * bytes. This can be used to increase (or decrease) the 819 + * vmalloc area - the default is 128m. 820 + */ 821 + static int __init parse_vmalloc(char *arg) 822 + { 823 + if (!arg) 824 + return -EINVAL; 825 + 826 + __VMALLOC_RESERVE = memparse(arg, &arg); 827 + return 0; 828 + } 829 + early_param("vmalloc", parse_vmalloc); 923 830 924 831 /* 925 832 * reservetop=size reserves a hole at the top of the kernel address space which ··· 1070 1189 } 1071 1190 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", 1072 1191 pages_to_mb(highend_pfn - highstart_pfn)); 1192 + num_physpages = highend_pfn; 1193 + high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; 1194 + #else 1195 + num_physpages = max_low_pfn; 1196 + high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; 1197 + #endif 1198 + #ifdef CONFIG_FLATMEM 1199 + max_mapnr = num_physpages; 1073 1200 #endif 1074 1201 printk(KERN_NOTICE "%ldMB LOWMEM available.\n", 1075 1202 pages_to_mb(max_low_pfn)); ··· 1407 1518 data_resource.start = virt_to_phys(_etext); 1408 1519 data_resource.end = virt_to_phys(_edata)-1; 1409 1520 1410 - parse_cmdline_early(cmdline_p); 1521 + parse_early_param(); 1411 1522 1412 - #ifdef CONFIG_EARLY_PRINTK 1413 - { 1414 - char *s = strstr(*cmdline_p, "earlyprintk="); 1415 - if (s) { 1416 - setup_early_printk(strchr(s, '=') + 1); 1417 - printk("early console enabled\n"); 1418 - } 1523 + if (user_defined_memmap) { 1524 + printk(KERN_INFO "user-defined physical RAM map:\n"); 1525 + print_memory_map("user"); 1419 1526 } 1420 - #endif 1527 + 1528 + strlcpy(command_line, saved_command_line, COMMAND_LINE_SIZE); 1529 + *cmdline_p = command_line; 1421 1530 1422 1531 max_low_pfn = setup_memory(); 1423 1532 ··· 1444 1557 dmi_scan_machine(); 1445 1558 1446 1559 #ifdef CONFIG_X86_GENERICARCH 1447 - generic_apic_probe(*cmdline_p); 1560 + generic_apic_probe(); 1448 1561 #endif 1449 1562 if (efi_enabled) 1450 1563 efi_map_memmap(); ··· 1456 1569 acpi_boot_table_init(); 1457 1570 #endif 1458 1571 1572 + #ifdef CONFIG_PCI 1459 1573 #ifdef CONFIG_X86_IO_APIC 1460 1574 check_acpi_pci(); /* Checks more than just ACPI actually */ 1575 + #endif 1461 1576 #endif 1462 1577 1463 1578 #ifdef CONFIG_ACPI
+18 -1
arch/i386/kernel/smpboot.c
··· 177 177 */ 178 178 if ((c->x86_vendor == X86_VENDOR_AMD) && (c->x86 == 6)) { 179 179 180 + if (num_possible_cpus() == 1) 181 + goto valid_k7; 182 + 180 183 /* Athlon 660/661 is valid. */ 181 184 if ((c->x86_model==6) && ((c->x86_mask==0) || (c->x86_mask==1))) 182 185 goto valid_k7; ··· 1379 1376 */ 1380 1377 if (cpu == 0) 1381 1378 return -EBUSY; 1382 - 1379 + if (nmi_watchdog == NMI_LOCAL_APIC) 1380 + stop_apic_nmi_watchdog(NULL); 1383 1381 clear_local_APIC(); 1384 1382 /* Allow any queued timer interrupts to get serviced */ 1385 1383 local_irq_enable(); ··· 1494 1490 /* IPI for generic function call */ 1495 1491 set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); 1496 1492 } 1493 + 1494 + /* 1495 + * If the BIOS enumerates physical processors before logical, 1496 + * maxcpus=N at enumeration-time can be used to disable HT. 1497 + */ 1498 + static int __init parse_maxcpus(char *arg) 1499 + { 1500 + extern unsigned int maxcpus; 1501 + 1502 + maxcpus = simple_strtoul(arg, NULL, 0); 1503 + return 0; 1504 + } 1505 + early_param("maxcpus", parse_maxcpus);
-98
arch/i386/kernel/stacktrace.c
··· 1 - /* 2 - * arch/i386/kernel/stacktrace.c 3 - * 4 - * Stack trace management functions 5 - * 6 - * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> 7 - */ 8 - #include <linux/sched.h> 9 - #include <linux/stacktrace.h> 10 - 11 - static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) 12 - { 13 - return p > (void *)tinfo && 14 - p < (void *)tinfo + THREAD_SIZE - 3; 15 - } 16 - 17 - /* 18 - * Save stack-backtrace addresses into a stack_trace buffer: 19 - */ 20 - static inline unsigned long 21 - save_context_stack(struct stack_trace *trace, unsigned int skip, 22 - struct thread_info *tinfo, unsigned long *stack, 23 - unsigned long ebp) 24 - { 25 - unsigned long addr; 26 - 27 - #ifdef CONFIG_FRAME_POINTER 28 - while (valid_stack_ptr(tinfo, (void *)ebp)) { 29 - addr = *(unsigned long *)(ebp + 4); 30 - if (!skip) 31 - trace->entries[trace->nr_entries++] = addr; 32 - else 33 - skip--; 34 - if (trace->nr_entries >= trace->max_entries) 35 - break; 36 - /* 37 - * break out of recursive entries (such as 38 - * end_of_stack_stop_unwind_function): 39 - */ 40 - if (ebp == *(unsigned long *)ebp) 41 - break; 42 - 43 - ebp = *(unsigned long *)ebp; 44 - } 45 - #else 46 - while (valid_stack_ptr(tinfo, stack)) { 47 - addr = *stack++; 48 - if (__kernel_text_address(addr)) { 49 - if (!skip) 50 - trace->entries[trace->nr_entries++] = addr; 51 - else 52 - skip--; 53 - if (trace->nr_entries >= trace->max_entries) 54 - break; 55 - } 56 - } 57 - #endif 58 - 59 - return ebp; 60 - } 61 - 62 - /* 63 - * Save stack-backtrace addresses into a stack_trace buffer. 64 - * If all_contexts is set, all contexts (hardirq, softirq and process) 65 - * are saved. If not set then only the current context is saved. 66 - */ 67 - void save_stack_trace(struct stack_trace *trace, 68 - struct task_struct *task, int all_contexts, 69 - unsigned int skip) 70 - { 71 - unsigned long ebp; 72 - unsigned long *stack = &ebp; 73 - 74 - WARN_ON(trace->nr_entries || !trace->max_entries); 75 - 76 - if (!task || task == current) { 77 - /* Grab ebp right from our regs: */ 78 - asm ("movl %%ebp, %0" : "=r" (ebp)); 79 - } else { 80 - /* ebp is the last reg pushed by switch_to(): */ 81 - ebp = *(unsigned long *) task->thread.esp; 82 - } 83 - 84 - while (1) { 85 - struct thread_info *context = (struct thread_info *) 86 - ((unsigned long)stack & (~(THREAD_SIZE - 1))); 87 - 88 - ebp = save_context_stack(trace, skip, context, stack, ebp); 89 - stack = (unsigned long *)context->previous_esp; 90 - if (!all_contexts || !stack || 91 - trace->nr_entries >= trace->max_entries) 92 - break; 93 - trace->entries[trace->nr_entries++] = ULONG_MAX; 94 - if (trace->nr_entries >= trace->max_entries) 95 - break; 96 - } 97 - } 98 -
+1
arch/i386/kernel/syscall_table.S
··· 317 317 .long sys_tee /* 315 */ 318 318 .long sys_vmsplice 319 319 .long sys_move_pages 320 + .long sys_getcpu
+19 -4
arch/i386/kernel/time.c
··· 130 130 131 131 int timer_ack; 132 132 133 - #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER) 134 133 unsigned long profile_pc(struct pt_regs *regs) 135 134 { 136 135 unsigned long pc = instruction_pointer(regs); 137 136 138 - if (!user_mode_vm(regs) && in_lock_functions(pc)) 137 + #ifdef CONFIG_SMP 138 + if (!user_mode_vm(regs) && in_lock_functions(pc)) { 139 + #ifdef CONFIG_FRAME_POINTER 139 140 return *(unsigned long *)(regs->ebp + 4); 140 - 141 + #else 142 + unsigned long *sp; 143 + if ((regs->xcs & 3) == 0) 144 + sp = (unsigned long *)&regs->esp; 145 + else 146 + sp = (unsigned long *)regs->esp; 147 + /* Return address is either directly at stack pointer 148 + or above a saved eflags. Eflags has bits 22-31 zero, 149 + kernel addresses don't. */ 150 + if (sp[0] >> 22) 151 + return sp[0]; 152 + if (sp[1] >> 22) 153 + return sp[1]; 154 + #endif 155 + } 156 + #endif 141 157 return pc; 142 158 } 143 159 EXPORT_SYMBOL(profile_pc); 144 - #endif 145 160 146 161 /* 147 162 * This is the same as the above, except we _also_ save the current
+9 -24
arch/i386/kernel/topology.c
··· 28 28 #include <linux/init.h> 29 29 #include <linux/smp.h> 30 30 #include <linux/nodemask.h> 31 + #include <linux/mmzone.h> 31 32 #include <asm/cpu.h> 32 33 33 34 static struct i386_cpu cpu_devices[NR_CPUS]; ··· 56 55 EXPORT_SYMBOL(arch_unregister_cpu); 57 56 #endif /*CONFIG_HOTPLUG_CPU*/ 58 57 59 - 58 + static int __init topology_init(void) 59 + { 60 + int i; 60 61 61 62 #ifdef CONFIG_NUMA 62 - #include <linux/mmzone.h> 63 - 64 - static int __init topology_init(void) 65 - { 66 - int i; 67 - 68 63 for_each_online_node(i) 69 64 register_one_node(i); 70 - 71 - for_each_present_cpu(i) 72 - arch_register_cpu(i); 73 - return 0; 74 - } 75 - 76 - #else /* !CONFIG_NUMA */ 77 - 78 - static int __init topology_init(void) 79 - { 80 - int i; 81 - 82 - for_each_present_cpu(i) 83 - arch_register_cpu(i); 84 - return 0; 85 - } 86 - 87 65 #endif /* CONFIG_NUMA */ 66 + 67 + for_each_present_cpu(i) 68 + arch_register_cpu(i); 69 + return 0; 70 + } 88 71 89 72 subsys_initcall(topology_init);
+130 -94
arch/i386/kernel/traps.c
··· 51 51 #include <asm/smp.h> 52 52 #include <asm/arch_hooks.h> 53 53 #include <asm/kdebug.h> 54 + #include <asm/stacktrace.h> 54 55 55 56 #include <linux/module.h> 56 57 ··· 119 118 p < (void *)tinfo + THREAD_SIZE - 3; 120 119 } 121 120 122 - /* 123 - * Print one address/symbol entries per line. 124 - */ 125 - static inline void print_addr_and_symbol(unsigned long addr, char *log_lvl) 126 - { 127 - printk(" [<%08lx>] ", addr); 128 - 129 - print_symbol("%s\n", addr); 130 - } 131 - 132 121 static inline unsigned long print_context_stack(struct thread_info *tinfo, 133 122 unsigned long *stack, unsigned long ebp, 134 - char *log_lvl) 123 + struct stacktrace_ops *ops, void *data) 135 124 { 136 125 unsigned long addr; 137 126 138 127 #ifdef CONFIG_FRAME_POINTER 139 128 while (valid_stack_ptr(tinfo, (void *)ebp)) { 140 129 addr = *(unsigned long *)(ebp + 4); 141 - print_addr_and_symbol(addr, log_lvl); 130 + ops->address(data, addr); 142 131 /* 143 132 * break out of recursive entries (such as 144 133 * end_of_stack_stop_unwind_function): ··· 141 150 while (valid_stack_ptr(tinfo, stack)) { 142 151 addr = *stack++; 143 152 if (__kernel_text_address(addr)) 144 - print_addr_and_symbol(addr, log_lvl); 153 + ops->address(data, addr); 145 154 } 146 155 #endif 147 156 return ebp; 148 157 } 149 158 159 + struct ops_and_data { 160 + struct stacktrace_ops *ops; 161 + void *data; 162 + }; 163 + 150 164 static asmlinkage int 151 - show_trace_unwind(struct unwind_frame_info *info, void *log_lvl) 165 + dump_trace_unwind(struct unwind_frame_info *info, void *data) 152 166 { 167 + struct ops_and_data *oad = (struct ops_and_data *)data; 153 168 int n = 0; 154 169 155 170 while (unwind(info) == 0 && UNW_PC(info)) { 156 171 n++; 157 - print_addr_and_symbol(UNW_PC(info), log_lvl); 172 + oad->ops->address(oad->data, UNW_PC(info)); 158 173 if (arch_unw_user_mode(info)) 159 174 break; 160 175 } 161 176 return n; 162 177 } 163 178 164 - static void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, 165 - unsigned long *stack, char *log_lvl) 179 + void dump_trace(struct task_struct *task, struct pt_regs *regs, 180 + unsigned long *stack, 181 + struct stacktrace_ops *ops, void *data) 166 182 { 167 - unsigned long ebp; 183 + unsigned long ebp = 0; 168 184 169 185 if (!task) 170 186 task = current; ··· 179 181 if (call_trace >= 0) { 180 182 int unw_ret = 0; 181 183 struct unwind_frame_info info; 184 + struct ops_and_data oad = { .ops = ops, .data = data }; 182 185 183 186 if (regs) { 184 187 if (unwind_init_frame_info(&info, task, regs) == 0) 185 - unw_ret = show_trace_unwind(&info, log_lvl); 188 + unw_ret = dump_trace_unwind(&info, &oad); 186 189 } else if (task == current) 187 - unw_ret = unwind_init_running(&info, show_trace_unwind, log_lvl); 190 + unw_ret = unwind_init_running(&info, dump_trace_unwind, &oad); 188 191 else { 189 192 if (unwind_init_blocked(&info, task) == 0) 190 - unw_ret = show_trace_unwind(&info, log_lvl); 193 + unw_ret = dump_trace_unwind(&info, &oad); 191 194 } 192 195 if (unw_ret > 0) { 193 196 if (call_trace == 1 && !arch_unw_user_mode(&info)) { 194 - print_symbol("DWARF2 unwinder stuck at %s\n", 197 + ops->warning_symbol(data, "DWARF2 unwinder stuck at %s\n", 195 198 UNW_PC(&info)); 196 199 if (UNW_SP(&info) >= PAGE_OFFSET) { 197 - printk("Leftover inexact backtrace:\n"); 200 + ops->warning(data, "Leftover inexact backtrace:\n"); 198 201 stack = (void *)UNW_SP(&info); 202 + if (!stack) 203 + return; 204 + ebp = UNW_FP(&info); 199 205 } else 200 - printk("Full inexact backtrace again:\n"); 206 + ops->warning(data, "Full inexact backtrace again:\n"); 201 207 } else if (call_trace >= 1) 202 208 return; 203 209 else 204 - printk("Full inexact backtrace again:\n"); 210 + ops->warning(data, "Full inexact backtrace again:\n"); 205 211 } else 206 - printk("Inexact backtrace:\n"); 212 + ops->warning(data, "Inexact backtrace:\n"); 213 + } 214 + if (!stack) { 215 + unsigned long dummy; 216 + stack = &dummy; 217 + if (task && task != current) 218 + stack = (unsigned long *)task->thread.esp; 207 219 } 208 220 209 - if (task == current) { 210 - /* Grab ebp right from our regs */ 211 - asm ("movl %%ebp, %0" : "=r" (ebp) : ); 212 - } else { 213 - /* ebp is the last reg pushed by switch_to */ 214 - ebp = *(unsigned long *) task->thread.esp; 221 + #ifdef CONFIG_FRAME_POINTER 222 + if (!ebp) { 223 + if (task == current) { 224 + /* Grab ebp right from our regs */ 225 + asm ("movl %%ebp, %0" : "=r" (ebp) : ); 226 + } else { 227 + /* ebp is the last reg pushed by switch_to */ 228 + ebp = *(unsigned long *) task->thread.esp; 229 + } 215 230 } 231 + #endif 216 232 217 233 while (1) { 218 234 struct thread_info *context; 219 235 context = (struct thread_info *) 220 236 ((unsigned long)stack & (~(THREAD_SIZE - 1))); 221 - ebp = print_context_stack(context, stack, ebp, log_lvl); 237 + ebp = print_context_stack(context, stack, ebp, ops, data); 238 + /* Should be after the line below, but somewhere 239 + in early boot context comes out corrupted and we 240 + can't reference it -AK */ 241 + if (ops->stack(data, "IRQ") < 0) 242 + break; 222 243 stack = (unsigned long*)context->previous_esp; 223 244 if (!stack) 224 245 break; 225 - printk("%s =======================\n", log_lvl); 226 246 } 227 247 } 248 + EXPORT_SYMBOL(dump_trace); 228 249 229 - void show_trace(struct task_struct *task, struct pt_regs *regs, unsigned long * stack) 250 + static void 251 + print_trace_warning_symbol(void *data, char *msg, unsigned long symbol) 252 + { 253 + printk(data); 254 + print_symbol(msg, symbol); 255 + printk("\n"); 256 + } 257 + 258 + static void print_trace_warning(void *data, char *msg) 259 + { 260 + printk("%s%s\n", (char *)data, msg); 261 + } 262 + 263 + static int print_trace_stack(void *data, char *name) 264 + { 265 + return 0; 266 + } 267 + 268 + /* 269 + * Print one address/symbol entries per line. 270 + */ 271 + static void print_trace_address(void *data, unsigned long addr) 272 + { 273 + printk("%s [<%08lx>] ", (char *)data, addr); 274 + print_symbol("%s\n", addr); 275 + } 276 + 277 + static struct stacktrace_ops print_trace_ops = { 278 + .warning = print_trace_warning, 279 + .warning_symbol = print_trace_warning_symbol, 280 + .stack = print_trace_stack, 281 + .address = print_trace_address, 282 + }; 283 + 284 + static void 285 + show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, 286 + unsigned long * stack, char *log_lvl) 287 + { 288 + dump_trace(task, regs, stack, &print_trace_ops, log_lvl); 289 + printk("%s =======================\n", log_lvl); 290 + } 291 + 292 + void show_trace(struct task_struct *task, struct pt_regs *regs, 293 + unsigned long * stack) 230 294 { 231 295 show_trace_log_lvl(task, regs, stack, ""); 232 296 } ··· 351 291 ss = regs->xss & 0xffff; 352 292 } 353 293 print_modules(); 354 - printk(KERN_EMERG "CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\n" 355 - "EFLAGS: %08lx (%s %.*s) \n", 294 + printk(KERN_EMERG "CPU: %d\n" 295 + KERN_EMERG "EIP: %04x:[<%08lx>] %s VLI\n" 296 + KERN_EMERG "EFLAGS: %08lx (%s %.*s)\n", 356 297 smp_processor_id(), 0xffff & regs->xcs, regs->eip, 357 298 print_tainted(), regs->eflags, system_utsname.release, 358 299 (int)strcspn(system_utsname.version, " "), ··· 695 634 } 696 635 } 697 636 698 - static void mem_parity_error(unsigned char reason, struct pt_regs * regs) 637 + static __kprobes void 638 + mem_parity_error(unsigned char reason, struct pt_regs * regs) 699 639 { 700 - printk(KERN_EMERG "Uhhuh. NMI received. Dazed and confused, but trying " 701 - "to continue\n"); 640 + printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x on " 641 + "CPU %d.\n", reason, smp_processor_id()); 702 642 printk(KERN_EMERG "You probably have a hardware problem with your RAM " 703 643 "chips\n"); 644 + if (panic_on_unrecovered_nmi) 645 + panic("NMI: Not continuing"); 646 + 647 + printk(KERN_EMERG "Dazed and confused, but trying to continue\n"); 704 648 705 649 /* Clear and disable the memory parity error line. */ 706 650 clear_mem_error(reason); 707 651 } 708 652 709 - static void io_check_error(unsigned char reason, struct pt_regs * regs) 653 + static __kprobes void 654 + io_check_error(unsigned char reason, struct pt_regs * regs) 710 655 { 711 656 unsigned long i; 712 657 ··· 728 661 outb(reason, 0x61); 729 662 } 730 663 731 - static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs) 664 + static __kprobes void 665 + unknown_nmi_error(unsigned char reason, struct pt_regs * regs) 732 666 { 733 667 #ifdef CONFIG_MCA 734 668 /* Might actually be able to figure out what the guilty party ··· 739 671 return; 740 672 } 741 673 #endif 742 - printk("Uhhuh. NMI received for unknown reason %02x on CPU %d.\n", 743 - reason, smp_processor_id()); 744 - printk("Dazed and confused, but trying to continue\n"); 745 - printk("Do you have a strange power saving mode enabled?\n"); 674 + printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x on " 675 + "CPU %d.\n", reason, smp_processor_id()); 676 + printk(KERN_EMERG "Do you have a strange power saving mode enabled?\n"); 677 + if (panic_on_unrecovered_nmi) 678 + panic("NMI: Not continuing"); 679 + 680 + printk(KERN_EMERG "Dazed and confused, but trying to continue\n"); 746 681 } 747 682 748 683 static DEFINE_SPINLOCK(nmi_print_lock); 749 684 750 - void die_nmi (struct pt_regs *regs, const char *msg) 685 + void __kprobes die_nmi(struct pt_regs *regs, const char *msg) 751 686 { 752 687 if (notify_die(DIE_NMIWATCHDOG, msg, regs, 0, 2, SIGINT) == 753 688 NOTIFY_STOP) ··· 782 711 do_exit(SIGSEGV); 783 712 } 784 713 785 - static void default_do_nmi(struct pt_regs * regs) 714 + static __kprobes void default_do_nmi(struct pt_regs * regs) 786 715 { 787 716 unsigned char reason = 0; 788 717 ··· 799 728 * Ok, so this is none of the documented NMI sources, 800 729 * so it must be the NMI watchdog. 801 730 */ 802 - if (nmi_watchdog) { 803 - nmi_watchdog_tick(regs); 731 + if (nmi_watchdog_tick(regs, reason)) 804 732 return; 805 - } 733 + if (!do_nmi_callback(regs, smp_processor_id())) 806 734 #endif 807 - unknown_nmi_error(reason, regs); 735 + unknown_nmi_error(reason, regs); 736 + 808 737 return; 809 738 } 810 739 if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP) ··· 820 749 reassert_nmi(); 821 750 } 822 751 823 - static int dummy_nmi_callback(struct pt_regs * regs, int cpu) 824 - { 825 - return 0; 826 - } 827 - 828 - static nmi_callback_t nmi_callback = dummy_nmi_callback; 829 - 830 - fastcall void do_nmi(struct pt_regs * regs, long error_code) 752 + fastcall __kprobes void do_nmi(struct pt_regs * regs, long error_code) 831 753 { 832 754 int cpu; 833 755 ··· 830 766 831 767 ++nmi_count(cpu); 832 768 833 - if (!rcu_dereference(nmi_callback)(regs, cpu)) 834 - default_do_nmi(regs); 769 + default_do_nmi(regs); 835 770 836 771 nmi_exit(); 837 772 } 838 - 839 - void set_nmi_callback(nmi_callback_t callback) 840 - { 841 - vmalloc_sync_all(); 842 - rcu_assign_pointer(nmi_callback, callback); 843 - } 844 - EXPORT_SYMBOL_GPL(set_nmi_callback); 845 - 846 - void unset_nmi_callback(void) 847 - { 848 - nmi_callback = dummy_nmi_callback; 849 - } 850 - EXPORT_SYMBOL_GPL(unset_nmi_callback); 851 773 852 774 #ifdef CONFIG_KPROBES 853 775 fastcall void __kprobes do_int3(struct pt_regs *regs, long error_code) ··· 1174 1124 } 1175 1125 #endif 1176 1126 1177 - #define _set_gate(gate_addr,type,dpl,addr,seg) \ 1178 - do { \ 1179 - int __d0, __d1; \ 1180 - __asm__ __volatile__ ("movw %%dx,%%ax\n\t" \ 1181 - "movw %4,%%dx\n\t" \ 1182 - "movl %%eax,%0\n\t" \ 1183 - "movl %%edx,%1" \ 1184 - :"=m" (*((long *) (gate_addr))), \ 1185 - "=m" (*(1+(long *) (gate_addr))), "=&a" (__d0), "=&d" (__d1) \ 1186 - :"i" ((short) (0x8000+(dpl<<13)+(type<<8))), \ 1187 - "3" ((char *) (addr)),"2" ((seg) << 16)); \ 1188 - } while (0) 1189 - 1190 - 1191 1127 /* 1192 1128 * This needs to use 'idt_table' rather than 'idt', and 1193 1129 * thus use the _nonmapped_ version of the IDT, as the ··· 1182 1146 */ 1183 1147 void set_intr_gate(unsigned int n, void *addr) 1184 1148 { 1185 - _set_gate(idt_table+n,14,0,addr,__KERNEL_CS); 1149 + _set_gate(n, DESCTYPE_INT, addr, __KERNEL_CS); 1186 1150 } 1187 1151 1188 1152 /* ··· 1190 1154 */ 1191 1155 static inline void set_system_intr_gate(unsigned int n, void *addr) 1192 1156 { 1193 - _set_gate(idt_table+n, 14, 3, addr, __KERNEL_CS); 1157 + _set_gate(n, DESCTYPE_INT | DESCTYPE_DPL3, addr, __KERNEL_CS); 1194 1158 } 1195 1159 1196 1160 static void __init set_trap_gate(unsigned int n, void *addr) 1197 1161 { 1198 - _set_gate(idt_table+n,15,0,addr,__KERNEL_CS); 1162 + _set_gate(n, DESCTYPE_TRAP, addr, __KERNEL_CS); 1199 1163 } 1200 1164 1201 1165 static void __init set_system_gate(unsigned int n, void *addr) 1202 1166 { 1203 - _set_gate(idt_table+n,15,3,addr,__KERNEL_CS); 1167 + _set_gate(n, DESCTYPE_TRAP | DESCTYPE_DPL3, addr, __KERNEL_CS); 1204 1168 } 1205 1169 1206 1170 static void __init set_task_gate(unsigned int n, unsigned int gdt_entry) 1207 1171 { 1208 - _set_gate(idt_table+n,5,0,0,(gdt_entry<<3)); 1172 + _set_gate(n, DESCTYPE_TASK, (void *)0, (gdt_entry<<3)); 1209 1173 } 1210 1174 1211 1175
+1 -1
arch/i386/kernel/tsc.c
··· 192 192 193 193 EXPORT_SYMBOL(recalibrate_cpu_khz); 194 194 195 - void tsc_init(void) 195 + void __init tsc_init(void) 196 196 { 197 197 if (!cpu_has_tsc || tsc_disable) 198 198 return;
+1 -1
arch/i386/lib/Makefile
··· 4 4 5 5 6 6 lib-y = checksum.o delay.o usercopy.o getuser.o putuser.o memcpy.o strstr.o \ 7 - bitops.o 7 + bitops.o semaphore.o 8 8 9 9 lib-$(CONFIG_X86_USE_3DNOW) += mmx.o
+217
arch/i386/lib/semaphore.S
··· 1 + /* 2 + * i386 semaphore implementation. 3 + * 4 + * (C) Copyright 1999 Linus Torvalds 5 + * 6 + * Portions Copyright 1999 Red Hat, Inc. 7 + * 8 + * This program is free software; you can redistribute it and/or 9 + * modify it under the terms of the GNU General Public License 10 + * as published by the Free Software Foundation; either version 11 + * 2 of the License, or (at your option) any later version. 12 + * 13 + * rw semaphores implemented November 1999 by Benjamin LaHaise <bcrl@kvack.org> 14 + */ 15 + 16 + #include <linux/config.h> 17 + #include <linux/linkage.h> 18 + #include <asm/rwlock.h> 19 + #include <asm/alternative-asm.i> 20 + #include <asm/frame.i> 21 + #include <asm/dwarf2.h> 22 + 23 + /* 24 + * The semaphore operations have a special calling sequence that 25 + * allow us to do a simpler in-line version of them. These routines 26 + * need to convert that sequence back into the C sequence when 27 + * there is contention on the semaphore. 28 + * 29 + * %eax contains the semaphore pointer on entry. Save the C-clobbered 30 + * registers (%eax, %edx and %ecx) except %eax whish is either a return 31 + * value or just clobbered.. 32 + */ 33 + .section .sched.text 34 + ENTRY(__down_failed) 35 + CFI_STARTPROC 36 + FRAME 37 + pushl %edx 38 + CFI_ADJUST_CFA_OFFSET 4 39 + CFI_REL_OFFSET edx,0 40 + pushl %ecx 41 + CFI_ADJUST_CFA_OFFSET 4 42 + CFI_REL_OFFSET ecx,0 43 + call __down 44 + popl %ecx 45 + CFI_ADJUST_CFA_OFFSET -4 46 + CFI_RESTORE ecx 47 + popl %edx 48 + CFI_ADJUST_CFA_OFFSET -4 49 + CFI_RESTORE edx 50 + ENDFRAME 51 + ret 52 + CFI_ENDPROC 53 + END(__down_failed) 54 + 55 + ENTRY(__down_failed_interruptible) 56 + CFI_STARTPROC 57 + FRAME 58 + pushl %edx 59 + CFI_ADJUST_CFA_OFFSET 4 60 + CFI_REL_OFFSET edx,0 61 + pushl %ecx 62 + CFI_ADJUST_CFA_OFFSET 4 63 + CFI_REL_OFFSET ecx,0 64 + call __down_interruptible 65 + popl %ecx 66 + CFI_ADJUST_CFA_OFFSET -4 67 + CFI_RESTORE ecx 68 + popl %edx 69 + CFI_ADJUST_CFA_OFFSET -4 70 + CFI_RESTORE edx 71 + ENDFRAME 72 + ret 73 + CFI_ENDPROC 74 + END(__down_failed_interruptible) 75 + 76 + ENTRY(__down_failed_trylock) 77 + CFI_STARTPROC 78 + FRAME 79 + pushl %edx 80 + CFI_ADJUST_CFA_OFFSET 4 81 + CFI_REL_OFFSET edx,0 82 + pushl %ecx 83 + CFI_ADJUST_CFA_OFFSET 4 84 + CFI_REL_OFFSET ecx,0 85 + call __down_trylock 86 + popl %ecx 87 + CFI_ADJUST_CFA_OFFSET -4 88 + CFI_RESTORE ecx 89 + popl %edx 90 + CFI_ADJUST_CFA_OFFSET -4 91 + CFI_RESTORE edx 92 + ENDFRAME 93 + ret 94 + CFI_ENDPROC 95 + END(__down_failed_trylock) 96 + 97 + ENTRY(__up_wakeup) 98 + CFI_STARTPROC 99 + FRAME 100 + pushl %edx 101 + CFI_ADJUST_CFA_OFFSET 4 102 + CFI_REL_OFFSET edx,0 103 + pushl %ecx 104 + CFI_ADJUST_CFA_OFFSET 4 105 + CFI_REL_OFFSET ecx,0 106 + call __up 107 + popl %ecx 108 + CFI_ADJUST_CFA_OFFSET -4 109 + CFI_RESTORE ecx 110 + popl %edx 111 + CFI_ADJUST_CFA_OFFSET -4 112 + CFI_RESTORE edx 113 + ENDFRAME 114 + ret 115 + CFI_ENDPROC 116 + END(__up_wakeup) 117 + 118 + /* 119 + * rw spinlock fallbacks 120 + */ 121 + #ifdef CONFIG_SMP 122 + ENTRY(__write_lock_failed) 123 + CFI_STARTPROC simple 124 + FRAME 125 + 2: LOCK_PREFIX 126 + addl $ RW_LOCK_BIAS,(%eax) 127 + 1: rep; nop 128 + cmpl $ RW_LOCK_BIAS,(%eax) 129 + jne 1b 130 + LOCK_PREFIX 131 + subl $ RW_LOCK_BIAS,(%eax) 132 + jnz 2b 133 + ENDFRAME 134 + ret 135 + CFI_ENDPROC 136 + END(__write_lock_failed) 137 + 138 + ENTRY(__read_lock_failed) 139 + CFI_STARTPROC 140 + FRAME 141 + 2: LOCK_PREFIX 142 + incl (%eax) 143 + 1: rep; nop 144 + cmpl $1,(%eax) 145 + js 1b 146 + LOCK_PREFIX 147 + decl (%eax) 148 + js 2b 149 + ENDFRAME 150 + ret 151 + CFI_ENDPROC 152 + END(__read_lock_failed) 153 + 154 + #endif 155 + 156 + /* Fix up special calling conventions */ 157 + ENTRY(call_rwsem_down_read_failed) 158 + CFI_STARTPROC 159 + push %ecx 160 + CFI_ADJUST_CFA_OFFSET 4 161 + CFI_REL_OFFSET ecx,0 162 + push %edx 163 + CFI_ADJUST_CFA_OFFSET 4 164 + CFI_REL_OFFSET edx,0 165 + call rwsem_down_read_failed 166 + pop %edx 167 + CFI_ADJUST_CFA_OFFSET -4 168 + pop %ecx 169 + CFI_ADJUST_CFA_OFFSET -4 170 + ret 171 + CFI_ENDPROC 172 + END(call_rwsem_down_read_failed) 173 + 174 + ENTRY(call_rwsem_down_write_failed) 175 + CFI_STARTPROC 176 + push %ecx 177 + CFI_ADJUST_CFA_OFFSET 4 178 + CFI_REL_OFFSET ecx,0 179 + calll rwsem_down_write_failed 180 + pop %ecx 181 + CFI_ADJUST_CFA_OFFSET -4 182 + ret 183 + CFI_ENDPROC 184 + END(call_rwsem_down_write_failed) 185 + 186 + ENTRY(call_rwsem_wake) 187 + CFI_STARTPROC 188 + decw %dx /* do nothing if still outstanding active readers */ 189 + jnz 1f 190 + push %ecx 191 + CFI_ADJUST_CFA_OFFSET 4 192 + CFI_REL_OFFSET ecx,0 193 + call rwsem_wake 194 + pop %ecx 195 + CFI_ADJUST_CFA_OFFSET -4 196 + 1: ret 197 + CFI_ENDPROC 198 + END(call_rwsem_wake) 199 + 200 + /* Fix up special calling conventions */ 201 + ENTRY(call_rwsem_downgrade_wake) 202 + CFI_STARTPROC 203 + push %ecx 204 + CFI_ADJUST_CFA_OFFSET 4 205 + CFI_REL_OFFSET ecx,0 206 + push %edx 207 + CFI_ADJUST_CFA_OFFSET 4 208 + CFI_REL_OFFSET edx,0 209 + call rwsem_downgrade_wake 210 + pop %edx 211 + CFI_ADJUST_CFA_OFFSET -4 212 + pop %ecx 213 + CFI_ADJUST_CFA_OFFSET -4 214 + ret 215 + CFI_ENDPROC 216 + END(call_rwsem_downgrade_wake) 217 +
+1
arch/i386/mach-generic/bigsmp.c
··· 5 5 #define APIC_DEFINITION 1 6 6 #include <linux/threads.h> 7 7 #include <linux/cpumask.h> 8 + #include <asm/smp.h> 8 9 #include <asm/mpspec.h> 9 10 #include <asm/genapic.h> 10 11 #include <asm/fixmap.h>
+1
arch/i386/mach-generic/es7000.c
··· 4 4 #define APIC_DEFINITION 1 5 5 #include <linux/threads.h> 6 6 #include <linux/cpumask.h> 7 + #include <asm/smp.h> 7 8 #include <asm/mpspec.h> 8 9 #include <asm/genapic.h> 9 10 #include <asm/fixmap.h>
+30 -30
arch/i386/mach-generic/probe.c
··· 9 9 #include <linux/kernel.h> 10 10 #include <linux/ctype.h> 11 11 #include <linux/init.h> 12 + #include <linux/errno.h> 12 13 #include <asm/fixmap.h> 13 14 #include <asm/mpspec.h> 14 15 #include <asm/apicdef.h> ··· 30 29 NULL, 31 30 }; 32 31 33 - static int cmdline_apic; 32 + static int cmdline_apic __initdata; 33 + static int __init parse_apic(char *arg) 34 + { 35 + int i; 36 + 37 + if (!arg) 38 + return -EINVAL; 39 + 40 + for (i = 0; apic_probe[i]; i++) { 41 + if (!strcmp(apic_probe[i]->name, arg)) { 42 + genapic = apic_probe[i]; 43 + cmdline_apic = 1; 44 + return 0; 45 + } 46 + } 47 + return -ENOENT; 48 + } 49 + early_param("apic", parse_apic); 34 50 35 51 void __init generic_bigsmp_probe(void) 36 52 { ··· 66 48 } 67 49 } 68 50 69 - void __init generic_apic_probe(char *command_line) 51 + void __init generic_apic_probe(void) 70 52 { 71 - char *s; 72 - int i; 73 - int changed = 0; 74 - 75 - s = strstr(command_line, "apic="); 76 - if (s && (s == command_line || isspace(s[-1]))) { 77 - char *p = strchr(s, ' '), old; 78 - if (!p) 79 - p = strchr(s, '\0'); 80 - old = *p; 81 - *p = 0; 82 - for (i = 0; !changed && apic_probe[i]; i++) { 83 - if (!strcmp(apic_probe[i]->name, s+5)) { 84 - changed = 1; 53 + if (!cmdline_apic) { 54 + int i; 55 + for (i = 0; apic_probe[i]; i++) { 56 + if (apic_probe[i]->probe()) { 85 57 genapic = apic_probe[i]; 58 + break; 86 59 } 87 60 } 88 - if (!changed) 89 - printk(KERN_ERR "Unknown genapic `%s' specified.\n", s); 90 - *p = old; 91 - cmdline_apic = changed; 92 - } 93 - for (i = 0; !changed && apic_probe[i]; i++) { 94 - if (apic_probe[i]->probe()) { 95 - changed = 1; 96 - genapic = apic_probe[i]; 97 - } 61 + /* Not visible without early console */ 62 + if (!apic_probe[i]) 63 + panic("Didn't find an APIC driver"); 98 64 } 99 - /* Not visible without early console */ 100 - if (!changed) 101 - panic("Didn't find an APIC driver"); 102 - 103 65 printk(KERN_INFO "Using APIC driver %s\n", genapic->name); 104 66 } 105 67 ··· 117 119 return 0; 118 120 } 119 121 122 + #ifdef CONFIG_SMP 120 123 int hard_smp_processor_id(void) 121 124 { 122 125 return genapic->get_apic_id(*(unsigned long *)(APIC_BASE+APIC_ID)); 123 126 } 127 + #endif
+1
arch/i386/mach-generic/summit.c
··· 4 4 #define APIC_DEFINITION 1 5 5 #include <linux/threads.h> 6 6 #include <linux/cpumask.h> 7 + #include <asm/smp.h> 7 8 #include <asm/mpspec.h> 8 9 #include <asm/genapic.h> 9 10 #include <asm/fixmap.h>
+5
arch/i386/mm/discontig.c
··· 322 322 highstart_pfn = system_max_low_pfn; 323 323 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", 324 324 pages_to_mb(highend_pfn - highstart_pfn)); 325 + num_physpages = highend_pfn; 326 + high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; 327 + #else 328 + num_physpages = system_max_low_pfn; 329 + high_memory = (void *) __va(system_max_low_pfn * PAGE_SIZE - 1) + 1; 325 330 #endif 326 331 printk(KERN_NOTICE "%ldMB LOWMEM available.\n", 327 332 pages_to_mb(system_max_low_pfn));
+1 -1
arch/i386/mm/extable.c
··· 11 11 const struct exception_table_entry *fixup; 12 12 13 13 #ifdef CONFIG_PNPBIOS 14 - if (unlikely((regs->xcs & ~15) == (GDT_ENTRY_PNPBIOS_BASE << 3))) 14 + if (unlikely(SEGMENT_IS_PNP_CODE(regs->xcs))) 15 15 { 16 16 extern u32 pnp_bios_fault_eip, pnp_bios_fault_esp; 17 17 extern u32 pnp_bios_is_utter_crap;
+8 -17
arch/i386/mm/fault.c
··· 27 27 #include <asm/uaccess.h> 28 28 #include <asm/desc.h> 29 29 #include <asm/kdebug.h> 30 + #include <asm/segment.h> 30 31 31 32 extern void die(const char *,struct pt_regs *,long); 32 33 33 - #ifdef CONFIG_KPROBES 34 - ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); 34 + static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); 35 + 35 36 int register_page_fault_notifier(struct notifier_block *nb) 36 37 { 37 38 vmalloc_sync_all(); 38 39 return atomic_notifier_chain_register(&notify_page_fault_chain, nb); 39 40 } 41 + EXPORT_SYMBOL_GPL(register_page_fault_notifier); 40 42 41 43 int unregister_page_fault_notifier(struct notifier_block *nb) 42 44 { 43 45 return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb); 44 46 } 47 + EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); 45 48 46 49 static inline int notify_page_fault(enum die_val val, const char *str, 47 50 struct pt_regs *regs, long err, int trap, int sig) ··· 58 55 }; 59 56 return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args); 60 57 } 61 - #else 62 - static inline int notify_page_fault(enum die_val val, const char *str, 63 - struct pt_regs *regs, long err, int trap, int sig) 64 - { 65 - return NOTIFY_DONE; 66 - } 67 - #endif 68 - 69 58 70 59 /* 71 60 * Unlock any spinlocks which will prevent us from getting the ··· 114 119 } 115 120 116 121 /* The standard kernel/user address space limit. */ 117 - *eip_limit = (seg & 3) ? USER_DS.seg : KERNEL_DS.seg; 122 + *eip_limit = user_mode(regs) ? USER_DS.seg : KERNEL_DS.seg; 118 123 119 124 /* By far the most common cases. */ 120 - if (likely(seg == __USER_CS || seg == __KERNEL_CS)) 125 + if (likely(SEGMENT_IS_FLAT_CODE(seg))) 121 126 return eip; 122 127 123 128 /* Check the segment exists, is within the current LDT/GDT size, ··· 431 436 write = 0; 432 437 switch (error_code & 3) { 433 438 default: /* 3: write, present */ 434 - #ifdef TEST_VERIFY_AREA 435 - if (regs->cs == KERNEL_CS) 436 - printk("WP fault at %08lx\n", regs->eip); 437 - #endif 438 - /* fall through */ 439 + /* fall through */ 439 440 case 2: /* write, not present */ 440 441 if (!(vma->vm_flags & VM_WRITE)) 441 442 goto bad_area;
+1 -1
arch/i386/mm/highmem.c
··· 54 54 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; 55 55 enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id(); 56 56 57 - if (vaddr < FIXADDR_START) { // FIXME 57 + if (vaddr >= PAGE_OFFSET && vaddr < (unsigned long)high_memory) { 58 58 dec_preempt_count(); 59 59 preempt_check_resched(); 60 60 return;
+12 -26
arch/i386/mm/init.c
··· 435 435 * on Enable 436 436 * off Disable 437 437 */ 438 - void __init noexec_setup(const char *str) 438 + static int __init noexec_setup(char *str) 439 439 { 440 - if (!strncmp(str, "on",2) && cpu_has_nx) { 441 - __supported_pte_mask |= _PAGE_NX; 442 - disable_nx = 0; 443 - } else if (!strncmp(str,"off",3)) { 440 + if (!str || !strcmp(str, "on")) { 441 + if (cpu_has_nx) { 442 + __supported_pte_mask |= _PAGE_NX; 443 + disable_nx = 0; 444 + } 445 + } else if (!strcmp(str,"off")) { 444 446 disable_nx = 1; 445 447 __supported_pte_mask &= ~_PAGE_NX; 446 - } 448 + } else 449 + return -EINVAL; 450 + 451 + return 0; 447 452 } 453 + early_param("noexec", noexec_setup); 448 454 449 455 int nx_enabled = 0; 450 456 #ifdef CONFIG_X86_PAE ··· 558 552 } 559 553 } 560 554 561 - static void __init set_max_mapnr_init(void) 562 - { 563 - #ifdef CONFIG_HIGHMEM 564 - num_physpages = highend_pfn; 565 - #else 566 - num_physpages = max_low_pfn; 567 - #endif 568 - #ifdef CONFIG_FLATMEM 569 - max_mapnr = num_physpages; 570 - #endif 571 - } 572 - 573 555 static struct kcore_list kcore_mem, kcore_vmalloc; 574 556 575 557 void __init mem_init(void) ··· 584 590 } 585 591 #endif 586 592 587 - set_max_mapnr_init(); 588 - 589 - #ifdef CONFIG_HIGHMEM 590 - high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; 591 - #else 592 - high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; 593 - #endif 594 - 595 593 /* this will put all low memory onto the freelists */ 596 594 totalram_pages += free_all_bootmem(); 597 595
+59 -29
arch/i386/oprofile/nmi_int.c
··· 17 17 #include <asm/nmi.h> 18 18 #include <asm/msr.h> 19 19 #include <asm/apic.h> 20 + #include <asm/kdebug.h> 20 21 21 22 #include "op_counter.h" 22 23 #include "op_x86_model.h" 23 - 24 + 24 25 static struct op_x86_model_spec const * model; 25 26 static struct op_msrs cpu_msrs[NR_CPUS]; 26 27 static unsigned long saved_lvtpc[NR_CPUS]; 27 - 28 + 28 29 static int nmi_start(void); 29 30 static void nmi_stop(void); 30 31 ··· 83 82 #define exit_driverfs() do { } while (0) 84 83 #endif /* CONFIG_PM */ 85 84 86 - 87 - static int nmi_callback(struct pt_regs * regs, int cpu) 85 + static int profile_exceptions_notify(struct notifier_block *self, 86 + unsigned long val, void *data) 88 87 { 89 - return model->check_ctrs(regs, &cpu_msrs[cpu]); 88 + struct die_args *args = (struct die_args *)data; 89 + int ret = NOTIFY_DONE; 90 + int cpu = smp_processor_id(); 91 + 92 + switch(val) { 93 + case DIE_NMI: 94 + if (model->check_ctrs(args->regs, &cpu_msrs[cpu])) 95 + ret = NOTIFY_STOP; 96 + break; 97 + default: 98 + break; 99 + } 100 + return ret; 90 101 } 91 - 92 - 102 + 93 103 static void nmi_cpu_save_registers(struct op_msrs * msrs) 94 104 { 95 105 unsigned int const nr_ctrs = model->num_counters; ··· 110 98 unsigned int i; 111 99 112 100 for (i = 0; i < nr_ctrs; ++i) { 113 - rdmsr(counters[i].addr, 114 - counters[i].saved.low, 115 - counters[i].saved.high); 101 + if (counters[i].addr){ 102 + rdmsr(counters[i].addr, 103 + counters[i].saved.low, 104 + counters[i].saved.high); 105 + } 116 106 } 117 107 118 108 for (i = 0; i < nr_ctrls; ++i) { 119 - rdmsr(controls[i].addr, 120 - controls[i].saved.low, 121 - controls[i].saved.high); 109 + if (controls[i].addr){ 110 + rdmsr(controls[i].addr, 111 + controls[i].saved.low, 112 + controls[i].saved.high); 113 + } 122 114 } 123 115 } 124 116 ··· 186 170 apic_write(APIC_LVTPC, APIC_DM_NMI); 187 171 } 188 172 173 + static struct notifier_block profile_exceptions_nb = { 174 + .notifier_call = profile_exceptions_notify, 175 + .next = NULL, 176 + .priority = 0 177 + }; 189 178 190 179 static int nmi_setup(void) 191 180 { 181 + int err=0; 182 + 192 183 if (!allocate_msrs()) 193 184 return -ENOMEM; 194 185 195 - /* We walk a thin line between law and rape here. 196 - * We need to be careful to install our NMI handler 197 - * without actually triggering any NMIs as this will 198 - * break the core code horrifically. 199 - */ 200 - if (reserve_lapic_nmi() < 0) { 186 + if ((err = register_die_notifier(&profile_exceptions_nb))){ 201 187 free_msrs(); 202 - return -EBUSY; 188 + return err; 203 189 } 190 + 204 191 /* We need to serialize save and setup for HT because the subset 205 192 * of msrs are distinct for save and setup operations 206 193 */ 207 194 on_each_cpu(nmi_save_registers, NULL, 0, 1); 208 195 on_each_cpu(nmi_cpu_setup, NULL, 0, 1); 209 - set_nmi_callback(nmi_callback); 210 196 nmi_enabled = 1; 211 197 return 0; 212 198 } ··· 223 205 unsigned int i; 224 206 225 207 for (i = 0; i < nr_ctrls; ++i) { 226 - wrmsr(controls[i].addr, 227 - controls[i].saved.low, 228 - controls[i].saved.high); 208 + if (controls[i].addr){ 209 + wrmsr(controls[i].addr, 210 + controls[i].saved.low, 211 + controls[i].saved.high); 212 + } 229 213 } 230 214 231 215 for (i = 0; i < nr_ctrs; ++i) { 232 - wrmsr(counters[i].addr, 233 - counters[i].saved.low, 234 - counters[i].saved.high); 216 + if (counters[i].addr){ 217 + wrmsr(counters[i].addr, 218 + counters[i].saved.low, 219 + counters[i].saved.high); 220 + } 235 221 } 236 222 } 237 223 ··· 256 234 apic_write(APIC_LVTPC, saved_lvtpc[cpu]); 257 235 apic_write(APIC_LVTERR, v); 258 236 nmi_restore_registers(msrs); 237 + model->shutdown(msrs); 259 238 } 260 239 261 240 ··· 264 241 { 265 242 nmi_enabled = 0; 266 243 on_each_cpu(nmi_cpu_shutdown, NULL, 0, 1); 267 - unset_nmi_callback(); 268 - release_lapic_nmi(); 244 + unregister_die_notifier(&profile_exceptions_nb); 269 245 free_msrs(); 270 246 } 271 247 ··· 306 284 struct dentry * dir; 307 285 char buf[4]; 308 286 287 + /* quick little hack to _not_ expose a counter if it is not 288 + * available for use. This should protect userspace app. 289 + * NOTE: assumes 1:1 mapping here (that counters are organized 290 + * sequentially in their struct assignment). 291 + */ 292 + if (unlikely(!avail_to_resrv_perfctr_nmi_bit(i))) 293 + continue; 294 + 309 295 snprintf(buf, sizeof(buf), "%d", i); 310 296 dir = oprofilefs_mkdir(sb, root, buf); 311 297 oprofilefs_create_ulong(sb, dir, "enabled", &counter_config[i].enabled);
+25 -10
arch/i386/oprofile/nmi_timer_int.c
··· 17 17 #include <asm/nmi.h> 18 18 #include <asm/apic.h> 19 19 #include <asm/ptrace.h> 20 + #include <asm/kdebug.h> 20 21 21 - static int nmi_timer_callback(struct pt_regs * regs, int cpu) 22 + static int profile_timer_exceptions_notify(struct notifier_block *self, 23 + unsigned long val, void *data) 22 24 { 23 - oprofile_add_sample(regs, 0); 24 - return 1; 25 + struct die_args *args = (struct die_args *)data; 26 + int ret = NOTIFY_DONE; 27 + 28 + switch(val) { 29 + case DIE_NMI: 30 + oprofile_add_sample(args->regs, 0); 31 + ret = NOTIFY_STOP; 32 + break; 33 + default: 34 + break; 35 + } 36 + return ret; 25 37 } 38 + 39 + static struct notifier_block profile_timer_exceptions_nb = { 40 + .notifier_call = profile_timer_exceptions_notify, 41 + .next = NULL, 42 + .priority = 0 43 + }; 26 44 27 45 static int timer_start(void) 28 46 { 29 - disable_timer_nmi_watchdog(); 30 - set_nmi_callback(nmi_timer_callback); 47 + if (register_die_notifier(&profile_timer_exceptions_nb)) 48 + return 1; 31 49 return 0; 32 50 } 33 51 34 52 35 53 static void timer_stop(void) 36 54 { 37 - enable_timer_nmi_watchdog(); 38 - unset_nmi_callback(); 55 + unregister_die_notifier(&profile_timer_exceptions_nb); 39 56 synchronize_sched(); /* Allow already-started NMIs to complete. */ 40 57 } 41 58 42 59 43 60 int __init op_nmi_timer_init(struct oprofile_operations * ops) 44 61 { 45 - extern int nmi_active; 46 - 47 - if (nmi_active <= 0) 62 + if ((nmi_watchdog != NMI_IO_APIC) || (atomic_read(&nmi_active) <= 0)) 48 63 return -ENODEV; 49 64 50 65 ops->start = timer_start;
+41 -11
arch/i386/oprofile/op_model_athlon.c
··· 21 21 #define NUM_COUNTERS 4 22 22 #define NUM_CONTROLS 4 23 23 24 + #define CTR_IS_RESERVED(msrs,c) (msrs->counters[(c)].addr ? 1 : 0) 24 25 #define CTR_READ(l,h,msrs,c) do {rdmsr(msrs->counters[(c)].addr, (l), (h));} while (0) 25 26 #define CTR_WRITE(l,msrs,c) do {wrmsr(msrs->counters[(c)].addr, -(unsigned int)(l), -1);} while (0) 26 27 #define CTR_OVERFLOWED(n) (!((n) & (1U<<31))) 27 28 29 + #define CTRL_IS_RESERVED(msrs,c) (msrs->controls[(c)].addr ? 1 : 0) 28 30 #define CTRL_READ(l,h,msrs,c) do {rdmsr(msrs->controls[(c)].addr, (l), (h));} while (0) 29 31 #define CTRL_WRITE(l,h,msrs,c) do {wrmsr(msrs->controls[(c)].addr, (l), (h));} while (0) 30 32 #define CTRL_SET_ACTIVE(n) (n |= (1<<22)) ··· 42 40 43 41 static void athlon_fill_in_addresses(struct op_msrs * const msrs) 44 42 { 45 - msrs->counters[0].addr = MSR_K7_PERFCTR0; 46 - msrs->counters[1].addr = MSR_K7_PERFCTR1; 47 - msrs->counters[2].addr = MSR_K7_PERFCTR2; 48 - msrs->counters[3].addr = MSR_K7_PERFCTR3; 43 + int i; 49 44 50 - msrs->controls[0].addr = MSR_K7_EVNTSEL0; 51 - msrs->controls[1].addr = MSR_K7_EVNTSEL1; 52 - msrs->controls[2].addr = MSR_K7_EVNTSEL2; 53 - msrs->controls[3].addr = MSR_K7_EVNTSEL3; 45 + for (i=0; i < NUM_COUNTERS; i++) { 46 + if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i)) 47 + msrs->counters[i].addr = MSR_K7_PERFCTR0 + i; 48 + else 49 + msrs->counters[i].addr = 0; 50 + } 51 + 52 + for (i=0; i < NUM_CONTROLS; i++) { 53 + if (reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i)) 54 + msrs->controls[i].addr = MSR_K7_EVNTSEL0 + i; 55 + else 56 + msrs->controls[i].addr = 0; 57 + } 54 58 } 55 59 56 60 ··· 67 59 68 60 /* clear all counters */ 69 61 for (i = 0 ; i < NUM_CONTROLS; ++i) { 62 + if (unlikely(!CTRL_IS_RESERVED(msrs,i))) 63 + continue; 70 64 CTRL_READ(low, high, msrs, i); 71 65 CTRL_CLEAR(low); 72 66 CTRL_WRITE(low, high, msrs, i); 73 67 } 74 - 68 + 75 69 /* avoid a false detection of ctr overflows in NMI handler */ 76 70 for (i = 0; i < NUM_COUNTERS; ++i) { 71 + if (unlikely(!CTR_IS_RESERVED(msrs,i))) 72 + continue; 77 73 CTR_WRITE(1, msrs, i); 78 74 } 79 75 80 76 /* enable active counters */ 81 77 for (i = 0; i < NUM_COUNTERS; ++i) { 82 - if (counter_config[i].enabled) { 78 + if ((counter_config[i].enabled) && (CTR_IS_RESERVED(msrs,i))) { 83 79 reset_value[i] = counter_config[i].count; 84 80 85 81 CTR_WRITE(counter_config[i].count, msrs, i); ··· 110 98 int i; 111 99 112 100 for (i = 0 ; i < NUM_COUNTERS; ++i) { 101 + if (!reset_value[i]) 102 + continue; 113 103 CTR_READ(low, high, msrs, i); 114 104 if (CTR_OVERFLOWED(low)) { 115 105 oprofile_add_sample(regs, i); ··· 146 132 /* Subtle: stop on all counters to avoid race with 147 133 * setting our pm callback */ 148 134 for (i = 0 ; i < NUM_COUNTERS ; ++i) { 135 + if (!reset_value[i]) 136 + continue; 149 137 CTRL_READ(low, high, msrs, i); 150 138 CTRL_SET_INACTIVE(low); 151 139 CTRL_WRITE(low, high, msrs, i); 152 140 } 153 141 } 154 142 143 + static void athlon_shutdown(struct op_msrs const * const msrs) 144 + { 145 + int i; 146 + 147 + for (i = 0 ; i < NUM_COUNTERS ; ++i) { 148 + if (CTR_IS_RESERVED(msrs,i)) 149 + release_perfctr_nmi(MSR_K7_PERFCTR0 + i); 150 + } 151 + for (i = 0 ; i < NUM_CONTROLS ; ++i) { 152 + if (CTRL_IS_RESERVED(msrs,i)) 153 + release_evntsel_nmi(MSR_K7_EVNTSEL0 + i); 154 + } 155 + } 155 156 156 157 struct op_x86_model_spec const op_athlon_spec = { 157 158 .num_counters = NUM_COUNTERS, ··· 175 146 .setup_ctrs = &athlon_setup_ctrs, 176 147 .check_ctrs = &athlon_check_ctrs, 177 148 .start = &athlon_start, 178 - .stop = &athlon_stop 149 + .stop = &athlon_stop, 150 + .shutdown = &athlon_shutdown 179 151 };
+74 -78
arch/i386/oprofile/op_model_p4.c
··· 32 32 #define NUM_CONTROLS_HT2 (NUM_ESCRS_HT2 + NUM_CCCRS_HT2) 33 33 34 34 static unsigned int num_counters = NUM_COUNTERS_NON_HT; 35 - 35 + static unsigned int num_controls = NUM_CONTROLS_NON_HT; 36 36 37 37 /* this has to be checked dynamically since the 38 38 hyper-threadedness of a chip is discovered at ··· 40 40 static inline void setup_num_counters(void) 41 41 { 42 42 #ifdef CONFIG_SMP 43 - if (smp_num_siblings == 2) 43 + if (smp_num_siblings == 2){ 44 44 num_counters = NUM_COUNTERS_HT2; 45 + num_controls = NUM_CONTROLS_HT2; 46 + } 45 47 #endif 46 48 } 47 49 ··· 98 96 }; 99 97 100 98 #define NUM_UNUSED_CCCRS NUM_CCCRS_NON_HT - NUM_COUNTERS_NON_HT 101 - 102 - /* All cccr we don't use. */ 103 - static int p4_unused_cccr[NUM_UNUSED_CCCRS] = { 104 - MSR_P4_BPU_CCCR1, MSR_P4_BPU_CCCR3, 105 - MSR_P4_MS_CCCR1, MSR_P4_MS_CCCR3, 106 - MSR_P4_FLAME_CCCR1, MSR_P4_FLAME_CCCR3, 107 - MSR_P4_IQ_CCCR0, MSR_P4_IQ_CCCR1, 108 - MSR_P4_IQ_CCCR2, MSR_P4_IQ_CCCR3 109 - }; 110 99 111 100 /* p4 event codes in libop/op_event.h are indices into this table. */ 112 101 ··· 365 372 #define CCCR_OVF_P(cccr) ((cccr) & (1U<<31)) 366 373 #define CCCR_CLEAR_OVF(cccr) ((cccr) &= (~(1U<<31))) 367 374 375 + #define CTRL_IS_RESERVED(msrs,c) (msrs->controls[(c)].addr ? 1 : 0) 376 + #define CTR_IS_RESERVED(msrs,c) (msrs->counters[(c)].addr ? 1 : 0) 368 377 #define CTR_READ(l,h,i) do {rdmsr(p4_counters[(i)].counter_address, (l), (h));} while (0) 369 378 #define CTR_WRITE(l,i) do {wrmsr(p4_counters[(i)].counter_address, -(u32)(l), -1);} while (0) 370 379 #define CTR_OVERFLOW_P(ctr) (!((ctr) & 0x80000000)) ··· 396 401 static void p4_fill_in_addresses(struct op_msrs * const msrs) 397 402 { 398 403 unsigned int i; 399 - unsigned int addr, stag; 404 + unsigned int addr, cccraddr, stag; 400 405 401 406 setup_num_counters(); 402 407 stag = get_stagger(); 403 408 404 - /* the counter registers we pay attention to */ 409 + /* initialize some registers */ 405 410 for (i = 0; i < num_counters; ++i) { 406 - msrs->counters[i].addr = 407 - p4_counters[VIRT_CTR(stag, i)].counter_address; 411 + msrs->counters[i].addr = 0; 408 412 } 409 - 410 - /* FIXME: bad feeling, we don't save the 10 counters we don't use. */ 411 - 412 - /* 18 CCCR registers */ 413 - for (i = 0, addr = MSR_P4_BPU_CCCR0 + stag; 414 - addr <= MSR_P4_IQ_CCCR5; ++i, addr += addr_increment()) { 415 - msrs->controls[i].addr = addr; 413 + for (i = 0; i < num_controls; ++i) { 414 + msrs->controls[i].addr = 0; 416 415 } 417 416 417 + /* the counter & cccr registers we pay attention to */ 418 + for (i = 0; i < num_counters; ++i) { 419 + addr = p4_counters[VIRT_CTR(stag, i)].counter_address; 420 + cccraddr = p4_counters[VIRT_CTR(stag, i)].cccr_address; 421 + if (reserve_perfctr_nmi(addr)){ 422 + msrs->counters[i].addr = addr; 423 + msrs->controls[i].addr = cccraddr; 424 + } 425 + } 426 + 418 427 /* 43 ESCR registers in three or four discontiguous group */ 419 428 for (addr = MSR_P4_BSU_ESCR0 + stag; 420 429 addr < MSR_P4_IQ_ESCR0; ++i, addr += addr_increment()) { 421 - msrs->controls[i].addr = addr; 430 + if (reserve_evntsel_nmi(addr)) 431 + msrs->controls[i].addr = addr; 422 432 } 423 433 424 434 /* no IQ_ESCR0/1 on some models, we save a seconde time BSU_ESCR0/1 ··· 431 431 if (boot_cpu_data.x86_model >= 0x3) { 432 432 for (addr = MSR_P4_BSU_ESCR0 + stag; 433 433 addr <= MSR_P4_BSU_ESCR1; ++i, addr += addr_increment()) { 434 - msrs->controls[i].addr = addr; 434 + if (reserve_evntsel_nmi(addr)) 435 + msrs->controls[i].addr = addr; 435 436 } 436 437 } else { 437 438 for (addr = MSR_P4_IQ_ESCR0 + stag; 438 439 addr <= MSR_P4_IQ_ESCR1; ++i, addr += addr_increment()) { 439 - msrs->controls[i].addr = addr; 440 + if (reserve_evntsel_nmi(addr)) 441 + msrs->controls[i].addr = addr; 440 442 } 441 443 } 442 444 443 445 for (addr = MSR_P4_RAT_ESCR0 + stag; 444 446 addr <= MSR_P4_SSU_ESCR0; ++i, addr += addr_increment()) { 445 - msrs->controls[i].addr = addr; 447 + if (reserve_evntsel_nmi(addr)) 448 + msrs->controls[i].addr = addr; 446 449 } 447 450 448 451 for (addr = MSR_P4_MS_ESCR0 + stag; 449 452 addr <= MSR_P4_TC_ESCR1; ++i, addr += addr_increment()) { 450 - msrs->controls[i].addr = addr; 453 + if (reserve_evntsel_nmi(addr)) 454 + msrs->controls[i].addr = addr; 451 455 } 452 456 453 457 for (addr = MSR_P4_IX_ESCR0 + stag; 454 458 addr <= MSR_P4_CRU_ESCR3; ++i, addr += addr_increment()) { 455 - msrs->controls[i].addr = addr; 459 + if (reserve_evntsel_nmi(addr)) 460 + msrs->controls[i].addr = addr; 456 461 } 457 462 458 463 /* there are 2 remaining non-contiguously located ESCRs */ 459 464 460 465 if (num_counters == NUM_COUNTERS_NON_HT) { 461 466 /* standard non-HT CPUs handle both remaining ESCRs*/ 462 - msrs->controls[i++].addr = MSR_P4_CRU_ESCR5; 463 - msrs->controls[i++].addr = MSR_P4_CRU_ESCR4; 467 + if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5)) 468 + msrs->controls[i++].addr = MSR_P4_CRU_ESCR5; 469 + if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR4)) 470 + msrs->controls[i++].addr = MSR_P4_CRU_ESCR4; 464 471 465 472 } else if (stag == 0) { 466 473 /* HT CPUs give the first remainder to the even thread, as 467 474 the 32nd control register */ 468 - msrs->controls[i++].addr = MSR_P4_CRU_ESCR4; 475 + if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR4)) 476 + msrs->controls[i++].addr = MSR_P4_CRU_ESCR4; 469 477 470 478 } else { 471 479 /* and two copies of the second to the odd thread, 472 480 for the 22st and 23nd control registers */ 473 - msrs->controls[i++].addr = MSR_P4_CRU_ESCR5; 474 - msrs->controls[i++].addr = MSR_P4_CRU_ESCR5; 481 + if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5)) { 482 + msrs->controls[i++].addr = MSR_P4_CRU_ESCR5; 483 + msrs->controls[i++].addr = MSR_P4_CRU_ESCR5; 484 + } 475 485 } 476 486 } 477 487 ··· 554 544 { 555 545 unsigned int i; 556 546 unsigned int low, high; 557 - unsigned int addr; 558 547 unsigned int stag; 559 548 560 549 stag = get_stagger(); ··· 566 557 567 558 /* clear the cccrs we will use */ 568 559 for (i = 0 ; i < num_counters ; i++) { 560 + if (unlikely(!CTRL_IS_RESERVED(msrs,i))) 561 + continue; 569 562 rdmsr(p4_counters[VIRT_CTR(stag, i)].cccr_address, low, high); 570 563 CCCR_CLEAR(low); 571 564 CCCR_SET_REQUIRED_BITS(low); 572 565 wrmsr(p4_counters[VIRT_CTR(stag, i)].cccr_address, low, high); 573 566 } 574 567 575 - /* clear cccrs outside our concern */ 576 - for (i = stag ; i < NUM_UNUSED_CCCRS ; i += addr_increment()) { 577 - rdmsr(p4_unused_cccr[i], low, high); 578 - CCCR_CLEAR(low); 579 - CCCR_SET_REQUIRED_BITS(low); 580 - wrmsr(p4_unused_cccr[i], low, high); 581 - } 582 - 583 568 /* clear all escrs (including those outside our concern) */ 584 - for (addr = MSR_P4_BSU_ESCR0 + stag; 585 - addr < MSR_P4_IQ_ESCR0; addr += addr_increment()) { 586 - wrmsr(addr, 0, 0); 569 + for (i = num_counters; i < num_controls; i++) { 570 + if (unlikely(!CTRL_IS_RESERVED(msrs,i))) 571 + continue; 572 + wrmsr(msrs->controls[i].addr, 0, 0); 587 573 } 588 574 589 - /* On older models clear also MSR_P4_IQ_ESCR0/1 */ 590 - if (boot_cpu_data.x86_model < 0x3) { 591 - wrmsr(MSR_P4_IQ_ESCR0, 0, 0); 592 - wrmsr(MSR_P4_IQ_ESCR1, 0, 0); 593 - } 594 - 595 - for (addr = MSR_P4_RAT_ESCR0 + stag; 596 - addr <= MSR_P4_SSU_ESCR0; ++i, addr += addr_increment()) { 597 - wrmsr(addr, 0, 0); 598 - } 599 - 600 - for (addr = MSR_P4_MS_ESCR0 + stag; 601 - addr <= MSR_P4_TC_ESCR1; addr += addr_increment()){ 602 - wrmsr(addr, 0, 0); 603 - } 604 - 605 - for (addr = MSR_P4_IX_ESCR0 + stag; 606 - addr <= MSR_P4_CRU_ESCR3; addr += addr_increment()){ 607 - wrmsr(addr, 0, 0); 608 - } 609 - 610 - if (num_counters == NUM_COUNTERS_NON_HT) { 611 - wrmsr(MSR_P4_CRU_ESCR4, 0, 0); 612 - wrmsr(MSR_P4_CRU_ESCR5, 0, 0); 613 - } else if (stag == 0) { 614 - wrmsr(MSR_P4_CRU_ESCR4, 0, 0); 615 - } else { 616 - wrmsr(MSR_P4_CRU_ESCR5, 0, 0); 617 - } 618 - 619 575 /* setup all counters */ 620 576 for (i = 0 ; i < num_counters ; ++i) { 621 - if (counter_config[i].enabled) { 577 + if ((counter_config[i].enabled) && (CTRL_IS_RESERVED(msrs,i))) { 622 578 reset_value[i] = counter_config[i].count; 623 579 pmc_setup_one_p4_counter(i); 624 580 CTR_WRITE(counter_config[i].count, VIRT_CTR(stag, i)); ··· 670 696 stag = get_stagger(); 671 697 672 698 for (i = 0; i < num_counters; ++i) { 699 + if (!reset_value[i]) 700 + continue; 673 701 CCCR_READ(low, high, VIRT_CTR(stag, i)); 674 702 CCCR_SET_DISABLE(low); 675 703 CCCR_WRITE(low, high, VIRT_CTR(stag, i)); 704 + } 705 + } 706 + 707 + static void p4_shutdown(struct op_msrs const * const msrs) 708 + { 709 + int i; 710 + 711 + for (i = 0 ; i < num_counters ; ++i) { 712 + if (CTR_IS_RESERVED(msrs,i)) 713 + release_perfctr_nmi(msrs->counters[i].addr); 714 + } 715 + /* some of the control registers are specially reserved in 716 + * conjunction with the counter registers (hence the starting offset). 717 + * This saves a few bits. 718 + */ 719 + for (i = num_counters ; i < num_controls ; ++i) { 720 + if (CTRL_IS_RESERVED(msrs,i)) 721 + release_evntsel_nmi(msrs->controls[i].addr); 676 722 } 677 723 } 678 724 ··· 705 711 .setup_ctrs = &p4_setup_ctrs, 706 712 .check_ctrs = &p4_check_ctrs, 707 713 .start = &p4_start, 708 - .stop = &p4_stop 714 + .stop = &p4_stop, 715 + .shutdown = &p4_shutdown 709 716 }; 710 717 #endif 711 718 ··· 717 722 .setup_ctrs = &p4_setup_ctrs, 718 723 .check_ctrs = &p4_check_ctrs, 719 724 .start = &p4_start, 720 - .stop = &p4_stop 725 + .stop = &p4_stop, 726 + .shutdown = &p4_shutdown 721 727 };
+53 -12
arch/i386/oprofile/op_model_ppro.c
··· 22 22 #define NUM_COUNTERS 2 23 23 #define NUM_CONTROLS 2 24 24 25 + #define CTR_IS_RESERVED(msrs,c) (msrs->counters[(c)].addr ? 1 : 0) 25 26 #define CTR_READ(l,h,msrs,c) do {rdmsr(msrs->counters[(c)].addr, (l), (h));} while (0) 26 27 #define CTR_WRITE(l,msrs,c) do {wrmsr(msrs->counters[(c)].addr, -(u32)(l), -1);} while (0) 27 28 #define CTR_OVERFLOWED(n) (!((n) & (1U<<31))) 28 29 30 + #define CTRL_IS_RESERVED(msrs,c) (msrs->controls[(c)].addr ? 1 : 0) 29 31 #define CTRL_READ(l,h,msrs,c) do {rdmsr((msrs->controls[(c)].addr), (l), (h));} while (0) 30 32 #define CTRL_WRITE(l,h,msrs,c) do {wrmsr((msrs->controls[(c)].addr), (l), (h));} while (0) 31 33 #define CTRL_SET_ACTIVE(n) (n |= (1<<22)) ··· 43 41 44 42 static void ppro_fill_in_addresses(struct op_msrs * const msrs) 45 43 { 46 - msrs->counters[0].addr = MSR_P6_PERFCTR0; 47 - msrs->counters[1].addr = MSR_P6_PERFCTR1; 44 + int i; 45 + 46 + for (i=0; i < NUM_COUNTERS; i++) { 47 + if (reserve_perfctr_nmi(MSR_P6_PERFCTR0 + i)) 48 + msrs->counters[i].addr = MSR_P6_PERFCTR0 + i; 49 + else 50 + msrs->counters[i].addr = 0; 51 + } 48 52 49 - msrs->controls[0].addr = MSR_P6_EVNTSEL0; 50 - msrs->controls[1].addr = MSR_P6_EVNTSEL1; 53 + for (i=0; i < NUM_CONTROLS; i++) { 54 + if (reserve_evntsel_nmi(MSR_P6_EVNTSEL0 + i)) 55 + msrs->controls[i].addr = MSR_P6_EVNTSEL0 + i; 56 + else 57 + msrs->controls[i].addr = 0; 58 + } 51 59 } 52 60 53 61 ··· 68 56 69 57 /* clear all counters */ 70 58 for (i = 0 ; i < NUM_CONTROLS; ++i) { 59 + if (unlikely(!CTRL_IS_RESERVED(msrs,i))) 60 + continue; 71 61 CTRL_READ(low, high, msrs, i); 72 62 CTRL_CLEAR(low); 73 63 CTRL_WRITE(low, high, msrs, i); ··· 77 63 78 64 /* avoid a false detection of ctr overflows in NMI handler */ 79 65 for (i = 0; i < NUM_COUNTERS; ++i) { 66 + if (unlikely(!CTR_IS_RESERVED(msrs,i))) 67 + continue; 80 68 CTR_WRITE(1, msrs, i); 81 69 } 82 70 83 71 /* enable active counters */ 84 72 for (i = 0; i < NUM_COUNTERS; ++i) { 85 - if (counter_config[i].enabled) { 73 + if ((counter_config[i].enabled) && (CTR_IS_RESERVED(msrs,i))) { 86 74 reset_value[i] = counter_config[i].count; 87 75 88 76 CTR_WRITE(counter_config[i].count, msrs, i); ··· 97 81 CTRL_SET_UM(low, counter_config[i].unit_mask); 98 82 CTRL_SET_EVENT(low, counter_config[i].event); 99 83 CTRL_WRITE(low, high, msrs, i); 84 + } else { 85 + reset_value[i] = 0; 100 86 } 101 87 } 102 88 } ··· 111 93 int i; 112 94 113 95 for (i = 0 ; i < NUM_COUNTERS; ++i) { 96 + if (!reset_value[i]) 97 + continue; 114 98 CTR_READ(low, high, msrs, i); 115 99 if (CTR_OVERFLOWED(low)) { 116 100 oprofile_add_sample(regs, i); ··· 138 118 static void ppro_start(struct op_msrs const * const msrs) 139 119 { 140 120 unsigned int low,high; 141 - CTRL_READ(low, high, msrs, 0); 142 - CTRL_SET_ACTIVE(low); 143 - CTRL_WRITE(low, high, msrs, 0); 121 + 122 + if (reset_value[0]) { 123 + CTRL_READ(low, high, msrs, 0); 124 + CTRL_SET_ACTIVE(low); 125 + CTRL_WRITE(low, high, msrs, 0); 126 + } 144 127 } 145 128 146 129 147 130 static void ppro_stop(struct op_msrs const * const msrs) 148 131 { 149 132 unsigned int low,high; 150 - CTRL_READ(low, high, msrs, 0); 151 - CTRL_SET_INACTIVE(low); 152 - CTRL_WRITE(low, high, msrs, 0); 133 + 134 + if (reset_value[0]) { 135 + CTRL_READ(low, high, msrs, 0); 136 + CTRL_SET_INACTIVE(low); 137 + CTRL_WRITE(low, high, msrs, 0); 138 + } 139 + } 140 + 141 + static void ppro_shutdown(struct op_msrs const * const msrs) 142 + { 143 + int i; 144 + 145 + for (i = 0 ; i < NUM_COUNTERS ; ++i) { 146 + if (CTR_IS_RESERVED(msrs,i)) 147 + release_perfctr_nmi(MSR_P6_PERFCTR0 + i); 148 + } 149 + for (i = 0 ; i < NUM_CONTROLS ; ++i) { 150 + if (CTRL_IS_RESERVED(msrs,i)) 151 + release_evntsel_nmi(MSR_P6_EVNTSEL0 + i); 152 + } 153 153 } 154 154 155 155 ··· 180 140 .setup_ctrs = &ppro_setup_ctrs, 181 141 .check_ctrs = &ppro_check_ctrs, 182 142 .start = &ppro_start, 183 - .stop = &ppro_stop 143 + .stop = &ppro_stop, 144 + .shutdown = &ppro_shutdown 184 145 };
+1
arch/i386/oprofile/op_x86_model.h
··· 40 40 struct op_msrs const * const msrs); 41 41 void (*start)(struct op_msrs const * const msrs); 42 42 void (*stop)(struct op_msrs const * const msrs); 43 + void (*shutdown)(struct op_msrs const * const msrs); 43 44 }; 44 45 45 46 extern struct op_x86_model_spec const op_ppro_spec;
+1 -1
arch/i386/pci/Makefile
··· 11 11 pci-$(CONFIG_X86_VISWS) := visws.o fixup.o 12 12 pci-$(CONFIG_X86_NUMAQ) := numa.o irq.o 13 13 14 - obj-y += $(pci-y) common.o 14 + obj-y += $(pci-y) common.o early.o
+4
arch/i386/pci/common.c
··· 242 242 acpi_noirq_set(); 243 243 return NULL; 244 244 } 245 + else if (!strcmp(str, "noearly")) { 246 + pci_probe |= PCI_PROBE_NOEARLY; 247 + return NULL; 248 + } 245 249 #ifndef CONFIG_X86_VISWS 246 250 else if (!strcmp(str, "usepirqmask")) { 247 251 pci_probe |= PCI_USE_PIRQ_MASK;
+16 -9
arch/i386/pci/direct.c
··· 254 254 return works; 255 255 } 256 256 257 - void __init pci_direct_init(void) 257 + void __init pci_direct_init(int type) 258 + { 259 + printk(KERN_INFO "PCI: Using configuration type %d\n", type); 260 + if (type == 1) 261 + raw_pci_ops = &pci_direct_conf1; 262 + else 263 + raw_pci_ops = &pci_direct_conf2; 264 + } 265 + 266 + int __init pci_direct_probe(void) 258 267 { 259 268 struct resource *region, *region2; 260 269 ··· 273 264 if (!region) 274 265 goto type2; 275 266 276 - if (pci_check_type1()) { 277 - printk(KERN_INFO "PCI: Using configuration type 1\n"); 278 - raw_pci_ops = &pci_direct_conf1; 279 - return; 280 - } 267 + if (pci_check_type1()) 268 + return 1; 281 269 release_resource(region); 282 270 283 271 type2: 284 272 if ((pci_probe & PCI_PROBE_CONF2) == 0) 285 - return; 273 + return 0; 286 274 region = request_region(0xCF8, 4, "PCI conf2"); 287 275 if (!region) 288 - return; 276 + return 0; 289 277 region2 = request_region(0xC000, 0x1000, "PCI conf2"); 290 278 if (!region2) 291 279 goto fail2; ··· 290 284 if (pci_check_type2()) { 291 285 printk(KERN_INFO "PCI: Using configuration type 2\n"); 292 286 raw_pci_ops = &pci_direct_conf2; 293 - return; 287 + return 2; 294 288 } 295 289 296 290 release_resource(region2); 297 291 fail2: 298 292 release_resource(region); 293 + return 0; 299 294 }
+52
arch/i386/pci/early.c
··· 1 + #include <linux/kernel.h> 2 + #include <linux/pci.h> 3 + #include <asm/pci-direct.h> 4 + #include <asm/io.h> 5 + #include "pci.h" 6 + 7 + /* Direct PCI access. This is used for PCI accesses in early boot before 8 + the PCI subsystem works. */ 9 + 10 + #define PDprintk(x...) 11 + 12 + u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset) 13 + { 14 + u32 v; 15 + outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 16 + v = inl(0xcfc); 17 + if (v != 0xffffffff) 18 + PDprintk("%x reading 4 from %x: %x\n", slot, offset, v); 19 + return v; 20 + } 21 + 22 + u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset) 23 + { 24 + u8 v; 25 + outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 26 + v = inb(0xcfc + (offset&3)); 27 + PDprintk("%x reading 1 from %x: %x\n", slot, offset, v); 28 + return v; 29 + } 30 + 31 + u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset) 32 + { 33 + u16 v; 34 + outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 35 + v = inw(0xcfc + (offset&2)); 36 + PDprintk("%x reading 2 from %x: %x\n", slot, offset, v); 37 + return v; 38 + } 39 + 40 + void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, 41 + u32 val) 42 + { 43 + PDprintk("%x writing to %x: %x\n", slot, offset, val); 44 + outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 45 + outl(val, 0xcfc); 46 + } 47 + 48 + int early_pci_allowed(void) 49 + { 50 + return (pci_probe & (PCI_PROBE_CONF1|PCI_PROBE_NOEARLY)) == 51 + PCI_PROBE_CONF1; 52 + }
+7 -2
arch/i386/pci/init.c
··· 6 6 in the right sequence from here. */ 7 7 static __init int pci_access_init(void) 8 8 { 9 + int type = 0; 10 + 11 + #ifdef CONFIG_PCI_DIRECT 12 + type = pci_direct_probe(); 13 + #endif 9 14 #ifdef CONFIG_PCI_MMCONFIG 10 - pci_mmcfg_init(); 15 + pci_mmcfg_init(type); 11 16 #endif 12 17 if (raw_pci_ops) 13 18 return 0; ··· 26 21 * fails. 27 22 */ 28 23 #ifdef CONFIG_PCI_DIRECT 29 - pci_direct_init(); 24 + pci_direct_init(type); 30 25 #endif 31 26 return 0; 32 27 }
+39 -2
arch/i386/pci/mmconfig.c
··· 151 151 .write = pci_mmcfg_write, 152 152 }; 153 153 154 + 155 + static __init void pci_mmcfg_insert_resources(void) 156 + { 157 + #define PCI_MMCFG_RESOURCE_NAME_LEN 19 158 + int i; 159 + struct resource *res; 160 + char *names; 161 + unsigned num_buses; 162 + 163 + res = kcalloc(PCI_MMCFG_RESOURCE_NAME_LEN + sizeof(*res), 164 + pci_mmcfg_config_num, GFP_KERNEL); 165 + 166 + if (!res) { 167 + printk(KERN_ERR "PCI: Unable to allocate MMCONFIG resources\n"); 168 + return; 169 + } 170 + 171 + names = (void *)&res[pci_mmcfg_config_num]; 172 + for (i = 0; i < pci_mmcfg_config_num; i++, res++) { 173 + num_buses = pci_mmcfg_config[i].end_bus_number - 174 + pci_mmcfg_config[i].start_bus_number + 1; 175 + res->name = names; 176 + snprintf(names, PCI_MMCFG_RESOURCE_NAME_LEN, "PCI MMCONFIG %u", 177 + pci_mmcfg_config[i].pci_segment_group_number); 178 + res->start = pci_mmcfg_config[i].base_address; 179 + res->end = res->start + (num_buses << 20) - 1; 180 + res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; 181 + insert_resource(&iomem_resource, res); 182 + names += PCI_MMCFG_RESOURCE_NAME_LEN; 183 + } 184 + } 185 + 154 186 /* K8 systems have some devices (typically in the builtin northbridge) 155 187 that are only accessible using type1 156 188 Normally this can be expressed in the MCFG by not listing them ··· 219 187 } 220 188 } 221 189 222 - void __init pci_mmcfg_init(void) 190 + 191 + 192 + void __init pci_mmcfg_init(int type) 223 193 { 224 194 if ((pci_probe & PCI_PROBE_MMCONF) == 0) 225 195 return; ··· 232 198 (pci_mmcfg_config[0].base_address == 0)) 233 199 return; 234 200 235 - if (!e820_all_mapped(pci_mmcfg_config[0].base_address, 201 + /* Only do this check when type 1 works. If it doesn't work 202 + assume we run on a Mac and always use MCFG */ 203 + if (type == 1 && !e820_all_mapped(pci_mmcfg_config[0].base_address, 236 204 pci_mmcfg_config[0].base_address + MMCONFIG_APER_MIN, 237 205 E820_RESERVED)) { 238 206 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %x is not E820-reserved\n", ··· 248 212 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; 249 213 250 214 unreachable_devices(); 215 + pci_mmcfg_insert_resources(); 251 216 }
+5 -2
arch/i386/pci/pci.h
··· 17 17 #define PCI_PROBE_CONF2 0x0004 18 18 #define PCI_PROBE_MMCONF 0x0008 19 19 #define PCI_PROBE_MASK 0x000f 20 + #define PCI_PROBE_NOEARLY 0x0010 20 21 21 22 #define PCI_NO_SORT 0x0100 22 23 #define PCI_BIOS_SORT 0x0200 ··· 82 81 extern int pci_conf1_read(unsigned int seg, unsigned int bus, 83 82 unsigned int devfn, int reg, int len, u32 *value); 84 83 85 - extern void pci_direct_init(void); 84 + extern int pci_direct_probe(void); 85 + extern void pci_direct_init(int type); 86 86 extern void pci_pcbios_init(void); 87 - extern void pci_mmcfg_init(void); 87 + extern void pci_mmcfg_init(int type); 88 88 extern void pcibios_sort(void); 89 +
+8 -9
arch/s390/kernel/stacktrace.c
··· 59 59 } 60 60 } 61 61 62 - void save_stack_trace(struct stack_trace *trace, 63 - struct task_struct *task, int all_contexts, 64 - unsigned int skip) 62 + void save_stack_trace(struct stack_trace *trace, struct task_struct *task) 65 63 { 66 64 register unsigned long sp asm ("15"); 67 65 unsigned long orig_sp; ··· 67 69 sp &= PSW_ADDR_INSN; 68 70 orig_sp = sp; 69 71 70 - sp = save_context_stack(trace, &skip, sp, 72 + sp = save_context_stack(trace, &trace->skip, sp, 71 73 S390_lowcore.panic_stack - PAGE_SIZE, 72 74 S390_lowcore.panic_stack); 73 - if ((sp != orig_sp) && !all_contexts) 75 + if ((sp != orig_sp) && !trace->all_contexts) 74 76 return; 75 - sp = save_context_stack(trace, &skip, sp, 77 + sp = save_context_stack(trace, &trace->skip, sp, 76 78 S390_lowcore.async_stack - ASYNC_SIZE, 77 79 S390_lowcore.async_stack); 78 - if ((sp != orig_sp) && !all_contexts) 80 + if ((sp != orig_sp) && !trace->all_contexts) 79 81 return; 80 82 if (task) 81 - save_context_stack(trace, &skip, sp, 83 + save_context_stack(trace, &trace->skip, sp, 82 84 (unsigned long) task_stack_page(task), 83 85 (unsigned long) task_stack_page(task) + THREAD_SIZE); 84 86 else 85 - save_context_stack(trace, &skip, sp, S390_lowcore.thread_info, 87 + save_context_stack(trace, &trace->skip, sp, 88 + S390_lowcore.thread_info, 86 89 S390_lowcore.thread_info + THREAD_SIZE); 87 90 return; 88 91 }
+1 -1
arch/um/sys-i386/Makefile
··· 4 4 5 5 obj-$(CONFIG_MODE_SKAS) += stub.o stub_segv.o 6 6 7 - subarch-obj-y = lib/bitops.o kernel/semaphore.o 7 + subarch-obj-y = lib/bitops.o lib/semaphore.o 8 8 subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem.o 9 9 subarch-obj-$(CONFIG_MODULES) += kernel/module.o 10 10
+35 -5
arch/x86_64/Kconfig
··· 109 109 110 110 config X86_VSMP 111 111 bool "Support for ScaleMP vSMP" 112 + depends on PCI 112 113 help 113 114 Support for ScaleMP vSMP systems. Say 'Y' here if this kernel is 114 115 supposed to run on these EM64T-based machines. Only choose this option ··· 296 295 297 296 config K8_NUMA 298 297 bool "Old style AMD Opteron NUMA detection" 299 - depends on NUMA 298 + depends on NUMA && PCI 300 299 default y 301 300 help 302 301 Enable K8 NUMA node topology detection. You should say Y here if ··· 426 425 427 426 config CALGARY_IOMMU 428 427 bool "IBM Calgary IOMMU support" 429 - default y 430 428 select SWIOTLB 431 429 depends on PCI && EXPERIMENTAL 432 430 help ··· 472 472 the DRAM Error Threshold. 473 473 474 474 config KEXEC 475 - bool "kexec system call (EXPERIMENTAL)" 476 - depends on EXPERIMENTAL 475 + bool "kexec system call" 477 476 help 478 477 kexec is a system call that implements the ability to shutdown your 479 478 current kernel, and to start another kernel. It is like a reboot ··· 491 492 bool "kernel crash dumps (EXPERIMENTAL)" 492 493 depends on EXPERIMENTAL 493 494 help 494 - Generate crash dump after being started by kexec. 495 + Generate crash dump after being started by kexec. 496 + This should be normally only set in special crash dump kernels 497 + which are loaded in the main kernel with kexec-tools into 498 + a specially reserved region and then later executed after 499 + a crash by kdump/kexec. The crash dump kernel must be compiled 500 + to a memory address not used by the main kernel or BIOS using 501 + PHYSICAL_START. 502 + For more details see Documentation/kdump/kdump.txt 495 503 496 504 config PHYSICAL_START 497 505 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) ··· 535 529 defined by each seccomp mode. 536 530 537 531 If unsure, say Y. Only embedded should say N here. 532 + 533 + config CC_STACKPROTECTOR 534 + bool "Enable -fstack-protector buffer overflow detection (EXPRIMENTAL)" 535 + depends on EXPERIMENTAL 536 + help 537 + This option turns on the -fstack-protector GCC feature. This 538 + feature puts, at the beginning of critical functions, a canary 539 + value on the stack just before the return address, and validates 540 + the value just before actually returning. Stack based buffer 541 + overflows (that need to overwrite this return address) now also 542 + overwrite the canary, which gets detected and the attack is then 543 + neutralized via a kernel panic. 544 + 545 + This feature requires gcc version 4.2 or above, or a distribution 546 + gcc with the feature backported. Older versions are automatically 547 + detected and for those versions, this configuration option is ignored. 548 + 549 + config CC_STACKPROTECTOR_ALL 550 + bool "Use stack-protector for all functions" 551 + depends on CC_STACKPROTECTOR 552 + help 553 + Normally, GCC only inserts the canary value protection for 554 + functions that use large-ish on-stack buffers. By enabling 555 + this option, GCC will be asked to do this for ALL functions. 538 556 539 557 source kernel/Kconfig.hz 540 558
+10
arch/x86_64/Makefile
··· 54 54 cflags-y += $(call cc-option,-funit-at-a-time) 55 55 # prevent gcc from generating any FP code by mistake 56 56 cflags-y += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) 57 + # do binutils support CFI? 58 + cflags-y += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 59 + AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 60 + 61 + # is .cfi_signal_frame supported too? 62 + cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) 63 + AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) 64 + 65 + cflags-$(CONFIG_CC_STACKPROTECTOR) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh $(CC) -fstack-protector ) 66 + cflags-$(CONFIG_CC_STACKPROTECTOR_ALL) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh $(CC) -fstack-protector-all ) 57 67 58 68 CFLAGS += $(cflags-y) 59 69 CFLAGS_KERNEL += $(cflags-kernel-y)
+2 -1
arch/x86_64/boot/compressed/Makefile
··· 7 7 # 8 8 9 9 targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o 10 - EXTRA_AFLAGS := -traditional -m32 10 + EXTRA_AFLAGS := -traditional 11 + AFLAGS := $(subst -m64,-m32,$(AFLAGS)) 11 12 12 13 # cannot use EXTRA_CFLAGS because base CFLAGS contains -mkernel which conflicts with 13 14 # -m32
+2 -2
arch/x86_64/boot/setup.S
··· 526 526 movw %cs, %ax # aka SETUPSEG 527 527 subw $DELTA_INITSEG, %ax # aka INITSEG 528 528 movw %ax, %ds 529 - movw $0, (0x1ff) # default is no pointing device 529 + movb $0, (0x1ff) # default is no pointing device 530 530 int $0x11 # int 0x11: equipment list 531 531 testb $0x04, %al # check if mouse installed 532 532 jz no_psmouse 533 533 534 - movw $0xAA, (0x1ff) # device present 534 + movb $0xAA, (0x1ff) # device present 535 535 no_psmouse: 536 536 537 537 #include "../../i386/boot/edd.S"
+78 -31
arch/x86_64/defconfig
··· 1 1 # 2 2 # Automatically generated make config: don't edit 3 - # Linux kernel version: 2.6.18-rc4 4 - # Thu Aug 24 21:05:55 2006 3 + # Linux kernel version: 2.6.18-git5 4 + # Tue Sep 26 09:30:47 2006 5 5 # 6 6 CONFIG_X86_64=y 7 7 CONFIG_64BIT=y ··· 19 19 CONFIG_GENERIC_IOMAP=y 20 20 CONFIG_ARCH_MAY_HAVE_PC_FDC=y 21 21 CONFIG_DMI=y 22 + CONFIG_AUDIT_ARCH=y 22 23 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 23 24 24 25 # ··· 39 38 CONFIG_POSIX_MQUEUE=y 40 39 # CONFIG_BSD_PROCESS_ACCT is not set 41 40 # CONFIG_TASKSTATS is not set 42 - CONFIG_SYSCTL=y 43 41 # CONFIG_AUDIT is not set 44 42 CONFIG_IKCONFIG=y 45 43 CONFIG_IKCONFIG_PROC=y 46 44 # CONFIG_CPUSETS is not set 47 45 # CONFIG_RELAY is not set 48 46 CONFIG_INITRAMFS_SOURCE="" 49 - CONFIG_UID16=y 50 47 CONFIG_CC_OPTIMIZE_FOR_SIZE=y 51 48 # CONFIG_EMBEDDED is not set 49 + CONFIG_UID16=y 50 + CONFIG_SYSCTL=y 52 51 CONFIG_KALLSYMS=y 53 52 CONFIG_KALLSYMS_ALL=y 54 53 # CONFIG_KALLSYMS_EXTRA_PASS is not set ··· 57 56 CONFIG_BUG=y 58 57 CONFIG_ELF_CORE=y 59 58 CONFIG_BASE_FULL=y 60 - CONFIG_RT_MUTEXES=y 61 59 CONFIG_FUTEX=y 62 60 CONFIG_EPOLL=y 63 61 CONFIG_SHMEM=y 64 62 CONFIG_SLAB=y 65 63 CONFIG_VM_EVENT_COUNTERS=y 64 + CONFIG_RT_MUTEXES=y 66 65 # CONFIG_TINY_SHMEM is not set 67 66 CONFIG_BASE_SMALL=0 68 67 # CONFIG_SLOB is not set ··· 161 160 # CONFIG_CRASH_DUMP is not set 162 161 CONFIG_PHYSICAL_START=0x200000 163 162 CONFIG_SECCOMP=y 163 + # CONFIG_CC_STACKPROTECTOR is not set 164 164 # CONFIG_HZ_100 is not set 165 165 CONFIG_HZ_250=y 166 166 # CONFIG_HZ_1000 is not set ··· 309 307 CONFIG_INET_DIAG=y 310 308 CONFIG_INET_TCP_DIAG=y 311 309 # CONFIG_TCP_CONG_ADVANCED is not set 312 - CONFIG_TCP_CONG_BIC=y 310 + CONFIG_TCP_CONG_CUBIC=y 311 + CONFIG_DEFAULT_TCP_CONG="cubic" 313 312 CONFIG_IPV6=y 314 313 # CONFIG_IPV6_PRIVACY is not set 315 314 # CONFIG_IPV6_ROUTER_PREF is not set 316 315 # CONFIG_INET6_AH is not set 317 316 # CONFIG_INET6_ESP is not set 318 317 # CONFIG_INET6_IPCOMP is not set 318 + # CONFIG_IPV6_MIP6 is not set 319 319 # CONFIG_INET6_XFRM_TUNNEL is not set 320 320 # CONFIG_INET6_TUNNEL is not set 321 321 # CONFIG_INET6_XFRM_MODE_TRANSPORT is not set 322 322 # CONFIG_INET6_XFRM_MODE_TUNNEL is not set 323 + # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 323 324 # CONFIG_IPV6_TUNNEL is not set 325 + # CONFIG_IPV6_SUBTREES is not set 326 + # CONFIG_IPV6_MULTIPLE_TABLES is not set 324 327 # CONFIG_NETWORK_SECMARK is not set 325 328 # CONFIG_NETFILTER is not set 326 329 ··· 352 345 # CONFIG_ATALK is not set 353 346 # CONFIG_X25 is not set 354 347 # CONFIG_LAPB is not set 355 - # CONFIG_NET_DIVERT is not set 356 348 # CONFIG_ECONET is not set 357 349 # CONFIG_WAN_ROUTER is not set 358 350 ··· 493 487 # 494 488 # CONFIG_RAID_ATTRS is not set 495 489 CONFIG_SCSI=y 490 + CONFIG_SCSI_NETLINK=y 496 491 # CONFIG_SCSI_PROC_FS is not set 497 492 498 493 # ··· 515 508 # CONFIG_SCSI_LOGGING is not set 516 509 517 510 # 518 - # SCSI Transport Attributes 511 + # SCSI Transports 519 512 # 520 513 CONFIG_SCSI_SPI_ATTRS=y 521 514 CONFIG_SCSI_FC_ATTRS=y 522 515 # CONFIG_SCSI_ISCSI_ATTRS is not set 523 516 CONFIG_SCSI_SAS_ATTRS=y 517 + # CONFIG_SCSI_SAS_LIBSAS is not set 524 518 525 519 # 526 520 # SCSI low-level drivers ··· 540 532 # CONFIG_AIC79XX_DEBUG_ENABLE is not set 541 533 CONFIG_AIC79XX_DEBUG_MASK=0 542 534 # CONFIG_AIC79XX_REG_PRETTY_PRINT is not set 535 + # CONFIG_SCSI_AIC94XX is not set 536 + # CONFIG_SCSI_ARCMSR is not set 543 537 CONFIG_MEGARAID_NEWGEN=y 544 538 CONFIG_MEGARAID_MM=y 545 539 CONFIG_MEGARAID_MAILBOX=y 546 540 # CONFIG_MEGARAID_LEGACY is not set 547 541 CONFIG_MEGARAID_SAS=y 548 - CONFIG_SCSI_SATA=y 549 - CONFIG_SCSI_SATA_AHCI=y 550 - CONFIG_SCSI_SATA_SVW=y 551 - CONFIG_SCSI_ATA_PIIX=y 552 - # CONFIG_SCSI_SATA_MV is not set 553 - CONFIG_SCSI_SATA_NV=y 554 - # CONFIG_SCSI_PDC_ADMA is not set 555 542 # CONFIG_SCSI_HPTIOP is not set 556 - # CONFIG_SCSI_SATA_QSTOR is not set 557 - # CONFIG_SCSI_SATA_PROMISE is not set 558 - # CONFIG_SCSI_SATA_SX4 is not set 559 - CONFIG_SCSI_SATA_SIL=y 560 - # CONFIG_SCSI_SATA_SIL24 is not set 561 - # CONFIG_SCSI_SATA_SIS is not set 562 - # CONFIG_SCSI_SATA_ULI is not set 563 - CONFIG_SCSI_SATA_VIA=y 564 - # CONFIG_SCSI_SATA_VITESSE is not set 565 - CONFIG_SCSI_SATA_INTEL_COMBINED=y 566 543 # CONFIG_SCSI_BUSLOGIC is not set 567 544 # CONFIG_SCSI_DMX3191D is not set 568 545 # CONFIG_SCSI_EATA is not set ··· 556 563 # CONFIG_SCSI_IPS is not set 557 564 # CONFIG_SCSI_INITIO is not set 558 565 # CONFIG_SCSI_INIA100 is not set 566 + # CONFIG_SCSI_STEX is not set 559 567 # CONFIG_SCSI_SYM53C8XX_2 is not set 560 568 # CONFIG_SCSI_IPR is not set 561 569 # CONFIG_SCSI_QLOGIC_1280 is not set ··· 565 571 # CONFIG_SCSI_DC395x is not set 566 572 # CONFIG_SCSI_DC390T is not set 567 573 # CONFIG_SCSI_DEBUG is not set 574 + 575 + # 576 + # Serial ATA (prod) and Parallel ATA (experimental) drivers 577 + # 578 + CONFIG_ATA=y 579 + CONFIG_SATA_AHCI=y 580 + CONFIG_SATA_SVW=y 581 + CONFIG_ATA_PIIX=y 582 + # CONFIG_SATA_MV is not set 583 + CONFIG_SATA_NV=y 584 + # CONFIG_PDC_ADMA is not set 585 + # CONFIG_SATA_QSTOR is not set 586 + # CONFIG_SATA_PROMISE is not set 587 + # CONFIG_SATA_SX4 is not set 588 + CONFIG_SATA_SIL=y 589 + # CONFIG_SATA_SIL24 is not set 590 + # CONFIG_SATA_SIS is not set 591 + # CONFIG_SATA_ULI is not set 592 + CONFIG_SATA_VIA=y 593 + # CONFIG_SATA_VITESSE is not set 594 + CONFIG_SATA_INTEL_COMBINED=y 595 + # CONFIG_PATA_ALI is not set 596 + # CONFIG_PATA_AMD is not set 597 + # CONFIG_PATA_ARTOP is not set 598 + # CONFIG_PATA_ATIIXP is not set 599 + # CONFIG_PATA_CMD64X is not set 600 + # CONFIG_PATA_CS5520 is not set 601 + # CONFIG_PATA_CS5530 is not set 602 + # CONFIG_PATA_CYPRESS is not set 603 + # CONFIG_PATA_EFAR is not set 604 + # CONFIG_ATA_GENERIC is not set 605 + # CONFIG_PATA_HPT366 is not set 606 + # CONFIG_PATA_HPT37X is not set 607 + # CONFIG_PATA_HPT3X2N is not set 608 + # CONFIG_PATA_HPT3X3 is not set 609 + # CONFIG_PATA_IT821X is not set 610 + # CONFIG_PATA_JMICRON is not set 611 + # CONFIG_PATA_LEGACY is not set 612 + # CONFIG_PATA_TRIFLEX is not set 613 + # CONFIG_PATA_MPIIX is not set 614 + # CONFIG_PATA_OLDPIIX is not set 615 + # CONFIG_PATA_NETCELL is not set 616 + # CONFIG_PATA_NS87410 is not set 617 + # CONFIG_PATA_OPTI is not set 618 + # CONFIG_PATA_OPTIDMA is not set 619 + # CONFIG_PATA_PDC_OLD is not set 620 + # CONFIG_PATA_QDI is not set 621 + # CONFIG_PATA_RADISYS is not set 622 + # CONFIG_PATA_RZ1000 is not set 623 + # CONFIG_PATA_SC1200 is not set 624 + # CONFIG_PATA_SERVERWORKS is not set 625 + # CONFIG_PATA_PDC2027X is not set 626 + # CONFIG_PATA_SIL680 is not set 627 + # CONFIG_PATA_SIS is not set 628 + # CONFIG_PATA_VIA is not set 629 + # CONFIG_PATA_WINBOND is not set 568 630 569 631 # 570 632 # Multi-device support (RAID and LVM) ··· 728 678 # CONFIG_ADAPTEC_STARFIRE is not set 729 679 CONFIG_B44=y 730 680 CONFIG_FORCEDETH=y 681 + # CONFIG_FORCEDETH_NAPI is not set 731 682 # CONFIG_DGRS is not set 732 683 # CONFIG_EEPRO100 is not set 733 684 CONFIG_E100=y ··· 765 714 # CONFIG_VIA_VELOCITY is not set 766 715 CONFIG_TIGON3=y 767 716 CONFIG_BNX2=y 717 + # CONFIG_QLA3XXX is not set 768 718 769 719 # 770 720 # Ethernet (10000 Mbit) ··· 1088 1036 # Open Sound System 1089 1037 # 1090 1038 CONFIG_SOUND_PRIME=y 1039 + CONFIG_OSS_OBSOLETE_DRIVER=y 1091 1040 # CONFIG_SOUND_BT878 is not set 1092 1041 # CONFIG_SOUND_EMU10K1 is not set 1093 1042 # CONFIG_SOUND_FUSION is not set ··· 1099 1046 # CONFIG_SOUND_MSNDPIN is not set 1100 1047 # CONFIG_SOUND_VIA82CXXX is not set 1101 1048 # CONFIG_SOUND_OSS is not set 1102 - # CONFIG_SOUND_TVMIXER is not set 1103 1049 1104 1050 # 1105 1051 # USB support ··· 1255 1203 # InfiniBand support 1256 1204 # 1257 1205 # CONFIG_INFINIBAND is not set 1258 - # CONFIG_IPATH_CORE is not set 1259 1206 1260 1207 # 1261 1208 # EDAC - error detection and reporting (RAS) (EXPERIMENTAL) ··· 1498 1447 # Cryptographic options 1499 1448 # 1500 1449 # CONFIG_CRYPTO is not set 1501 - 1502 - # 1503 - # Hardware crypto devices 1504 - # 1505 1450 1506 1451 # 1507 1452 # Library routines
+5 -3
arch/x86_64/ia32/ia32_aout.c
··· 333 333 return error; 334 334 } 335 335 336 - error = bprm->file->f_op->read(bprm->file, (char *)text_addr, 336 + error = bprm->file->f_op->read(bprm->file, 337 + (char __user *)text_addr, 337 338 ex.a_text+ex.a_data, &pos); 338 339 if ((signed long)error < 0) { 339 340 send_sig(SIGKILL, current, 0); ··· 367 366 down_write(&current->mm->mmap_sem); 368 367 do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); 369 368 up_write(&current->mm->mmap_sem); 370 - bprm->file->f_op->read(bprm->file,(char *)N_TXTADDR(ex), 369 + bprm->file->f_op->read(bprm->file, 370 + (char __user *)N_TXTADDR(ex), 371 371 ex.a_text+ex.a_data, &pos); 372 372 flush_icache_range((unsigned long) N_TXTADDR(ex), 373 373 (unsigned long) N_TXTADDR(ex) + ··· 479 477 do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss); 480 478 up_write(&current->mm->mmap_sem); 481 479 482 - file->f_op->read(file, (char *)start_addr, 480 + file->f_op->read(file, (char __user *)start_addr, 483 481 ex.a_text + ex.a_data, &pos); 484 482 flush_icache_range((unsigned long) start_addr, 485 483 (unsigned long) start_addr + ex.a_text + ex.a_data);
+22 -31
arch/x86_64/ia32/ia32_signal.c
··· 113 113 } 114 114 115 115 asmlinkage long 116 - sys32_sigsuspend(int history0, int history1, old_sigset_t mask, 117 - struct pt_regs *regs) 116 + sys32_sigsuspend(int history0, int history1, old_sigset_t mask) 118 117 { 119 - sigset_t saveset; 120 - 121 118 mask &= _BLOCKABLE; 122 119 spin_lock_irq(&current->sighand->siglock); 123 - saveset = current->blocked; 120 + current->saved_sigmask = current->blocked; 124 121 siginitset(&current->blocked, mask); 125 122 recalc_sigpending(); 126 123 spin_unlock_irq(&current->sighand->siglock); 127 124 128 - regs->rax = -EINTR; 129 - while (1) { 130 - current->state = TASK_INTERRUPTIBLE; 131 - schedule(); 132 - if (do_signal(regs, &saveset)) 133 - return -EINTR; 134 - } 125 + current->state = TASK_INTERRUPTIBLE; 126 + schedule(); 127 + set_thread_flag(TIF_RESTORE_SIGMASK); 128 + return -ERESTARTNOHAND; 135 129 } 136 130 137 131 asmlinkage long ··· 431 437 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 432 438 goto give_sigsegv; 433 439 434 - { 435 - struct exec_domain *ed = current_thread_info()->exec_domain; 436 - err |= __put_user((ed 437 - && ed->signal_invmap 438 - && sig < 32 439 - ? ed->signal_invmap[sig] 440 - : sig), 441 - &frame->sig); 442 - } 440 + err |= __put_user(sig, &frame->sig); 443 441 if (err) 444 442 goto give_sigsegv; 445 443 ··· 478 492 regs->rsp = (unsigned long) frame; 479 493 regs->rip = (unsigned long) ka->sa.sa_handler; 480 494 495 + /* Make -mregparm=3 work */ 496 + regs->rax = sig; 497 + regs->rdx = 0; 498 + regs->rcx = 0; 499 + 481 500 asm volatile("movl %0,%%ds" :: "r" (__USER32_DS)); 482 501 asm volatile("movl %0,%%es" :: "r" (__USER32_DS)); 483 502 ··· 490 499 regs->ss = __USER32_DS; 491 500 492 501 set_fs(USER_DS); 493 - regs->eflags &= ~TF_MASK; 494 - if (test_thread_flag(TIF_SINGLESTEP)) 495 - ptrace_notify(SIGTRAP); 502 + regs->eflags &= ~TF_MASK; 503 + if (test_thread_flag(TIF_SINGLESTEP)) 504 + ptrace_notify(SIGTRAP); 496 505 497 506 #if DEBUG_SIG 498 507 printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", 499 508 current->comm, current->pid, frame, regs->rip, frame->pretcode); 500 509 #endif 501 510 502 - return 1; 511 + return 0; 503 512 504 513 give_sigsegv: 505 514 force_sigsegv(sig, current); 506 - return 0; 515 + return -EFAULT; 507 516 } 508 517 509 518 int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ··· 586 595 regs->ss = __USER32_DS; 587 596 588 597 set_fs(USER_DS); 589 - regs->eflags &= ~TF_MASK; 590 - if (test_thread_flag(TIF_SINGLESTEP)) 591 - ptrace_notify(SIGTRAP); 598 + regs->eflags &= ~TF_MASK; 599 + if (test_thread_flag(TIF_SINGLESTEP)) 600 + ptrace_notify(SIGTRAP); 592 601 593 602 #if DEBUG_SIG 594 603 printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", 595 604 current->comm, current->pid, frame, regs->rip, frame->pretcode); 596 605 #endif 597 606 598 - return 1; 607 + return 0; 599 608 600 609 give_sigsegv: 601 610 force_sigsegv(sig, current); 602 - return 0; 611 + return -EFAULT; 603 612 }
+7 -2
arch/x86_64/ia32/ia32entry.S
··· 71 71 */ 72 72 ENTRY(ia32_sysenter_target) 73 73 CFI_STARTPROC32 simple 74 + CFI_SIGNAL_FRAME 74 75 CFI_DEF_CFA rsp,0 75 76 CFI_REGISTER rsp,rbp 76 77 swapgs ··· 187 186 */ 188 187 ENTRY(ia32_cstar_target) 189 188 CFI_STARTPROC32 simple 189 + CFI_SIGNAL_FRAME 190 190 CFI_DEF_CFA rsp,PDA_STACKOFFSET 191 191 CFI_REGISTER rip,rcx 192 192 /*CFI_REGISTER rflags,r11*/ ··· 295 293 296 294 ENTRY(ia32_syscall) 297 295 CFI_STARTPROC simple 296 + CFI_SIGNAL_FRAME 298 297 CFI_DEF_CFA rsp,SS+8-RIP 299 298 /*CFI_REL_OFFSET ss,SS-RIP*/ 300 299 CFI_REL_OFFSET rsp,RSP-RIP ··· 373 370 popq %r11 374 371 CFI_ENDPROC 375 372 CFI_STARTPROC32 simple 373 + CFI_SIGNAL_FRAME 376 374 CFI_DEF_CFA rsp,SS+8-ARGOFFSET 377 375 CFI_REL_OFFSET rax,RAX-ARGOFFSET 378 376 CFI_REL_OFFSET rcx,RCX-ARGOFFSET ··· 707 703 .quad sys_readlinkat /* 305 */ 708 704 .quad sys_fchmodat 709 705 .quad sys_faccessat 710 - .quad quiet_ni_syscall /* pselect6 for now */ 711 - .quad quiet_ni_syscall /* ppoll for now */ 706 + .quad compat_sys_pselect6 707 + .quad compat_sys_ppoll 712 708 .quad sys_unshare /* 310 */ 713 709 .quad compat_sys_set_robust_list 714 710 .quad compat_sys_get_robust_list ··· 717 713 .quad sys_tee 718 714 .quad compat_sys_vmsplice 719 715 .quad compat_sys_move_pages 716 + .quad sys_getcpu 720 717 ia32_syscall_end:
+8 -2
arch/x86_64/ia32/ptrace32.c
··· 117 117 if ((0x5454 >> ((val >> (16 + 4*i)) & 0xf)) & 1) 118 118 return -EIO; 119 119 child->thread.debugreg7 = val; 120 + if (val) 121 + set_tsk_thread_flag(child, TIF_DEBUG); 122 + else 123 + clear_tsk_thread_flag(child, TIF_DEBUG); 120 124 break; 121 125 122 126 default: ··· 375 371 ret = -EIO; 376 372 if (!access_ok(VERIFY_READ, u, sizeof(*u))) 377 373 break; 378 - /* no checking to be bug-to-bug compatible with i386 */ 379 - __copy_from_user(&child->thread.i387.fxsave, u, sizeof(*u)); 374 + /* no checking to be bug-to-bug compatible with i386. */ 375 + /* but silence warning */ 376 + if (__copy_from_user(&child->thread.i387.fxsave, u, sizeof(*u))) 377 + ; 380 378 set_stopped_child_used_math(child); 381 379 child->thread.i387.fxsave.mxcsr &= mxcsr_feature_mask; 382 380 ret = 0;
+29 -23
arch/x86_64/ia32/sys_ia32.c
··· 60 60 #include <linux/highuid.h> 61 61 #include <linux/vmalloc.h> 62 62 #include <linux/fsnotify.h> 63 + #include <linux/sysctl.h> 63 64 #include <asm/mman.h> 64 65 #include <asm/types.h> 65 66 #include <asm/uaccess.h> ··· 390 389 } 391 390 } 392 391 set_fs (KERNEL_DS); 393 - ret = sys_rt_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL, 392 + ret = sys_rt_sigprocmask(how, 393 + set ? (sigset_t __user *)&s : NULL, 394 + oset ? (sigset_t __user *)&s : NULL, 394 395 sigsetsize); 395 396 set_fs (old_fs); 396 397 if (ret) return ret; ··· 544 541 int bitcount = 0; 545 542 546 543 set_fs (KERNEL_DS); 547 - ret = sys_sysinfo(&s); 544 + ret = sys_sysinfo((struct sysinfo __user *)&s); 548 545 set_fs (old_fs); 549 546 550 547 /* Check to see if any memory value is too large for 32-bit and scale ··· 592 589 mm_segment_t old_fs = get_fs (); 593 590 594 591 set_fs (KERNEL_DS); 595 - ret = sys_sched_rr_get_interval(pid, &t); 592 + ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t); 596 593 set_fs (old_fs); 597 594 if (put_compat_timespec(&t, interval)) 598 595 return -EFAULT; ··· 608 605 mm_segment_t old_fs = get_fs(); 609 606 610 607 set_fs (KERNEL_DS); 611 - ret = sys_rt_sigpending(&s, sigsetsize); 608 + ret = sys_rt_sigpending((sigset_t __user *)&s, sigsetsize); 612 609 set_fs (old_fs); 613 610 if (!ret) { 614 611 switch (_NSIG_WORDS) { ··· 633 630 if (copy_siginfo_from_user32(&info, uinfo)) 634 631 return -EFAULT; 635 632 set_fs (KERNEL_DS); 636 - ret = sys_rt_sigqueueinfo(pid, sig, &info); 633 + ret = sys_rt_sigqueueinfo(pid, sig, (siginfo_t __user *)&info); 637 634 set_fs (old_fs); 638 635 return ret; 639 636 } ··· 669 666 size_t oldlen; 670 667 int __user *namep; 671 668 long ret; 672 - extern int do_sysctl(int *name, int nlen, void *oldval, size_t *oldlenp, 673 - void *newval, size_t newlen); 674 - 675 669 676 670 if (copy_from_user(&a32, args32, sizeof (a32))) 677 671 return -EFAULT; ··· 692 692 693 693 set_fs(KERNEL_DS); 694 694 lock_kernel(); 695 - ret = do_sysctl(namep, a32.nlen, oldvalp, &oldlen, newvalp, (size_t) a32.newlen); 695 + ret = do_sysctl(namep, a32.nlen, oldvalp, (size_t __user *)&oldlen, 696 + newvalp, (size_t) a32.newlen); 696 697 unlock_kernel(); 697 698 set_fs(old_fs); 698 699 ··· 744 743 return -EFAULT; 745 744 746 745 set_fs(KERNEL_DS); 747 - ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count); 746 + ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, 747 + count); 748 748 set_fs(old_fs); 749 749 750 750 if (offset && put_user(of, offset)) ··· 780 778 781 779 asmlinkage long sys32_olduname(struct oldold_utsname __user * name) 782 780 { 783 - int error; 781 + int err; 784 782 785 783 if (!name) 786 784 return -EFAULT; ··· 789 787 790 788 down_read(&uts_sem); 791 789 792 - error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); 793 - __put_user(0,name->sysname+__OLD_UTS_LEN); 794 - __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); 795 - __put_user(0,name->nodename+__OLD_UTS_LEN); 796 - __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); 797 - __put_user(0,name->release+__OLD_UTS_LEN); 798 - __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); 799 - __put_user(0,name->version+__OLD_UTS_LEN); 790 + err = __copy_to_user(&name->sysname,&system_utsname.sysname, 791 + __OLD_UTS_LEN); 792 + err |= __put_user(0,name->sysname+__OLD_UTS_LEN); 793 + err |= __copy_to_user(&name->nodename,&system_utsname.nodename, 794 + __OLD_UTS_LEN); 795 + err |= __put_user(0,name->nodename+__OLD_UTS_LEN); 796 + err |= __copy_to_user(&name->release,&system_utsname.release, 797 + __OLD_UTS_LEN); 798 + err |= __put_user(0,name->release+__OLD_UTS_LEN); 799 + err |= __copy_to_user(&name->version,&system_utsname.version, 800 + __OLD_UTS_LEN); 801 + err |= __put_user(0,name->version+__OLD_UTS_LEN); 800 802 { 801 803 char *arch = "x86_64"; 802 804 if (personality(current->personality) == PER_LINUX32) 803 805 arch = "i686"; 804 806 805 - __copy_to_user(&name->machine,arch,strlen(arch)+1); 807 + err |= __copy_to_user(&name->machine,arch,strlen(arch)+1); 806 808 } 807 809 808 810 up_read(&uts_sem); 809 811 810 - error = error ? -EFAULT : 0; 812 + err = err ? -EFAULT : 0; 811 813 812 - return error; 814 + return err; 813 815 } 814 816 815 817 long sys32_uname(struct old_utsname __user * name) ··· 837 831 838 832 seg = get_fs(); 839 833 set_fs(KERNEL_DS); 840 - ret = sys_ustat(dev,&u); 834 + ret = sys_ustat(dev, (struct ustat __user *)&u); 841 835 set_fs(seg); 842 836 if (ret >= 0) { 843 837 if (!access_ok(VERIFY_WRITE,u32p,sizeof(struct ustat32)) ||
+5 -4
arch/x86_64/kernel/Makefile
··· 11 11 pci-dma.o pci-nommu.o alternative.o 12 12 13 13 obj-$(CONFIG_STACKTRACE) += stacktrace.o 14 - obj-$(CONFIG_X86_MCE) += mce.o 14 + obj-$(CONFIG_X86_MCE) += mce.o therm_throt.o 15 15 obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o 16 16 obj-$(CONFIG_X86_MCE_AMD) += mce_amd.o 17 17 obj-$(CONFIG_MTRR) += ../../i386/kernel/cpu/mtrr/ ··· 20 20 obj-$(CONFIG_MICROCODE) += microcode.o 21 21 obj-$(CONFIG_X86_CPUID) += cpuid.o 22 22 obj-$(CONFIG_SMP) += smp.o smpboot.o trampoline.o 23 - obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o 24 - obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o \ 23 + obj-y += apic.o nmi.o 24 + obj-y += io_apic.o mpparse.o \ 25 25 genapic.o genapic_cluster.o genapic_flat.o 26 26 obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o 27 27 obj-$(CONFIG_CRASH_DUMP) += crash_dump.o ··· 39 39 obj-$(CONFIG_AUDIT) += audit.o 40 40 41 41 obj-$(CONFIG_MODULES) += module.o 42 + obj-$(CONFIG_PCI) += early-quirks.o 42 43 43 44 obj-y += topology.o 44 45 obj-y += intel_cacheinfo.o 45 46 46 47 CFLAGS_vsyscall.o := $(PROFILING) -g0 47 48 49 + therm_throt-y += ../../i386/kernel/cpu/mcheck/therm_throt.o 48 50 bootflag-y += ../../i386/kernel/bootflag.o 49 51 cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o 50 52 topology-y += ../../i386/kernel/topology.o ··· 56 54 i8237-y += ../../i386/kernel/i8237.o 57 55 msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o 58 56 alternative-y += ../../i386/kernel/alternative.o 59 -
+22 -3
arch/x86_64/kernel/aperture.c
··· 17 17 #include <linux/pci_ids.h> 18 18 #include <linux/pci.h> 19 19 #include <linux/bitops.h> 20 + #include <linux/ioport.h> 20 21 #include <asm/e820.h> 21 22 #include <asm/io.h> 22 23 #include <asm/proto.h> ··· 34 33 35 34 int fix_aperture __initdata = 1; 36 35 36 + static struct resource gart_resource = { 37 + .name = "GART", 38 + .flags = IORESOURCE_MEM, 39 + }; 40 + 41 + static void __init insert_aperture_resource(u32 aper_base, u32 aper_size) 42 + { 43 + gart_resource.start = aper_base; 44 + gart_resource.end = aper_base + aper_size - 1; 45 + insert_resource(&iomem_resource, &gart_resource); 46 + } 47 + 37 48 /* This code runs before the PCI subsystem is initialized, so just 38 49 access the northbridge directly. */ 39 50 ··· 61 48 62 49 /* 63 50 * Aperture has to be naturally aligned. This means an 2GB aperture won't 64 - * have much chances to find a place in the lower 4GB of memory. 51 + * have much chance of finding a place in the lower 4GB of memory. 65 52 * Unfortunately we cannot move it up because that would make the 66 53 * IOMMU useless. 67 54 */ ··· 75 62 } 76 63 printk("Mapping aperture over %d KB of RAM @ %lx\n", 77 64 aper_size >> 10, __pa(p)); 65 + insert_aperture_resource((u32)__pa(p), aper_size); 78 66 return (u32)__pa(p); 79 67 } 80 68 ··· 212 198 u64 aper_base, last_aper_base = 0; 213 199 int valid_agp = 0; 214 200 215 - if (iommu_aperture_disabled || !fix_aperture) 201 + if (iommu_aperture_disabled || !fix_aperture || !early_pci_allowed()) 216 202 return; 217 203 218 204 printk("Checking aperture...\n"); ··· 247 233 last_aper_base = aper_base; 248 234 } 249 235 250 - if (!fix && !fallback_aper_force) 236 + if (!fix && !fallback_aper_force) { 237 + if (last_aper_base) { 238 + unsigned long n = (32 * 1024 * 1024) << last_aper_order; 239 + insert_aperture_resource((u32)last_aper_base, n); 240 + } 251 241 return; 242 + } 252 243 253 244 if (!fallback_aper_force) 254 245 aper_alloc = search_agp_bridge(&aper_order, &valid_agp);
+111 -118
arch/x86_64/kernel/apic.c
··· 25 25 #include <linux/kernel_stat.h> 26 26 #include <linux/sysdev.h> 27 27 #include <linux/module.h> 28 + #include <linux/ioport.h> 28 29 29 30 #include <asm/atomic.h> 30 31 #include <asm/smp.h> ··· 37 36 #include <asm/idle.h> 38 37 #include <asm/proto.h> 39 38 #include <asm/timex.h> 39 + #include <asm/apic.h> 40 40 41 + int apic_mapped; 41 42 int apic_verbosity; 42 43 int apic_runs_main_timer; 43 44 int apic_calibrate_pmtmr __initdata; 44 45 45 46 int disable_apic_timer __initdata; 47 + 48 + static struct resource lapic_resource = { 49 + .name = "Local APIC", 50 + .flags = IORESOURCE_MEM | IORESOURCE_BUSY, 51 + }; 46 52 47 53 /* 48 54 * cpu_mask that denotes the CPUs that needs timer interrupt coming in as ··· 144 136 apic_read(APIC_ESR); 145 137 } 146 138 147 - void __init connect_bsp_APIC(void) 148 - { 149 - if (pic_mode) { 150 - /* 151 - * Do not trust the local APIC being empty at bootup. 152 - */ 153 - clear_local_APIC(); 154 - /* 155 - * PIC mode, enable APIC mode in the IMCR, i.e. 156 - * connect BSP's local APIC to INT and NMI lines. 157 - */ 158 - apic_printk(APIC_VERBOSE, "leaving PIC mode, enabling APIC mode.\n"); 159 - outb(0x70, 0x22); 160 - outb(0x01, 0x23); 161 - } 162 - } 163 - 164 139 void disconnect_bsp_APIC(int virt_wire_setup) 165 140 { 166 - if (pic_mode) { 167 - /* 168 - * Put the board back into PIC mode (has an effect 169 - * only on certain older boards). Note that APIC 170 - * interrupts, including IPIs, won't work beyond 171 - * this point! The only exception are INIT IPIs. 172 - */ 173 - apic_printk(APIC_QUIET, "disabling APIC mode, entering PIC mode.\n"); 174 - outb(0x70, 0x22); 175 - outb(0x00, 0x23); 141 + /* Go back to Virtual Wire compatibility mode */ 142 + unsigned long value; 143 + 144 + /* For the spurious interrupt use vector F, and enable it */ 145 + value = apic_read(APIC_SPIV); 146 + value &= ~APIC_VECTOR_MASK; 147 + value |= APIC_SPIV_APIC_ENABLED; 148 + value |= 0xf; 149 + apic_write(APIC_SPIV, value); 150 + 151 + if (!virt_wire_setup) { 152 + /* For LVT0 make it edge triggered, active high, external and enabled */ 153 + value = apic_read(APIC_LVT0); 154 + value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING | 155 + APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | 156 + APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED ); 157 + value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; 158 + value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT); 159 + apic_write(APIC_LVT0, value); 160 + } else { 161 + /* Disable LVT0 */ 162 + apic_write(APIC_LVT0, APIC_LVT_MASKED); 176 163 } 177 - else { 178 - /* Go back to Virtual Wire compatibility mode */ 179 - unsigned long value; 180 164 181 - /* For the spurious interrupt use vector F, and enable it */ 182 - value = apic_read(APIC_SPIV); 183 - value &= ~APIC_VECTOR_MASK; 184 - value |= APIC_SPIV_APIC_ENABLED; 185 - value |= 0xf; 186 - apic_write(APIC_SPIV, value); 187 - 188 - if (!virt_wire_setup) { 189 - /* For LVT0 make it edge triggered, active high, external and enabled */ 190 - value = apic_read(APIC_LVT0); 191 - value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING | 192 - APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | 193 - APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED ); 194 - value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; 195 - value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT); 196 - apic_write(APIC_LVT0, value); 197 - } 198 - else { 199 - /* Disable LVT0 */ 200 - apic_write(APIC_LVT0, APIC_LVT_MASKED); 201 - } 202 - 203 - /* For LVT1 make it edge triggered, active high, nmi and enabled */ 204 - value = apic_read(APIC_LVT1); 205 - value &= ~( 206 - APIC_MODE_MASK | APIC_SEND_PENDING | 165 + /* For LVT1 make it edge triggered, active high, nmi and enabled */ 166 + value = apic_read(APIC_LVT1); 167 + value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING | 207 168 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | 208 169 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED); 209 - value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; 210 - value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI); 211 - apic_write(APIC_LVT1, value); 212 - } 170 + value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; 171 + value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI); 172 + apic_write(APIC_LVT1, value); 213 173 } 214 174 215 175 void disable_local_APIC(void) ··· 273 297 | APIC_DM_INIT); 274 298 } 275 299 276 - extern void __error_in_apic_c (void); 277 - 278 300 /* 279 301 * An initial setup of the virtual wire mode. 280 302 */ ··· 319 345 320 346 value = apic_read(APIC_LVR); 321 347 322 - if ((SPURIOUS_APIC_VECTOR & 0x0f) != 0x0f) 323 - __error_in_apic_c(); 348 + BUILD_BUG_ON((SPURIOUS_APIC_VECTOR & 0x0f) != 0x0f); 324 349 325 350 /* 326 351 * Double-check whether this APIC is really registered. ··· 372 399 */ 373 400 value |= APIC_SPIV_APIC_ENABLED; 374 401 375 - /* 376 - * Some unknown Intel IO/APIC (or APIC) errata is biting us with 377 - * certain networking cards. If high frequency interrupts are 378 - * happening on a particular IOAPIC pin, plus the IOAPIC routing 379 - * entry is masked/unmasked at a high rate as well then sooner or 380 - * later IOAPIC line gets 'stuck', no more interrupts are received 381 - * from the device. If focus CPU is disabled then the hang goes 382 - * away, oh well :-( 383 - * 384 - * [ This bug can be reproduced easily with a level-triggered 385 - * PCI Ne2000 networking cards and PII/PIII processors, dual 386 - * BX chipset. ] 387 - */ 388 - /* 389 - * Actually disabling the focus CPU check just makes the hang less 390 - * frequent as it makes the interrupt distributon model be more 391 - * like LRU than MRU (the short-term load is more even across CPUs). 392 - * See also the comment in end_level_ioapic_irq(). --macro 393 - */ 394 - #if 1 395 - /* Enable focus processor (bit==0) */ 396 - value &= ~APIC_SPIV_FOCUS_DISABLED; 397 - #else 398 - /* Disable focus processor (bit==1) */ 399 - value |= APIC_SPIV_FOCUS_DISABLED; 400 - #endif 402 + /* We always use processor focus */ 403 + 401 404 /* 402 405 * Set spurious IRQ vector 403 406 */ ··· 391 442 * TODO: set up through-local-APIC from through-I/O-APIC? --macro 392 443 */ 393 444 value = apic_read(APIC_LVT0) & APIC_LVT_MASKED; 394 - if (!smp_processor_id() && (pic_mode || !value)) { 445 + if (!smp_processor_id() && !value) { 395 446 value = APIC_DM_EXTINT; 396 447 apic_printk(APIC_VERBOSE, "enabled ExtINT on CPU#%d\n", smp_processor_id()); 397 448 } else { ··· 428 479 } 429 480 430 481 nmi_watchdog_default(); 431 - if (nmi_watchdog == NMI_LOCAL_APIC) 432 - setup_apic_nmi_watchdog(); 482 + setup_apic_nmi_watchdog(NULL); 433 483 apic_pm_activate(); 434 484 } 435 485 ··· 475 527 apic_pm_state.apic_tmict = apic_read(APIC_TMICT); 476 528 apic_pm_state.apic_tdcr = apic_read(APIC_TDCR); 477 529 apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR); 478 - local_save_flags(flags); 479 - local_irq_disable(); 530 + local_irq_save(flags); 480 531 disable_local_APIC(); 481 532 local_irq_restore(flags); 482 533 return 0; ··· 553 606 554 607 static int __init apic_set_verbosity(char *str) 555 608 { 609 + if (str == NULL) { 610 + skip_ioapic_setup = 0; 611 + ioapic_force = 1; 612 + return 0; 613 + } 556 614 if (strcmp("debug", str) == 0) 557 615 apic_verbosity = APIC_DEBUG; 558 616 else if (strcmp("verbose", str) == 0) 559 617 apic_verbosity = APIC_VERBOSE; 560 - else 618 + else { 561 619 printk(KERN_WARNING "APIC Verbosity level %s not recognised" 562 - " use apic=verbose or apic=debug", str); 620 + " use apic=verbose or apic=debug\n", str); 621 + return -EINVAL; 622 + } 563 623 564 - return 1; 624 + return 0; 565 625 } 566 - 567 - __setup("apic=", apic_set_verbosity); 626 + early_param("apic", apic_set_verbosity); 568 627 569 628 /* 570 629 * Detect and enable local APICs on non-SMP boards. ··· 591 638 return 0; 592 639 } 593 640 641 + #ifdef CONFIG_X86_IO_APIC 642 + static struct resource * __init ioapic_setup_resources(void) 643 + { 644 + #define IOAPIC_RESOURCE_NAME_SIZE 11 645 + unsigned long n; 646 + struct resource *res; 647 + char *mem; 648 + int i; 649 + 650 + if (nr_ioapics <= 0) 651 + return NULL; 652 + 653 + n = IOAPIC_RESOURCE_NAME_SIZE + sizeof(struct resource); 654 + n *= nr_ioapics; 655 + 656 + res = alloc_bootmem(n); 657 + 658 + if (!res) 659 + return NULL; 660 + 661 + memset(res, 0, n); 662 + mem = (void *)&res[nr_ioapics]; 663 + 664 + for (i = 0; i < nr_ioapics; i++) { 665 + res[i].name = mem; 666 + res[i].flags = IORESOURCE_MEM | IORESOURCE_BUSY; 667 + snprintf(mem, IOAPIC_RESOURCE_NAME_SIZE, "IOAPIC %u", i); 668 + mem += IOAPIC_RESOURCE_NAME_SIZE; 669 + } 670 + 671 + return res; 672 + } 673 + #endif 674 + 594 675 void __init init_apic_mappings(void) 595 676 { 596 677 unsigned long apic_phys; ··· 641 654 apic_phys = mp_lapic_addr; 642 655 643 656 set_fixmap_nocache(FIX_APIC_BASE, apic_phys); 657 + apic_mapped = 1; 644 658 apic_printk(APIC_VERBOSE,"mapped APIC to %16lx (%16lx)\n", APIC_BASE, apic_phys); 659 + 660 + /* Put local APIC into the resource map. */ 661 + lapic_resource.start = apic_phys; 662 + lapic_resource.end = lapic_resource.start + PAGE_SIZE - 1; 663 + insert_resource(&iomem_resource, &lapic_resource); 645 664 646 665 /* 647 666 * Fetch the APIC ID of the BSP in case we have a ··· 655 662 */ 656 663 boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); 657 664 658 - #ifdef CONFIG_X86_IO_APIC 659 665 { 660 666 unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0; 661 667 int i; 668 + struct resource *ioapic_res; 662 669 670 + ioapic_res = ioapic_setup_resources(); 663 671 for (i = 0; i < nr_ioapics; i++) { 664 672 if (smp_found_config) { 665 673 ioapic_phys = mp_ioapics[i].mpc_apicaddr; ··· 672 678 apic_printk(APIC_VERBOSE,"mapped IOAPIC to %016lx (%016lx)\n", 673 679 __fix_to_virt(idx), ioapic_phys); 674 680 idx++; 681 + 682 + if (ioapic_res) { 683 + ioapic_res->start = ioapic_phys; 684 + ioapic_res->end = ioapic_phys + (4 * 1024) - 1; 685 + insert_resource(&iomem_resource, ioapic_res); 686 + ioapic_res++; 687 + } 675 688 } 676 689 } 677 - #endif 678 690 } 679 691 680 692 /* ··· 951 951 * We take the 'long' return path, and there every subsystem 952 952 * grabs the appropriate locks (kernel lock/ irq lock). 953 953 * 954 - * we might want to decouple profiling from the 'long path', 954 + * We might want to decouple profiling from the 'long path', 955 955 * and do the profiling totally in assembly. 956 956 * 957 957 * Currently this isn't too much of an issue (performance wise), ··· 1123 1123 1124 1124 verify_local_APIC(); 1125 1125 1126 - connect_bsp_APIC(); 1127 - 1128 1126 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id); 1129 1127 apic_write(APIC_ID, SET_APIC_ID(boot_cpu_id)); 1130 1128 1131 1129 setup_local_APIC(); 1132 1130 1133 - #ifdef CONFIG_X86_IO_APIC 1134 1131 if (smp_found_config && !skip_ioapic_setup && nr_ioapics) 1135 - setup_IO_APIC(); 1132 + setup_IO_APIC(); 1136 1133 else 1137 1134 nr_ioapics = 0; 1138 - #endif 1139 1135 setup_boot_APIC_clock(); 1140 1136 check_nmi_watchdog(); 1141 1137 return 0; ··· 1140 1144 static __init int setup_disableapic(char *str) 1141 1145 { 1142 1146 disable_apic = 1; 1143 - return 1; 1144 - } 1147 + clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability); 1148 + return 0; 1149 + } 1150 + early_param("disableapic", setup_disableapic); 1145 1151 1152 + /* same as disableapic, for compatibility */ 1146 1153 static __init int setup_nolapic(char *str) 1147 1154 { 1148 - disable_apic = 1; 1149 - return 1; 1155 + return setup_disableapic(str); 1150 1156 } 1157 + early_param("nolapic", setup_nolapic); 1151 1158 1152 1159 static __init int setup_noapictimer(char *str) 1153 1160 { ··· 1183 1184 } 1184 1185 __setup("apicpmtimer", setup_apicpmtimer); 1185 1186 1186 - /* dummy parsing: see setup.c */ 1187 - 1188 - __setup("disableapic", setup_disableapic); 1189 - __setup("nolapic", setup_nolapic); /* same as disableapic, for compatibility */ 1190 - 1191 1187 __setup("noapictimer", setup_noapictimer); 1192 1188 1193 - /* no "lapic" flag - we only use the lapic when the BIOS tells us so. */
+20 -6
arch/x86_64/kernel/crash.c
··· 23 23 #include <asm/nmi.h> 24 24 #include <asm/hw_irq.h> 25 25 #include <asm/mach_apic.h> 26 + #include <asm/kdebug.h> 26 27 27 28 /* This keeps a track of which one is crashing cpu. */ 28 29 static int crashing_cpu; ··· 69 68 * for the data I pass, and I need tags 70 69 * on the data to indicate what information I have 71 70 * squirrelled away. ELF notes happen to provide 72 - * all of that that no need to invent something new. 71 + * all of that, no need to invent something new. 73 72 */ 74 73 75 74 buf = (u32*)per_cpu_ptr(crash_notes, cpu); ··· 96 95 #ifdef CONFIG_SMP 97 96 static atomic_t waiting_for_crash_ipi; 98 97 99 - static int crash_nmi_callback(struct pt_regs *regs, int cpu) 98 + static int crash_nmi_callback(struct notifier_block *self, 99 + unsigned long val, void *data) 100 100 { 101 + struct pt_regs *regs; 102 + int cpu; 103 + 104 + if (val != DIE_NMI_IPI) 105 + return NOTIFY_OK; 106 + 107 + regs = ((struct die_args *)data)->regs; 108 + cpu = raw_smp_processor_id(); 109 + 101 110 /* 102 111 * Don't do anything if this handler is invoked on crashing cpu. 103 112 * Otherwise, system will completely hang. Crashing cpu can get 104 113 * an NMI if system was initially booted with nmi_watchdog parameter. 105 114 */ 106 115 if (cpu == crashing_cpu) 107 - return 1; 116 + return NOTIFY_STOP; 108 117 local_irq_disable(); 109 118 110 119 crash_save_this_cpu(regs, cpu); ··· 138 127 * cpu hotplug shouldn't matter. 139 128 */ 140 129 130 + static struct notifier_block crash_nmi_nb = { 131 + .notifier_call = crash_nmi_callback, 132 + }; 133 + 141 134 static void nmi_shootdown_cpus(void) 142 135 { 143 136 unsigned long msecs; 144 137 145 138 atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); 146 - set_nmi_callback(crash_nmi_callback); 139 + if (register_die_notifier(&crash_nmi_nb)) 140 + return; /* return what? */ 147 141 148 142 /* 149 143 * Ensure the new callback function is set before sending ··· 194 178 if(cpu_has_apic) 195 179 disable_local_APIC(); 196 180 197 - #if defined(CONFIG_X86_IO_APIC) 198 181 disable_IO_APIC(); 199 - #endif 200 182 201 183 crash_save_self(regs); 202 184 }
+59 -65
arch/x86_64/kernel/e820.c
··· 25 25 #include <asm/bootsetup.h> 26 26 #include <asm/sections.h> 27 27 28 + struct e820map e820 __initdata; 29 + 28 30 /* 29 31 * PFN of last memory page. 30 32 */ ··· 43 41 /* 44 42 * Last pfn which the user wants to use. 45 43 */ 46 - unsigned long end_user_pfn = MAXMEM>>PAGE_SHIFT; 44 + static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT; 47 45 48 46 extern struct resource code_resource, data_resource; 49 47 ··· 72 70 return 1; 73 71 } 74 72 #endif 75 - /* kernel code + 640k memory hole (later should not be needed, but 76 - be paranoid for now) */ 77 - if (last >= 640*1024 && addr < 1024*1024) { 78 - *addrp = 1024*1024; 79 - return 1; 80 - } 73 + /* kernel code */ 81 74 if (last >= __pa_symbol(&_text) && last < __pa_symbol(&_end)) { 82 75 *addrp = __pa_symbol(&_end); 83 76 return 1; ··· 562 565 * If we're lucky and live on a modern system, the setup code 563 566 * will have given us a memory map that we can use to properly 564 567 * set up memory. If we aren't, we'll fake a memory map. 565 - * 566 - * We check to see that the memory map contains at least 2 elements 567 - * before we'll use it, because the detection code in setup.S may 568 - * not be perfect and most every PC known to man has two memory 569 - * regions: one from 0 to 640k, and one from 1mb up. (The IBM 570 - * thinkpad 560x, for example, does not cooperate with the memory 571 - * detection code.) 572 568 */ 573 569 static int __init copy_e820_map(struct e820entry * biosmap, int nr_map) 574 570 { ··· 579 589 if (start > end) 580 590 return -1; 581 591 582 - /* 583 - * Some BIOSes claim RAM in the 640k - 1M region. 584 - * Not right. Fix it up. 585 - * 586 - * This should be removed on Hammer which is supposed to not 587 - * have non e820 covered ISA mappings there, but I had some strange 588 - * problems so it stays for now. -AK 589 - */ 590 - if (type == E820_RAM) { 591 - if (start < 0x100000ULL && end > 0xA0000ULL) { 592 - if (start < 0xA0000ULL) 593 - add_memory_region(start, 0xA0000ULL-start, type); 594 - if (end <= 0x100000ULL) 595 - continue; 596 - start = 0x100000ULL; 597 - size = end - start; 598 - } 599 - } 600 - 601 592 add_memory_region(start, size, type); 602 593 } while (biosmap++,--nr_map); 603 594 return 0; 604 595 } 605 596 597 + void early_panic(char *msg) 598 + { 599 + early_printk(msg); 600 + panic(msg); 601 + } 602 + 606 603 void __init setup_memory_region(void) 607 604 { 608 - char *who = "BIOS-e820"; 609 - 610 605 /* 611 606 * Try to copy the BIOS-supplied E820-map. 612 607 * ··· 599 624 * the next section from 1mb->appropriate_mem_k 600 625 */ 601 626 sanitize_e820_map(E820_MAP, &E820_MAP_NR); 602 - if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { 603 - unsigned long mem_size; 604 - 605 - /* compare results from other methods and take the greater */ 606 - if (ALT_MEM_K < EXT_MEM_K) { 607 - mem_size = EXT_MEM_K; 608 - who = "BIOS-88"; 609 - } else { 610 - mem_size = ALT_MEM_K; 611 - who = "BIOS-e801"; 612 - } 613 - 614 - e820.nr_map = 0; 615 - add_memory_region(0, LOWMEMSIZE(), E820_RAM); 616 - add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM); 617 - } 627 + if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) 628 + early_panic("Cannot find a valid memory map"); 618 629 printk(KERN_INFO "BIOS-provided physical RAM map:\n"); 619 - e820_print_map(who); 630 + e820_print_map("BIOS-e820"); 620 631 } 621 632 622 - void __init parse_memopt(char *p, char **from) 623 - { 624 - end_user_pfn = memparse(p, from); 625 - end_user_pfn >>= PAGE_SHIFT; 626 - } 627 - 628 - void __init parse_memmapopt(char *p, char **from) 633 + static int __init parse_memopt(char *p) 629 634 { 635 + if (!p) 636 + return -EINVAL; 637 + end_user_pfn = memparse(p, &p); 638 + end_user_pfn >>= PAGE_SHIFT; 639 + return 0; 640 + } 641 + early_param("mem", parse_memopt); 642 + 643 + static int userdef __initdata; 644 + 645 + static int __init parse_memmap_opt(char *p) 646 + { 647 + char *oldp; 630 648 unsigned long long start_at, mem_size; 631 649 632 - mem_size = memparse(p, from); 633 - p = *from; 650 + if (!strcmp(p, "exactmap")) { 651 + #ifdef CONFIG_CRASH_DUMP 652 + /* If we are doing a crash dump, we 653 + * still need to know the real mem 654 + * size before original memory map is 655 + * reset. 656 + */ 657 + saved_max_pfn = e820_end_of_ram(); 658 + #endif 659 + end_pfn_map = 0; 660 + e820.nr_map = 0; 661 + userdef = 1; 662 + return 0; 663 + } 664 + 665 + oldp = p; 666 + mem_size = memparse(p, &p); 667 + if (p == oldp) 668 + return -EINVAL; 634 669 if (*p == '@') { 635 - start_at = memparse(p+1, from); 670 + start_at = memparse(p+1, &p); 636 671 add_memory_region(start_at, mem_size, E820_RAM); 637 672 } else if (*p == '#') { 638 - start_at = memparse(p+1, from); 673 + start_at = memparse(p+1, &p); 639 674 add_memory_region(start_at, mem_size, E820_ACPI); 640 675 } else if (*p == '$') { 641 - start_at = memparse(p+1, from); 676 + start_at = memparse(p+1, &p); 642 677 add_memory_region(start_at, mem_size, E820_RESERVED); 643 678 } else { 644 679 end_user_pfn = (mem_size >> PAGE_SHIFT); 645 680 } 646 - p = *from; 681 + return *p == '\0' ? 0 : -EINVAL; 682 + } 683 + early_param("memmap", parse_memmap_opt); 684 + 685 + void finish_e820_parsing(void) 686 + { 687 + if (userdef) { 688 + printk(KERN_INFO "user-defined physical RAM map:\n"); 689 + e820_print_map("user"); 690 + } 647 691 } 648 692 649 693 unsigned long pci_mem_start = 0xaeedbabe;
+122
arch/x86_64/kernel/early-quirks.c
··· 1 + /* Various workarounds for chipset bugs. 2 + This code runs very early and can't use the regular PCI subsystem 3 + The entries are keyed to PCI bridges which usually identify chipsets 4 + uniquely. 5 + This is only for whole classes of chipsets with specific problems which 6 + need early invasive action (e.g. before the timers are initialized). 7 + Most PCI device specific workarounds can be done later and should be 8 + in standard PCI quirks 9 + Mainboard specific bugs should be handled by DMI entries. 10 + CPU specific bugs in setup.c */ 11 + 12 + #include <linux/pci.h> 13 + #include <linux/acpi.h> 14 + #include <linux/pci_ids.h> 15 + #include <asm/pci-direct.h> 16 + #include <asm/proto.h> 17 + #include <asm/dma.h> 18 + 19 + static void via_bugs(void) 20 + { 21 + #ifdef CONFIG_IOMMU 22 + if ((end_pfn > MAX_DMA32_PFN || force_iommu) && 23 + !iommu_aperture_allowed) { 24 + printk(KERN_INFO 25 + "Looks like a VIA chipset. Disabling IOMMU. Override with iommu=allowed\n"); 26 + iommu_aperture_disabled = 1; 27 + } 28 + #endif 29 + } 30 + 31 + #ifdef CONFIG_ACPI 32 + 33 + static int nvidia_hpet_detected __initdata; 34 + 35 + static int __init nvidia_hpet_check(unsigned long phys, unsigned long size) 36 + { 37 + nvidia_hpet_detected = 1; 38 + return 0; 39 + } 40 + #endif 41 + 42 + static void nvidia_bugs(void) 43 + { 44 + #ifdef CONFIG_ACPI 45 + /* 46 + * All timer overrides on Nvidia are 47 + * wrong unless HPET is enabled. 48 + */ 49 + nvidia_hpet_detected = 0; 50 + acpi_table_parse(ACPI_HPET, nvidia_hpet_check); 51 + if (nvidia_hpet_detected == 0) { 52 + acpi_skip_timer_override = 1; 53 + printk(KERN_INFO "Nvidia board " 54 + "detected. Ignoring ACPI " 55 + "timer override.\n"); 56 + } 57 + #endif 58 + /* RED-PEN skip them on mptables too? */ 59 + 60 + } 61 + 62 + static void ati_bugs(void) 63 + { 64 + #if 1 /* for testing */ 65 + printk("ATI board detected\n"); 66 + #endif 67 + /* No bugs right now */ 68 + } 69 + 70 + struct chipset { 71 + u16 vendor; 72 + void (*f)(void); 73 + }; 74 + 75 + static struct chipset early_qrk[] = { 76 + { PCI_VENDOR_ID_NVIDIA, nvidia_bugs }, 77 + { PCI_VENDOR_ID_VIA, via_bugs }, 78 + { PCI_VENDOR_ID_ATI, ati_bugs }, 79 + {} 80 + }; 81 + 82 + void __init early_quirks(void) 83 + { 84 + int num, slot, func; 85 + 86 + if (!early_pci_allowed()) 87 + return; 88 + 89 + /* Poor man's PCI discovery */ 90 + for (num = 0; num < 32; num++) { 91 + for (slot = 0; slot < 32; slot++) { 92 + for (func = 0; func < 8; func++) { 93 + u32 class; 94 + u32 vendor; 95 + u8 type; 96 + int i; 97 + class = read_pci_config(num,slot,func, 98 + PCI_CLASS_REVISION); 99 + if (class == 0xffffffff) 100 + break; 101 + 102 + if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) 103 + continue; 104 + 105 + vendor = read_pci_config(num, slot, func, 106 + PCI_VENDOR_ID); 107 + vendor &= 0xffff; 108 + 109 + for (i = 0; early_qrk[i].f; i++) 110 + if (early_qrk[i].vendor == vendor) { 111 + early_qrk[i].f(); 112 + return; 113 + } 114 + 115 + type = read_pci_config_byte(num, slot, func, 116 + PCI_HEADER_TYPE); 117 + if (!(type & 0x80)) 118 + break; 119 + } 120 + } 121 + } 122 + }
+8 -12
arch/x86_64/kernel/early_printk.c
··· 215 215 216 216 static int __initdata keep_early; 217 217 218 - int __init setup_early_printk(char *opt) 218 + static int __init setup_early_printk(char *buf) 219 219 { 220 - char *space; 221 - char buf[256]; 220 + if (!buf) 221 + return 0; 222 222 223 223 if (early_console_initialized) 224 - return 1; 224 + return 0; 225 + early_console_initialized = 1; 225 226 226 - strlcpy(buf,opt,sizeof(buf)); 227 - space = strchr(buf, ' '); 228 - if (space) 229 - *space = 0; 230 - 231 - if (strstr(buf,"keep")) 227 + if (!strcmp(buf,"keep")) 232 228 keep_early = 1; 233 229 234 230 if (!strncmp(buf, "serial", 6)) { ··· 244 248 early_console = &simnow_console; 245 249 keep_early = 1; 246 250 } 247 - early_console_initialized = 1; 248 251 register_console(early_console); 249 252 return 0; 250 253 } 254 + 255 + early_param("earlyprintk", setup_early_printk); 251 256 252 257 void __init disable_early_printk(void) 253 258 { ··· 263 266 } 264 267 } 265 268 266 - __setup("earlyprintk=", setup_early_printk);
+39 -24
arch/x86_64/kernel/entry.S
··· 4 4 * Copyright (C) 1991, 1992 Linus Torvalds 5 5 * Copyright (C) 2000, 2001, 2002 Andi Kleen SuSE Labs 6 6 * Copyright (C) 2000 Pavel Machek <pavel@suse.cz> 7 - * 8 - * $Id$ 9 7 */ 10 8 11 9 /* ··· 20 22 * at the top of the kernel process stack. 21 23 * - partial stack frame: partially saved registers upto R11. 22 24 * - full stack frame: Like partial stack frame, but all register saved. 23 - * 24 - * TODO: 25 - * - schedule it carefully for the final hardware. 25 + * 26 + * Some macro usage: 27 + * - CFI macros are used to generate dwarf2 unwind information for better 28 + * backtraces. They don't change any code. 29 + * - SAVE_ALL/RESTORE_ALL - Save/restore all registers 30 + * - SAVE_ARGS/RESTORE_ARGS - Save/restore registers that C functions modify. 31 + * There are unfortunately lots of special cases where some registers 32 + * not touched. The macro is a big mess that should be cleaned up. 33 + * - SAVE_REST/RESTORE_REST - Handle the registers not saved by SAVE_ARGS. 34 + * Gives a full stack frame. 35 + * - ENTRY/END Define functions in the symbol table. 36 + * - FIXUP_TOP_OF_STACK/RESTORE_TOP_OF_STACK - Fix up the hardware stack 37 + * frame that is otherwise undefined after a SYSCALL 38 + * - TRACE_IRQ_* - Trace hard interrupt state for lock debugging. 39 + * - errorentry/paranoidentry/zeroentry - Define exception entry points. 26 40 */ 27 41 28 - #define ASSEMBLY 1 29 42 #include <linux/linkage.h> 30 43 #include <asm/segment.h> 31 - #include <asm/smp.h> 32 44 #include <asm/cache.h> 33 45 #include <asm/errno.h> 34 46 #include <asm/dwarf2.h> ··· 123 115 .macro CFI_DEFAULT_STACK start=1 124 116 .if \start 125 117 CFI_STARTPROC simple 118 + CFI_SIGNAL_FRAME 126 119 CFI_DEF_CFA rsp,SS+8 127 120 .else 128 121 CFI_DEF_CFA_OFFSET SS+8 ··· 155 146 /* rdi: prev */ 156 147 ENTRY(ret_from_fork) 157 148 CFI_DEFAULT_STACK 149 + push kernel_eflags(%rip) 150 + CFI_ADJUST_CFA_OFFSET 4 151 + popf # reset kernel eflags 152 + CFI_ADJUST_CFA_OFFSET -4 158 153 call schedule_tail 159 154 GET_THREAD_INFO(%rcx) 160 155 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),threadinfo_flags(%rcx) ··· 212 199 213 200 ENTRY(system_call) 214 201 CFI_STARTPROC simple 202 + CFI_SIGNAL_FRAME 215 203 CFI_DEF_CFA rsp,PDA_STACKOFFSET 216 204 CFI_REGISTER rip,rcx 217 205 /*CFI_REGISTER rflags,r11*/ ··· 330 316 */ 331 317 ENTRY(int_ret_from_sys_call) 332 318 CFI_STARTPROC simple 319 + CFI_SIGNAL_FRAME 333 320 CFI_DEF_CFA rsp,SS+8-ARGOFFSET 334 321 /*CFI_REL_OFFSET ss,SS-ARGOFFSET*/ 335 322 CFI_REL_OFFSET rsp,RSP-ARGOFFSET ··· 491 476 */ 492 477 .macro _frame ref 493 478 CFI_STARTPROC simple 479 + CFI_SIGNAL_FRAME 494 480 CFI_DEF_CFA rsp,SS+8-\ref 495 481 /*CFI_REL_OFFSET ss,SS-\ref*/ 496 482 CFI_REL_OFFSET rsp,RSP-\ref ··· 527 511 testl $3,CS(%rdi) 528 512 je 1f 529 513 swapgs 530 - 1: incl %gs:pda_irqcount # RED-PEN should check preempt count 514 + /* irqcount is used to check if a CPU is already on an interrupt 515 + stack or not. While this is essentially redundant with preempt_count 516 + it is a little cheaper to use a separate counter in the PDA 517 + (short of moving irq_enter into assembly, which would be too 518 + much work) */ 519 + 1: incl %gs:pda_irqcount 531 520 cmoveq %gs:pda_irqstackptr,%rsp 532 521 push %rbp # backlink for old unwinder 533 522 /* ··· 640 619 #ifdef CONFIG_PREEMPT 641 620 /* Returning to kernel space. Check if we need preemption */ 642 621 /* rcx: threadinfo. interrupts off. */ 643 - .p2align 644 - retint_kernel: 622 + ENTRY(retint_kernel) 645 623 cmpl $0,threadinfo_preempt_count(%rcx) 646 624 jnz retint_restore_args 647 625 bt $TIF_NEED_RESCHED,threadinfo_flags(%rcx) ··· 699 679 END(call_function_interrupt) 700 680 #endif 701 681 702 - #ifdef CONFIG_X86_LOCAL_APIC 703 682 ENTRY(apic_timer_interrupt) 704 683 apicinterrupt LOCAL_TIMER_VECTOR,smp_apic_timer_interrupt 705 684 END(apic_timer_interrupt) ··· 710 691 ENTRY(spurious_interrupt) 711 692 apicinterrupt SPURIOUS_APIC_VECTOR,smp_spurious_interrupt 712 693 END(spurious_interrupt) 713 - #endif 714 694 715 695 /* 716 696 * Exception entry points. ··· 786 768 testl $3,CS(%rsp) 787 769 jnz paranoid_userspace\trace 788 770 paranoid_swapgs\trace: 771 + .if \trace 789 772 TRACE_IRQS_IRETQ 0 773 + .endif 790 774 swapgs 791 775 paranoid_restore\trace: 792 776 RESTORE_ALL 8 ··· 834 814 * Exception entry point. This expects an error code/orig_rax on the stack 835 815 * and the exception handler in %rax. 836 816 */ 837 - ENTRY(error_entry) 817 + KPROBE_ENTRY(error_entry) 838 818 _frame RDI 839 819 /* rdi slot contains rax, oldrax contains error code */ 840 820 cld ··· 918 898 cmpq $gs_change,RIP(%rsp) 919 899 je error_swapgs 920 900 jmp error_sti 921 - END(error_entry) 901 + KPROBE_END(error_entry) 922 902 923 903 /* Reload gs selector with exception handling */ 924 904 /* edi: new selector */ ··· 1040 1020 1041 1021 KPROBE_ENTRY(page_fault) 1042 1022 errorentry do_page_fault 1043 - END(page_fault) 1044 - .previous .text 1023 + KPROBE_END(page_fault) 1045 1024 1046 1025 ENTRY(coprocessor_error) 1047 1026 zeroentry do_coprocessor_error ··· 1061 1042 CFI_ADJUST_CFA_OFFSET 8 1062 1043 paranoidentry do_debug, DEBUG_STACK 1063 1044 paranoidexit 1064 - END(debug) 1065 - .previous .text 1045 + KPROBE_END(debug) 1066 1046 1067 1047 /* runs on exception stack */ 1068 1048 KPROBE_ENTRY(nmi) ··· 1075 1057 jmp paranoid_exit1 1076 1058 CFI_ENDPROC 1077 1059 #endif 1078 - END(nmi) 1079 - .previous .text 1060 + KPROBE_END(nmi) 1080 1061 1081 1062 KPROBE_ENTRY(int3) 1082 1063 INTR_FRAME ··· 1084 1067 paranoidentry do_int3, DEBUG_STACK 1085 1068 jmp paranoid_exit1 1086 1069 CFI_ENDPROC 1087 - END(int3) 1088 - .previous .text 1070 + KPROBE_END(int3) 1089 1071 1090 1072 ENTRY(overflow) 1091 1073 zeroentry do_overflow ··· 1132 1116 1133 1117 KPROBE_ENTRY(general_protection) 1134 1118 errorentry do_general_protection 1135 - END(general_protection) 1136 - .previous .text 1119 + KPROBE_END(general_protection) 1137 1120 1138 1121 ENTRY(alignment_check) 1139 1122 errorentry do_alignment_check
-1
arch/x86_64/kernel/genapic_cluster.c
··· 118 118 .name = "clustered", 119 119 .int_delivery_mode = dest_Fixed, 120 120 .int_dest_mode = (APIC_DEST_PHYSICAL != 0), 121 - .int_delivery_dest = APIC_DEST_PHYSICAL | APIC_DM_FIXED, 122 121 .target_cpus = cluster_target_cpus, 123 122 .apic_id_registered = cluster_apic_id_registered, 124 123 .init_apic_ldr = cluster_init_apic_ldr,
+1 -4
arch/x86_64/kernel/genapic_flat.c
··· 49 49 unsigned long cfg; 50 50 unsigned long flags; 51 51 52 - local_save_flags(flags); 53 - local_irq_disable(); 52 + local_irq_save(flags); 54 53 55 54 /* 56 55 * Wait for idle. ··· 120 121 .name = "flat", 121 122 .int_delivery_mode = dest_LowestPrio, 122 123 .int_dest_mode = (APIC_DEST_LOGICAL != 0), 123 - .int_delivery_dest = APIC_DEST_LOGICAL | APIC_DM_LOWEST, 124 124 .target_cpus = flat_target_cpus, 125 125 .apic_id_registered = flat_apic_id_registered, 126 126 .init_apic_ldr = flat_init_apic_ldr, ··· 178 180 .name = "physical flat", 179 181 .int_delivery_mode = dest_Fixed, 180 182 .int_dest_mode = (APIC_DEST_PHYSICAL != 0), 181 - .int_delivery_dest = APIC_DEST_PHYSICAL | APIC_DM_FIXED, 182 183 .target_cpus = physflat_target_cpus, 183 184 .apic_id_registered = flat_apic_id_registered, 184 185 .init_apic_ldr = flat_init_apic_ldr,/*not needed, but shouldn't hurt*/
+8 -7
arch/x86_64/kernel/head.S
··· 5 5 * Copyright (C) 2000 Pavel Machek <pavel@suse.cz> 6 6 * Copyright (C) 2000 Karsten Keil <kkeil@suse.de> 7 7 * Copyright (C) 2001,2002 Andi Kleen <ak@suse.de> 8 - * 9 - * $Id: head.S,v 1.49 2002/03/19 17:39:25 ak Exp $ 10 8 */ 11 9 12 10 ··· 185 187 186 188 /* Finally jump to run C code and to be on real kernel address 187 189 * Since we are running on identity-mapped space we have to jump 188 - * to the full 64bit address , this is only possible as indirect 189 - * jump 190 + * to the full 64bit address, this is only possible as indirect 191 + * jump. In addition we need to ensure %cs is set so we make this 192 + * a far return. 190 193 */ 191 194 movq initial_code(%rip),%rax 192 - pushq $0 # fake return address 193 - jmp *%rax 195 + pushq $0 # fake return address to stop unwinder 196 + pushq $__KERNEL_CS # set correct cs 197 + pushq %rax # target address in negative space 198 + lretq 194 199 195 200 /* SMP bootup changes these two */ 196 201 .align 8 ··· 372 371 .quad 0,0 /* TSS */ 373 372 .quad 0,0 /* LDT */ 374 373 .quad 0,0,0 /* three TLS descriptors */ 375 - .quad 0 /* unused */ 374 + .quad 0x0000f40000000000 /* node/CPU stored in limit */ 376 375 gdt_end: 377 376 /* asm/segment.h:GDT_ENTRIES must match this */ 378 377 /* This should be a multiple of the cache line size */
+1 -43
arch/x86_64/kernel/head64.c
··· 45 45 new_data = *(int *) (x86_boot_params + NEW_CL_POINTER); 46 46 if (!new_data) { 47 47 if (OLD_CL_MAGIC != * (u16 *) OLD_CL_MAGIC_ADDR) { 48 - printk("so old bootloader that it does not support commandline?!\n"); 49 48 return; 50 49 } 51 50 new_data = OLD_CL_BASE_ADDR + * (u16 *) OLD_CL_OFFSET; 52 - printk("old bootloader convention, maybe loadlin?\n"); 53 51 } 54 52 command_line = (char *) ((u64)(new_data)); 55 53 memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE); 56 - printk("Bootdata ok (command line is %s)\n", saved_command_line); 57 - } 58 - 59 - static void __init setup_boot_cpu_data(void) 60 - { 61 - unsigned int dummy, eax; 62 - 63 - /* get vendor info */ 64 - cpuid(0, (unsigned int *)&boot_cpu_data.cpuid_level, 65 - (unsigned int *)&boot_cpu_data.x86_vendor_id[0], 66 - (unsigned int *)&boot_cpu_data.x86_vendor_id[8], 67 - (unsigned int *)&boot_cpu_data.x86_vendor_id[4]); 68 - 69 - /* get cpu type */ 70 - cpuid(1, &eax, &dummy, &dummy, 71 - (unsigned int *) &boot_cpu_data.x86_capability); 72 - boot_cpu_data.x86 = (eax >> 8) & 0xf; 73 - boot_cpu_data.x86_model = (eax >> 4) & 0xf; 74 - boot_cpu_data.x86_mask = eax & 0xf; 75 54 } 76 55 77 56 void __init x86_64_start_kernel(char * real_mode_data) 78 57 { 79 - char *s; 80 58 int i; 81 59 82 60 for (i = 0; i < 256; i++) ··· 62 84 asm volatile("lidt %0" :: "m" (idt_descr)); 63 85 clear_bss(); 64 86 65 - /* 66 - * This must be called really, really early: 67 - */ 68 - lockdep_init(); 87 + early_printk("Kernel alive\n"); 69 88 70 89 /* 71 90 * switch to init_level4_pgt from boot_level4_pgt ··· 78 103 #ifdef CONFIG_SMP 79 104 cpu_set(0, cpu_online_map); 80 105 #endif 81 - s = strstr(saved_command_line, "earlyprintk="); 82 - if (s != NULL) 83 - setup_early_printk(strchr(s, '=') + 1); 84 - #ifdef CONFIG_NUMA 85 - s = strstr(saved_command_line, "numa="); 86 - if (s != NULL) 87 - numa_setup(s+5); 88 - #endif 89 - #ifdef CONFIG_X86_IO_APIC 90 - if (strstr(saved_command_line, "disableapic")) 91 - disable_apic = 1; 92 - #endif 93 - /* You need early console to see that */ 94 - if (__pa_symbol(&_end) >= KERNEL_TEXT_SIZE) 95 - panic("Kernel too big for kernel mapping\n"); 96 - 97 - setup_boot_cpu_data(); 98 106 start_kernel(); 99 107 }
+5 -10
arch/x86_64/kernel/i8259.c
··· 55 55 */ 56 56 BUILD_16_IRQS(0x0) 57 57 58 - #ifdef CONFIG_X86_LOCAL_APIC 59 58 /* 60 59 * The IO-APIC gives us many more interrupt sources. Most of these 61 60 * are unused but an SMP system is supposed to have enough memory ... ··· 72 73 73 74 #ifdef CONFIG_PCI_MSI 74 75 BUILD_15_IRQS(0xe) 75 - #endif 76 - 77 76 #endif 78 77 79 78 #undef BUILD_16_IRQS ··· 97 100 void (*interrupt[NR_IRQS])(void) = { 98 101 IRQLIST_16(0x0), 99 102 100 - #ifdef CONFIG_X86_IO_APIC 101 103 IRQLIST_16(0x1), IRQLIST_16(0x2), IRQLIST_16(0x3), 102 104 IRQLIST_16(0x4), IRQLIST_16(0x5), IRQLIST_16(0x6), IRQLIST_16(0x7), 103 105 IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb), ··· 106 110 , IRQLIST_15(0xe) 107 111 #endif 108 112 109 - #endif 110 113 }; 111 114 112 115 #undef IRQ ··· 122 127 */ 123 128 124 129 DEFINE_SPINLOCK(i8259A_lock); 130 + 131 + static int i8259A_auto_eoi; 125 132 126 133 static void end_8259A_irq (unsigned int irq) 127 134 { ··· 338 341 { 339 342 unsigned long flags; 340 343 344 + i8259A_auto_eoi = auto_eoi; 345 + 341 346 spin_lock_irqsave(&i8259A_lock, flags); 342 347 343 348 outb(0xff, 0x21); /* mask all of 8259A-1 */ ··· 398 399 399 400 static int i8259A_resume(struct sys_device *dev) 400 401 { 401 - init_8259A(0); 402 + init_8259A(i8259A_auto_eoi); 402 403 restore_ELCR(irq_trigger); 403 404 return 0; 404 405 } ··· 452 453 { 453 454 int i; 454 455 455 - #ifdef CONFIG_X86_LOCAL_APIC 456 456 init_bsp_APIC(); 457 - #endif 458 457 init_8259A(0); 459 458 460 459 for (i = 0; i < NR_IRQS; i++) { ··· 578 581 set_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt); 579 582 set_intr_gate(THRESHOLD_APIC_VECTOR, threshold_interrupt); 580 583 581 - #ifdef CONFIG_X86_LOCAL_APIC 582 584 /* self generated IPI for local APIC timer */ 583 585 set_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt); 584 586 585 587 /* IPI vectors for APIC spurious and error interrupts */ 586 588 set_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt); 587 589 set_intr_gate(ERROR_APIC_VECTOR, error_interrupt); 588 - #endif 589 590 590 591 /* 591 592 * Set the clock to HZ Hz, we already have a valid
+70 -412
arch/x86_64/kernel/io_apic.c
··· 48 48 49 49 static int no_timer_check; 50 50 51 - int disable_timer_pin_1 __initdata; 51 + static int disable_timer_pin_1 __initdata; 52 52 53 53 int timer_over_8254 __initdata = 0; 54 54 ··· 109 109 entry = irq_2_pin + entry->next; \ 110 110 } \ 111 111 FINAL; \ 112 + } 113 + 114 + union entry_union { 115 + struct { u32 w1, w2; }; 116 + struct IO_APIC_route_entry entry; 117 + }; 118 + 119 + static struct IO_APIC_route_entry ioapic_read_entry(int apic, int pin) 120 + { 121 + union entry_union eu; 122 + unsigned long flags; 123 + spin_lock_irqsave(&ioapic_lock, flags); 124 + eu.w1 = io_apic_read(apic, 0x10 + 2 * pin); 125 + eu.w2 = io_apic_read(apic, 0x11 + 2 * pin); 126 + spin_unlock_irqrestore(&ioapic_lock, flags); 127 + return eu.entry; 128 + } 129 + 130 + static void ioapic_write_entry(int apic, int pin, struct IO_APIC_route_entry e) 131 + { 132 + unsigned long flags; 133 + union entry_union eu; 134 + eu.entry = e; 135 + spin_lock_irqsave(&ioapic_lock, flags); 136 + io_apic_write(apic, 0x10 + 2*pin, eu.w1); 137 + io_apic_write(apic, 0x11 + 2*pin, eu.w2); 138 + spin_unlock_irqrestore(&ioapic_lock, flags); 112 139 } 113 140 114 141 #ifdef CONFIG_SMP ··· 223 196 static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin) 224 197 { 225 198 struct IO_APIC_route_entry entry; 226 - unsigned long flags; 227 199 228 200 /* Check delivery_mode to be sure we're not clearing an SMI pin */ 229 - spin_lock_irqsave(&ioapic_lock, flags); 230 - *(((int*)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin); 231 - *(((int*)&entry) + 1) = io_apic_read(apic, 0x11 + 2 * pin); 232 - spin_unlock_irqrestore(&ioapic_lock, flags); 201 + entry = ioapic_read_entry(apic, pin); 233 202 if (entry.delivery_mode == dest_SMI) 234 203 return; 235 204 /* ··· 233 210 */ 234 211 memset(&entry, 0, sizeof(entry)); 235 212 entry.mask = 1; 236 - spin_lock_irqsave(&ioapic_lock, flags); 237 - io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry) + 0)); 238 - io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry) + 1)); 239 - spin_unlock_irqrestore(&ioapic_lock, flags); 213 + ioapic_write_entry(apic, pin, entry); 240 214 } 241 215 242 216 static void clear_IO_APIC (void) ··· 245 225 clear_IO_APIC_pin(apic, pin); 246 226 } 247 227 248 - /* 249 - * support for broken MP BIOSs, enables hand-redirection of PIRQ0-7 to 250 - * specific CPU-side IRQs. 251 - */ 252 - 253 - #define MAX_PIRQS 8 254 - static int pirq_entries [MAX_PIRQS]; 255 - static int pirqs_enabled; 256 228 int skip_ioapic_setup; 257 229 int ioapic_force; 258 230 ··· 253 241 static int __init disable_ioapic_setup(char *str) 254 242 { 255 243 skip_ioapic_setup = 1; 256 - return 1; 244 + return 0; 257 245 } 246 + early_param("noapic", disable_ioapic_setup); 258 247 259 - static int __init enable_ioapic_setup(char *str) 248 + /* Actually the next is obsolete, but keep it for paranoid reasons -AK */ 249 + static int __init disable_timer_pin_setup(char *arg) 260 250 { 261 - ioapic_force = 1; 262 - skip_ioapic_setup = 0; 251 + disable_timer_pin_1 = 1; 263 252 return 1; 264 253 } 265 - 266 - __setup("noapic", disable_ioapic_setup); 267 - __setup("apic", enable_ioapic_setup); 254 + __setup("disable_timer_pin_1", disable_timer_pin_setup); 268 255 269 256 static int __init setup_disable_8254_timer(char *s) 270 257 { ··· 279 268 __setup("disable_8254_timer", setup_disable_8254_timer); 280 269 __setup("enable_8254_timer", setup_enable_8254_timer); 281 270 282 - #include <asm/pci-direct.h> 283 - #include <linux/pci_ids.h> 284 - #include <linux/pci.h> 285 - 286 - 287 - #ifdef CONFIG_ACPI 288 - 289 - static int nvidia_hpet_detected __initdata; 290 - 291 - static int __init nvidia_hpet_check(unsigned long phys, unsigned long size) 292 - { 293 - nvidia_hpet_detected = 1; 294 - return 0; 295 - } 296 - #endif 297 - 298 - /* Temporary Hack. Nvidia and VIA boards currently only work with IO-APIC 299 - off. Check for an Nvidia or VIA PCI bridge and turn it off. 300 - Use pci direct infrastructure because this runs before the PCI subsystem. 301 - 302 - Can be overwritten with "apic" 303 - 304 - And another hack to disable the IOMMU on VIA chipsets. 305 - 306 - ... and others. Really should move this somewhere else. 307 - 308 - Kludge-O-Rama. */ 309 - void __init check_ioapic(void) 310 - { 311 - int num,slot,func; 312 - /* Poor man's PCI discovery */ 313 - for (num = 0; num < 32; num++) { 314 - for (slot = 0; slot < 32; slot++) { 315 - for (func = 0; func < 8; func++) { 316 - u32 class; 317 - u32 vendor; 318 - u8 type; 319 - class = read_pci_config(num,slot,func, 320 - PCI_CLASS_REVISION); 321 - if (class == 0xffffffff) 322 - break; 323 - 324 - if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) 325 - continue; 326 - 327 - vendor = read_pci_config(num, slot, func, 328 - PCI_VENDOR_ID); 329 - vendor &= 0xffff; 330 - switch (vendor) { 331 - case PCI_VENDOR_ID_VIA: 332 - #ifdef CONFIG_IOMMU 333 - if ((end_pfn > MAX_DMA32_PFN || 334 - force_iommu) && 335 - !iommu_aperture_allowed) { 336 - printk(KERN_INFO 337 - "Looks like a VIA chipset. Disabling IOMMU. Override with \"iommu=allowed\"\n"); 338 - iommu_aperture_disabled = 1; 339 - } 340 - #endif 341 - return; 342 - case PCI_VENDOR_ID_NVIDIA: 343 - #ifdef CONFIG_ACPI 344 - /* 345 - * All timer overrides on Nvidia are 346 - * wrong unless HPET is enabled. 347 - */ 348 - nvidia_hpet_detected = 0; 349 - acpi_table_parse(ACPI_HPET, 350 - nvidia_hpet_check); 351 - if (nvidia_hpet_detected == 0) { 352 - acpi_skip_timer_override = 1; 353 - printk(KERN_INFO "Nvidia board " 354 - "detected. Ignoring ACPI " 355 - "timer override.\n"); 356 - } 357 - #endif 358 - /* RED-PEN skip them on mptables too? */ 359 - return; 360 - 361 - /* This should be actually default, but 362 - for 2.6.16 let's do it for ATI only where 363 - it's really needed. */ 364 - case PCI_VENDOR_ID_ATI: 365 - if (timer_over_8254 == 1) { 366 - timer_over_8254 = 0; 367 - printk(KERN_INFO 368 - "ATI board detected. Disabling timer routing over 8254.\n"); 369 - } 370 - return; 371 - } 372 - 373 - 374 - /* No multi-function device? */ 375 - type = read_pci_config_byte(num,slot,func, 376 - PCI_HEADER_TYPE); 377 - if (!(type & 0x80)) 378 - break; 379 - } 380 - } 381 - } 382 - } 383 - 384 - static int __init ioapic_pirq_setup(char *str) 385 - { 386 - int i, max; 387 - int ints[MAX_PIRQS+1]; 388 - 389 - get_options(str, ARRAY_SIZE(ints), ints); 390 - 391 - for (i = 0; i < MAX_PIRQS; i++) 392 - pirq_entries[i] = -1; 393 - 394 - pirqs_enabled = 1; 395 - apic_printk(APIC_VERBOSE, "PIRQ redirection, working around broken MP-BIOS.\n"); 396 - max = MAX_PIRQS; 397 - if (ints[0] < MAX_PIRQS) 398 - max = ints[0]; 399 - 400 - for (i = 0; i < max; i++) { 401 - apic_printk(APIC_VERBOSE, "... PIRQ%d -> IRQ %d\n", i, ints[i+1]); 402 - /* 403 - * PIRQs are mapped upside down, usually. 404 - */ 405 - pirq_entries[MAX_PIRQS-i-1] = ints[i+1]; 406 - } 407 - return 1; 408 - } 409 - 410 - __setup("pirq=", ioapic_pirq_setup); 411 271 412 272 /* 413 273 * Find the IRQ entry number of a certain pin. ··· 307 425 for (i = 0; i < mp_irq_entries; i++) { 308 426 int lbus = mp_irqs[i].mpc_srcbus; 309 427 310 - if ((mp_bus_id_to_type[lbus] == MP_BUS_ISA || 311 - mp_bus_id_to_type[lbus] == MP_BUS_EISA || 312 - mp_bus_id_to_type[lbus] == MP_BUS_MCA) && 428 + if (test_bit(lbus, mp_bus_not_pci) && 313 429 (mp_irqs[i].mpc_irqtype == type) && 314 430 (mp_irqs[i].mpc_srcbusirq == irq)) 315 431 ··· 323 443 for (i = 0; i < mp_irq_entries; i++) { 324 444 int lbus = mp_irqs[i].mpc_srcbus; 325 445 326 - if ((mp_bus_id_to_type[lbus] == MP_BUS_ISA || 327 - mp_bus_id_to_type[lbus] == MP_BUS_EISA || 328 - mp_bus_id_to_type[lbus] == MP_BUS_MCA) && 446 + if (test_bit(lbus, mp_bus_not_pci) && 329 447 (mp_irqs[i].mpc_irqtype == type) && 330 448 (mp_irqs[i].mpc_srcbusirq == irq)) 331 449 break; ··· 363 485 mp_irqs[i].mpc_dstapic == MP_APIC_ALL) 364 486 break; 365 487 366 - if ((mp_bus_id_to_type[lbus] == MP_BUS_PCI) && 488 + if (!test_bit(lbus, mp_bus_not_pci) && 367 489 !mp_irqs[i].mpc_irqtype && 368 490 (bus == lbus) && 369 491 (slot == ((mp_irqs[i].mpc_srcbusirq >> 2) & 0x1f))) { ··· 386 508 return best_guess; 387 509 } 388 510 389 - /* 390 - * EISA Edge/Level control register, ELCR 391 - */ 392 - static int EISA_ELCR(unsigned int irq) 393 - { 394 - if (irq < 16) { 395 - unsigned int port = 0x4d0 + (irq >> 3); 396 - return (inb(port) >> (irq & 7)) & 1; 397 - } 398 - apic_printk(APIC_VERBOSE, "Broken MPtable reports ISA irq %d\n", irq); 399 - return 0; 400 - } 401 - 402 - /* EISA interrupts are always polarity zero and can be edge or level 403 - * trigger depending on the ELCR value. If an interrupt is listed as 404 - * EISA conforming in the MP table, that means its trigger type must 405 - * be read in from the ELCR */ 406 - 407 - #define default_EISA_trigger(idx) (EISA_ELCR(mp_irqs[idx].mpc_srcbusirq)) 408 - #define default_EISA_polarity(idx) (0) 409 - 410 511 /* ISA interrupts are always polarity zero edge triggered, 411 512 * when listed as conforming in the MP table. */ 412 513 ··· 398 541 #define default_PCI_trigger(idx) (1) 399 542 #define default_PCI_polarity(idx) (1) 400 543 401 - /* MCA interrupts are always polarity zero level triggered, 402 - * when listed as conforming in the MP table. */ 403 - 404 - #define default_MCA_trigger(idx) (1) 405 - #define default_MCA_polarity(idx) (0) 406 - 407 544 static int __init MPBIOS_polarity(int idx) 408 545 { 409 546 int bus = mp_irqs[idx].mpc_srcbus; ··· 409 558 switch (mp_irqs[idx].mpc_irqflag & 3) 410 559 { 411 560 case 0: /* conforms, ie. bus-type dependent polarity */ 412 - { 413 - switch (mp_bus_id_to_type[bus]) 414 - { 415 - case MP_BUS_ISA: /* ISA pin */ 416 - { 417 - polarity = default_ISA_polarity(idx); 418 - break; 419 - } 420 - case MP_BUS_EISA: /* EISA pin */ 421 - { 422 - polarity = default_EISA_polarity(idx); 423 - break; 424 - } 425 - case MP_BUS_PCI: /* PCI pin */ 426 - { 427 - polarity = default_PCI_polarity(idx); 428 - break; 429 - } 430 - case MP_BUS_MCA: /* MCA pin */ 431 - { 432 - polarity = default_MCA_polarity(idx); 433 - break; 434 - } 435 - default: 436 - { 437 - printk(KERN_WARNING "broken BIOS!!\n"); 438 - polarity = 1; 439 - break; 440 - } 441 - } 561 + if (test_bit(bus, mp_bus_not_pci)) 562 + polarity = default_ISA_polarity(idx); 563 + else 564 + polarity = default_PCI_polarity(idx); 442 565 break; 443 - } 444 566 case 1: /* high active */ 445 567 { 446 568 polarity = 0; ··· 451 627 switch ((mp_irqs[idx].mpc_irqflag>>2) & 3) 452 628 { 453 629 case 0: /* conforms, ie. bus-type dependent */ 454 - { 455 - switch (mp_bus_id_to_type[bus]) 456 - { 457 - case MP_BUS_ISA: /* ISA pin */ 458 - { 459 - trigger = default_ISA_trigger(idx); 460 - break; 461 - } 462 - case MP_BUS_EISA: /* EISA pin */ 463 - { 464 - trigger = default_EISA_trigger(idx); 465 - break; 466 - } 467 - case MP_BUS_PCI: /* PCI pin */ 468 - { 469 - trigger = default_PCI_trigger(idx); 470 - break; 471 - } 472 - case MP_BUS_MCA: /* MCA pin */ 473 - { 474 - trigger = default_MCA_trigger(idx); 475 - break; 476 - } 477 - default: 478 - { 479 - printk(KERN_WARNING "broken BIOS!!\n"); 480 - trigger = 1; 481 - break; 482 - } 483 - } 630 + if (test_bit(bus, mp_bus_not_pci)) 631 + trigger = default_ISA_trigger(idx); 632 + else 633 + trigger = default_PCI_trigger(idx); 484 634 break; 485 - } 486 635 case 1: /* edge */ 487 636 { 488 637 trigger = 0; ··· 561 764 if (mp_irqs[idx].mpc_dstirq != pin) 562 765 printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n"); 563 766 564 - switch (mp_bus_id_to_type[bus]) 565 - { 566 - case MP_BUS_ISA: /* ISA pin */ 567 - case MP_BUS_EISA: 568 - case MP_BUS_MCA: 569 - { 570 - irq = mp_irqs[idx].mpc_srcbusirq; 571 - break; 572 - } 573 - case MP_BUS_PCI: /* PCI pin */ 574 - { 575 - /* 576 - * PCI IRQs are mapped in order 577 - */ 578 - i = irq = 0; 579 - while (i < apic) 580 - irq += nr_ioapic_registers[i++]; 581 - irq += pin; 582 - irq = gsi_irq_sharing(irq); 583 - break; 584 - } 585 - default: 586 - { 587 - printk(KERN_ERR "unknown bus type %d.\n",bus); 588 - irq = 0; 589 - break; 590 - } 591 - } 592 - BUG_ON(irq >= NR_IRQS); 593 - 594 - /* 595 - * PCI IRQ command line redirection. Yes, limits are hardcoded. 596 - */ 597 - if ((pin >= 16) && (pin <= 23)) { 598 - if (pirq_entries[pin-16] != -1) { 599 - if (!pirq_entries[pin-16]) { 600 - apic_printk(APIC_VERBOSE, "disabling PIRQ%d\n", pin-16); 601 - } else { 602 - irq = pirq_entries[pin-16]; 603 - apic_printk(APIC_VERBOSE, "using PIRQ%d -> IRQ %d\n", 604 - pin-16, irq); 605 - } 606 - } 767 + if (test_bit(bus, mp_bus_not_pci)) { 768 + irq = mp_irqs[idx].mpc_srcbusirq; 769 + } else { 770 + /* 771 + * PCI IRQs are mapped in order 772 + */ 773 + i = irq = 0; 774 + while (i < apic) 775 + irq += nr_ioapic_registers[i++]; 776 + irq += pin; 777 + irq = gsi_irq_sharing(irq); 607 778 } 608 779 BUG_ON(irq >= NR_IRQS); 609 780 return irq; ··· 708 943 if (!apic && (irq < 16)) 709 944 disable_8259A_irq(irq); 710 945 } 946 + ioapic_write_entry(apic, pin, entry); 947 + 711 948 spin_lock_irqsave(&ioapic_lock, flags); 712 - io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1)); 713 - io_apic_write(apic, 0x10+2*pin, *(((int *)&entry)+0)); 714 949 set_native_irq_info(irq, TARGET_CPUS); 715 950 spin_unlock_irqrestore(&ioapic_lock, flags); 716 951 } ··· 848 1083 for (i = 0; i <= reg_01.bits.entries; i++) { 849 1084 struct IO_APIC_route_entry entry; 850 1085 851 - spin_lock_irqsave(&ioapic_lock, flags); 852 - *(((int *)&entry)+0) = io_apic_read(apic, 0x10+i*2); 853 - *(((int *)&entry)+1) = io_apic_read(apic, 0x11+i*2); 854 - spin_unlock_irqrestore(&ioapic_lock, flags); 1086 + entry = ioapic_read_entry(apic, i); 855 1087 856 1088 printk(KERN_DEBUG " %02x %03X %02X ", 857 1089 i, ··· 1043 1281 irq_2_pin[i].pin = -1; 1044 1282 irq_2_pin[i].next = 0; 1045 1283 } 1046 - if (!pirqs_enabled) 1047 - for (i = 0; i < MAX_PIRQS; i++) 1048 - pirq_entries[i] = -1; 1049 1284 1050 1285 /* 1051 1286 * The number of IO-APIC IRQ registers (== #pins): ··· 1058 1299 /* See if any of the pins is in ExtINT mode */ 1059 1300 for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) { 1060 1301 struct IO_APIC_route_entry entry; 1061 - spin_lock_irqsave(&ioapic_lock, flags); 1062 - *(((int *)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin); 1063 - *(((int *)&entry) + 1) = io_apic_read(apic, 0x11 + 2 * pin); 1064 - spin_unlock_irqrestore(&ioapic_lock, flags); 1065 - 1302 + entry = ioapic_read_entry(apic, pin); 1066 1303 1067 1304 /* If the interrupt line is enabled and in ExtInt mode 1068 1305 * I have found the pin where the i8259 is connected. ··· 1110 1355 */ 1111 1356 if (ioapic_i8259.pin != -1) { 1112 1357 struct IO_APIC_route_entry entry; 1113 - unsigned long flags; 1114 1358 1115 1359 memset(&entry, 0, sizeof(entry)); 1116 1360 entry.mask = 0; /* Enabled */ ··· 1126 1372 /* 1127 1373 * Add it to the IO-APIC irq-routing table: 1128 1374 */ 1129 - spin_lock_irqsave(&ioapic_lock, flags); 1130 - io_apic_write(ioapic_i8259.apic, 0x11+2*ioapic_i8259.pin, 1131 - *(((int *)&entry)+1)); 1132 - io_apic_write(ioapic_i8259.apic, 0x10+2*ioapic_i8259.pin, 1133 - *(((int *)&entry)+0)); 1134 - spin_unlock_irqrestore(&ioapic_lock, flags); 1375 + ioapic_write_entry(ioapic_i8259.apic, ioapic_i8259.pin, entry); 1135 1376 } 1136 1377 1137 1378 disconnect_bsp_APIC(ioapic_i8259.pin != -1); 1138 - } 1139 - 1140 - /* 1141 - * function to set the IO-APIC physical IDs based on the 1142 - * values stored in the MPC table. 1143 - * 1144 - * by Matt Domsch <Matt_Domsch@dell.com> Tue Dec 21 12:25:05 CST 1999 1145 - */ 1146 - 1147 - static void __init setup_ioapic_ids_from_mpc (void) 1148 - { 1149 - union IO_APIC_reg_00 reg_00; 1150 - int apic; 1151 - int i; 1152 - unsigned char old_id; 1153 - unsigned long flags; 1154 - 1155 - /* 1156 - * Set the IOAPIC ID to the value stored in the MPC table. 1157 - */ 1158 - for (apic = 0; apic < nr_ioapics; apic++) { 1159 - 1160 - /* Read the register 0 value */ 1161 - spin_lock_irqsave(&ioapic_lock, flags); 1162 - reg_00.raw = io_apic_read(apic, 0); 1163 - spin_unlock_irqrestore(&ioapic_lock, flags); 1164 - 1165 - old_id = mp_ioapics[apic].mpc_apicid; 1166 - 1167 - 1168 - printk(KERN_INFO "Using IO-APIC %d\n", mp_ioapics[apic].mpc_apicid); 1169 - 1170 - 1171 - /* 1172 - * We need to adjust the IRQ routing table 1173 - * if the ID changed. 1174 - */ 1175 - if (old_id != mp_ioapics[apic].mpc_apicid) 1176 - for (i = 0; i < mp_irq_entries; i++) 1177 - if (mp_irqs[i].mpc_dstapic == old_id) 1178 - mp_irqs[i].mpc_dstapic 1179 - = mp_ioapics[apic].mpc_apicid; 1180 - 1181 - /* 1182 - * Read the right value from the MPC table and 1183 - * write it into the ID register. 1184 - */ 1185 - apic_printk(APIC_VERBOSE,KERN_INFO "...changing IO-APIC physical APIC ID to %d ...", 1186 - mp_ioapics[apic].mpc_apicid); 1187 - 1188 - reg_00.bits.ID = mp_ioapics[apic].mpc_apicid; 1189 - spin_lock_irqsave(&ioapic_lock, flags); 1190 - io_apic_write(apic, 0, reg_00.raw); 1191 - spin_unlock_irqrestore(&ioapic_lock, flags); 1192 - 1193 - /* 1194 - * Sanity check 1195 - */ 1196 - spin_lock_irqsave(&ioapic_lock, flags); 1197 - reg_00.raw = io_apic_read(apic, 0); 1198 - spin_unlock_irqrestore(&ioapic_lock, flags); 1199 - if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid) 1200 - printk("could not set ID!\n"); 1201 - else 1202 - apic_printk(APIC_VERBOSE," ok.\n"); 1203 - } 1204 1379 } 1205 1380 1206 1381 /* ··· 1647 1964 1648 1965 apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n"); 1649 1966 1650 - /* 1651 - * Set up the IO-APIC IRQ routing table. 1652 - */ 1653 - if (!acpi_ioapic) 1654 - setup_ioapic_ids_from_mpc(); 1655 1967 sync_Arb_IDs(); 1656 1968 setup_IO_APIC_irqs(); 1657 1969 init_IO_APIC_traps(); ··· 1665 1987 { 1666 1988 struct IO_APIC_route_entry *entry; 1667 1989 struct sysfs_ioapic_data *data; 1668 - unsigned long flags; 1669 1990 int i; 1670 1991 1671 1992 data = container_of(dev, struct sysfs_ioapic_data, dev); 1672 1993 entry = data->entry; 1673 - spin_lock_irqsave(&ioapic_lock, flags); 1674 - for (i = 0; i < nr_ioapic_registers[dev->id]; i ++, entry ++ ) { 1675 - *(((int *)entry) + 1) = io_apic_read(dev->id, 0x11 + 2 * i); 1676 - *(((int *)entry) + 0) = io_apic_read(dev->id, 0x10 + 2 * i); 1677 - } 1678 - spin_unlock_irqrestore(&ioapic_lock, flags); 1994 + for (i = 0; i < nr_ioapic_registers[dev->id]; i ++, entry ++ ) 1995 + *entry = ioapic_read_entry(dev->id, i); 1679 1996 1680 1997 return 0; 1681 1998 } ··· 1692 2019 reg_00.bits.ID = mp_ioapics[dev->id].mpc_apicid; 1693 2020 io_apic_write(dev->id, 0, reg_00.raw); 1694 2021 } 1695 - for (i = 0; i < nr_ioapic_registers[dev->id]; i ++, entry ++ ) { 1696 - io_apic_write(dev->id, 0x11+2*i, *(((int *)entry)+1)); 1697 - io_apic_write(dev->id, 0x10+2*i, *(((int *)entry)+0)); 1698 - } 1699 2022 spin_unlock_irqrestore(&ioapic_lock, flags); 2023 + for (i = 0; i < nr_ioapic_registers[dev->id]; i++) 2024 + ioapic_write_entry(dev->id, i, entry[i]); 1700 2025 1701 2026 return 0; 1702 2027 } ··· 1747 2076 #ifdef CONFIG_ACPI 1748 2077 1749 2078 #define IO_APIC_MAX_ID 0xFE 1750 - 1751 - int __init io_apic_get_version (int ioapic) 1752 - { 1753 - union IO_APIC_reg_01 reg_01; 1754 - unsigned long flags; 1755 - 1756 - spin_lock_irqsave(&ioapic_lock, flags); 1757 - reg_01.raw = io_apic_read(ioapic, 1); 1758 - spin_unlock_irqrestore(&ioapic_lock, flags); 1759 - 1760 - return reg_01.bits.version; 1761 - } 1762 - 1763 2079 1764 2080 int __init io_apic_get_redir_entries (int ioapic) 1765 2081 { ··· 1806 2148 if (!ioapic && (irq < 16)) 1807 2149 disable_8259A_irq(irq); 1808 2150 2151 + ioapic_write_entry(ioapic, pin, entry); 2152 + 1809 2153 spin_lock_irqsave(&ioapic_lock, flags); 1810 - io_apic_write(ioapic, 0x11+2*pin, *(((int *)&entry)+1)); 1811 - io_apic_write(ioapic, 0x10+2*pin, *(((int *)&entry)+0)); 1812 - set_native_irq_info(use_pci_vector() ? entry.vector : irq, TARGET_CPUS); 2154 + set_native_irq_info(use_pci_vector() ? entry.vector : irq, TARGET_CPUS); 1813 2155 spin_unlock_irqrestore(&ioapic_lock, flags); 1814 2156 1815 2157 return 0;
+1
arch/x86_64/kernel/ioport.c
··· 56 56 57 57 memset(bitmap, 0xff, IO_BITMAP_BYTES); 58 58 t->io_bitmap_ptr = bitmap; 59 + set_thread_flag(TIF_IO_BITMAP); 59 60 } 60 61 61 62 /*
-12
arch/x86_64/kernel/irq.c
··· 20 20 #include <asm/idle.h> 21 21 22 22 atomic_t irq_err_count; 23 - #ifdef CONFIG_X86_IO_APIC 24 - #ifdef APIC_MISMATCH_DEBUG 25 - atomic_t irq_mis_count; 26 - #endif 27 - #endif 28 23 29 24 #ifdef CONFIG_DEBUG_STACKOVERFLOW 30 25 /* ··· 87 92 for_each_online_cpu(j) 88 93 seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count); 89 94 seq_putc(p, '\n'); 90 - #ifdef CONFIG_X86_LOCAL_APIC 91 95 seq_printf(p, "LOC: "); 92 96 for_each_online_cpu(j) 93 97 seq_printf(p, "%10u ", cpu_pda(j)->apic_timer_irqs); 94 98 seq_putc(p, '\n'); 95 - #endif 96 99 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); 97 - #ifdef CONFIG_X86_IO_APIC 98 - #ifdef APIC_MISMATCH_DEBUG 99 - seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count)); 100 - #endif 101 - #endif 102 100 } 103 101 return 0; 104 102 }
+63 -32
arch/x86_64/kernel/machine_kexec.c
··· 15 15 #include <asm/mmu_context.h> 16 16 #include <asm/io.h> 17 17 18 + #define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE))) 19 + static u64 kexec_pgd[512] PAGE_ALIGNED; 20 + static u64 kexec_pud0[512] PAGE_ALIGNED; 21 + static u64 kexec_pmd0[512] PAGE_ALIGNED; 22 + static u64 kexec_pte0[512] PAGE_ALIGNED; 23 + static u64 kexec_pud1[512] PAGE_ALIGNED; 24 + static u64 kexec_pmd1[512] PAGE_ALIGNED; 25 + static u64 kexec_pte1[512] PAGE_ALIGNED; 26 + 18 27 static void init_level2_page(pmd_t *level2p, unsigned long addr) 19 28 { 20 29 unsigned long end_addr; ··· 153 144 ); 154 145 } 155 146 156 - typedef NORET_TYPE void (*relocate_new_kernel_t)(unsigned long indirection_page, 157 - unsigned long control_code_buffer, 158 - unsigned long start_address, 159 - unsigned long pgtable) ATTRIB_NORET; 160 - 161 - extern const unsigned char relocate_new_kernel[]; 162 - extern const unsigned long relocate_new_kernel_size; 163 - 164 147 int machine_kexec_prepare(struct kimage *image) 165 148 { 166 - unsigned long start_pgtable, control_code_buffer; 149 + unsigned long start_pgtable; 167 150 int result; 168 151 169 152 /* Calculate the offsets */ 170 153 start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT; 171 - control_code_buffer = start_pgtable + PAGE_SIZE; 172 154 173 155 /* Setup the identity mapped 64bit page table */ 174 156 result = init_pgtable(image, start_pgtable); 175 157 if (result) 176 158 return result; 177 - 178 - /* Place the code in the reboot code buffer */ 179 - memcpy(__va(control_code_buffer), relocate_new_kernel, 180 - relocate_new_kernel_size); 181 159 182 160 return 0; 183 161 } ··· 180 184 */ 181 185 NORET_TYPE void machine_kexec(struct kimage *image) 182 186 { 183 - unsigned long page_list; 184 - unsigned long control_code_buffer; 185 - unsigned long start_pgtable; 186 - relocate_new_kernel_t rnk; 187 + unsigned long page_list[PAGES_NR]; 188 + void *control_page; 187 189 188 190 /* Interrupts aren't acceptable while we reboot */ 189 191 local_irq_disable(); 190 192 191 - /* Calculate the offsets */ 192 - page_list = image->head; 193 - start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT; 194 - control_code_buffer = start_pgtable + PAGE_SIZE; 193 + control_page = page_address(image->control_code_page) + PAGE_SIZE; 194 + memcpy(control_page, relocate_kernel, PAGE_SIZE); 195 195 196 - /* Set the low half of the page table to my identity mapped 197 - * page table for kexec. Leave the high half pointing at the 198 - * kernel pages. Don't bother to flush the global pages 199 - * as that will happen when I fully switch to my identity mapped 200 - * page table anyway. 201 - */ 202 - memcpy(__va(read_cr3()), __va(start_pgtable), PAGE_SIZE/2); 203 - __flush_tlb(); 196 + page_list[PA_CONTROL_PAGE] = __pa(control_page); 197 + page_list[VA_CONTROL_PAGE] = (unsigned long)relocate_kernel; 198 + page_list[PA_PGD] = __pa(kexec_pgd); 199 + page_list[VA_PGD] = (unsigned long)kexec_pgd; 200 + page_list[PA_PUD_0] = __pa(kexec_pud0); 201 + page_list[VA_PUD_0] = (unsigned long)kexec_pud0; 202 + page_list[PA_PMD_0] = __pa(kexec_pmd0); 203 + page_list[VA_PMD_0] = (unsigned long)kexec_pmd0; 204 + page_list[PA_PTE_0] = __pa(kexec_pte0); 205 + page_list[VA_PTE_0] = (unsigned long)kexec_pte0; 206 + page_list[PA_PUD_1] = __pa(kexec_pud1); 207 + page_list[VA_PUD_1] = (unsigned long)kexec_pud1; 208 + page_list[PA_PMD_1] = __pa(kexec_pmd1); 209 + page_list[VA_PMD_1] = (unsigned long)kexec_pmd1; 210 + page_list[PA_PTE_1] = __pa(kexec_pte1); 211 + page_list[VA_PTE_1] = (unsigned long)kexec_pte1; 204 212 213 + page_list[PA_TABLE_PAGE] = 214 + (unsigned long)__pa(page_address(image->control_code_page)); 205 215 206 216 /* The segment registers are funny things, they have both a 207 217 * visible and an invisible part. Whenever the visible part is ··· 224 222 */ 225 223 set_gdt(phys_to_virt(0),0); 226 224 set_idt(phys_to_virt(0),0); 225 + 227 226 /* now call it */ 228 - rnk = (relocate_new_kernel_t) control_code_buffer; 229 - (*rnk)(page_list, control_code_buffer, image->start, start_pgtable); 227 + relocate_kernel((unsigned long)image->head, (unsigned long)page_list, 228 + image->start); 230 229 } 230 + 231 + /* crashkernel=size@addr specifies the location to reserve for 232 + * a crash kernel. By reserving this memory we guarantee 233 + * that linux never set's it up as a DMA target. 234 + * Useful for holding code to do something appropriate 235 + * after a kernel panic. 236 + */ 237 + static int __init setup_crashkernel(char *arg) 238 + { 239 + unsigned long size, base; 240 + char *p; 241 + if (!arg) 242 + return -EINVAL; 243 + size = memparse(arg, &p); 244 + if (arg == p) 245 + return -EINVAL; 246 + if (*p == '@') { 247 + base = memparse(p+1, &p); 248 + /* FIXME: Do I want a sanity check to validate the 249 + * memory range? Yes you do, but it's too early for 250 + * e820 -AK */ 251 + crashk_res.start = base; 252 + crashk_res.end = base + size - 1; 253 + } 254 + return 0; 255 + } 256 + early_param("crashkernel", setup_crashkernel); 257 +
+28 -1
arch/x86_64/kernel/mce.c
··· 182 182 goto out2; 183 183 184 184 memset(&m, 0, sizeof(struct mce)); 185 - m.cpu = safe_smp_processor_id(); 185 + m.cpu = smp_processor_id(); 186 186 rdmsrl(MSR_IA32_MCG_STATUS, m.mcgstatus); 187 187 if (!(m.mcgstatus & MCG_STATUS_RIPV)) 188 188 kill_it = 1; ··· 273 273 out2: 274 274 atomic_dec(&mce_entry); 275 275 } 276 + 277 + #ifdef CONFIG_X86_MCE_INTEL 278 + /*** 279 + * mce_log_therm_throt_event - Logs the thermal throttling event to mcelog 280 + * @cpu: The CPU on which the event occured. 281 + * @status: Event status information 282 + * 283 + * This function should be called by the thermal interrupt after the 284 + * event has been processed and the decision was made to log the event 285 + * further. 286 + * 287 + * The status parameter will be saved to the 'status' field of 'struct mce' 288 + * and historically has been the register value of the 289 + * MSR_IA32_THERMAL_STATUS (Intel) msr. 290 + */ 291 + void mce_log_therm_throt_event(unsigned int cpu, __u64 status) 292 + { 293 + struct mce m; 294 + 295 + memset(&m, 0, sizeof(m)); 296 + m.cpu = cpu; 297 + m.bank = MCE_THERMAL_BANK; 298 + m.status = status; 299 + rdtscll(m.tsc); 300 + mce_log(&m); 301 + } 302 + #endif /* CONFIG_X86_MCE_INTEL */ 276 303 277 304 /* 278 305 * Periodic polling timer for "silent" machine check errors.
+8 -20
arch/x86_64/kernel/mce_intel.c
··· 11 11 #include <asm/mce.h> 12 12 #include <asm/hw_irq.h> 13 13 #include <asm/idle.h> 14 - 15 - static DEFINE_PER_CPU(unsigned long, next_check); 14 + #include <asm/therm_throt.h> 16 15 17 16 asmlinkage void smp_thermal_interrupt(void) 18 17 { 19 - struct mce m; 18 + __u64 msr_val; 20 19 21 20 ack_APIC_irq(); 22 21 23 22 exit_idle(); 24 23 irq_enter(); 25 - if (time_before(jiffies, __get_cpu_var(next_check))) 26 - goto done; 27 24 28 - __get_cpu_var(next_check) = jiffies + HZ*300; 29 - memset(&m, 0, sizeof(m)); 30 - m.cpu = smp_processor_id(); 31 - m.bank = MCE_THERMAL_BANK; 32 - rdtscll(m.tsc); 33 - rdmsrl(MSR_IA32_THERM_STATUS, m.status); 34 - if (m.status & 0x1) { 35 - printk(KERN_EMERG 36 - "CPU%d: Temperature above threshold, cpu clock throttled\n", m.cpu); 37 - add_taint(TAINT_MACHINE_CHECK); 38 - } else { 39 - printk(KERN_EMERG "CPU%d: Temperature/speed normal\n", m.cpu); 40 - } 25 + rdmsrl(MSR_IA32_THERM_STATUS, msr_val); 26 + if (therm_throt_process(msr_val & 1)) 27 + mce_log_therm_throt_event(smp_processor_id(), msr_val); 41 28 42 - mce_log(&m); 43 - done: 44 29 irq_exit(); 45 30 } 46 31 ··· 77 92 apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); 78 93 printk(KERN_INFO "CPU%d: Thermal monitoring enabled (%s)\n", 79 94 cpu, tm2 ? "TM2" : "TM1"); 95 + 96 + /* enable thermal throttle processing */ 97 + atomic_set(&therm_throt_en, 1); 80 98 return; 81 99 } 82 100
+58 -180
arch/x86_64/kernel/mpparse.c
··· 41 41 * Various Linux-internal data structures created from the 42 42 * MP-table. 43 43 */ 44 - unsigned char apic_version [MAX_APICS]; 45 - unsigned char mp_bus_id_to_type [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; 44 + DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); 46 45 int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; 47 46 48 47 static int mp_current_pci_id = 0; ··· 55 56 int mp_irq_entries; 56 57 57 58 int nr_ioapics; 58 - int pic_mode; 59 59 unsigned long mp_lapic_addr = 0; 60 60 61 61 ··· 68 70 69 71 /* Bitmask of physically existing CPUs */ 70 72 physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE; 71 - 72 - /* ACPI MADT entry parsing functions */ 73 - #ifdef CONFIG_ACPI 74 - extern struct acpi_boot_flags acpi_boot; 75 - #ifdef CONFIG_X86_LOCAL_APIC 76 - extern int acpi_parse_lapic (acpi_table_entry_header *header); 77 - extern int acpi_parse_lapic_addr_ovr (acpi_table_entry_header *header); 78 - extern int acpi_parse_lapic_nmi (acpi_table_entry_header *header); 79 - #endif /*CONFIG_X86_LOCAL_APIC*/ 80 - #ifdef CONFIG_X86_IO_APIC 81 - extern int acpi_parse_ioapic (acpi_table_entry_header *header); 82 - #endif /*CONFIG_X86_IO_APIC*/ 83 - #endif /*CONFIG_ACPI*/ 84 73 85 74 u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; 86 75 ··· 93 108 static void __cpuinit MP_processor_info (struct mpc_config_processor *m) 94 109 { 95 110 int cpu; 96 - unsigned char ver; 97 111 cpumask_t tmp_map; 112 + char *bootup_cpu = ""; 98 113 99 114 if (!(m->mpc_cpuflag & CPU_ENABLED)) { 100 115 disabled_cpus++; 101 116 return; 102 117 } 103 - 104 - printk(KERN_INFO "Processor #%d %d:%d APIC version %d\n", 105 - m->mpc_apicid, 106 - (m->mpc_cpufeature & CPU_FAMILY_MASK)>>8, 107 - (m->mpc_cpufeature & CPU_MODEL_MASK)>>4, 108 - m->mpc_apicver); 109 - 110 118 if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { 111 - Dprintk(" Bootup CPU\n"); 119 + bootup_cpu = " (Bootup-CPU)"; 112 120 boot_cpu_id = m->mpc_apicid; 113 121 } 122 + 123 + printk(KERN_INFO "Processor #%d%s\n", m->mpc_apicid, bootup_cpu); 124 + 114 125 if (num_processors >= NR_CPUS) { 115 126 printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached." 116 127 " Processor ignored.\n", NR_CPUS); ··· 117 136 cpus_complement(tmp_map, cpu_present_map); 118 137 cpu = first_cpu(tmp_map); 119 138 120 - #if MAX_APICS < 255 121 - if ((int)m->mpc_apicid > MAX_APICS) { 122 - printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n", 123 - m->mpc_apicid, MAX_APICS); 124 - return; 125 - } 126 - #endif 127 - ver = m->mpc_apicver; 128 - 129 139 physid_set(m->mpc_apicid, phys_cpu_present_map); 130 - /* 131 - * Validate version 132 - */ 133 - if (ver == 0x0) { 134 - printk(KERN_ERR "BIOS bug, APIC version is 0 for CPU#%d! fixing up to 0x10. (tell your hw vendor)\n", m->mpc_apicid); 135 - ver = 0x10; 136 - } 137 - apic_version[m->mpc_apicid] = ver; 138 140 if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { 139 141 /* 140 142 * bios_cpu_apicid is required to have processors listed ··· 142 178 Dprintk("Bus #%d is %s\n", m->mpc_busid, str); 143 179 144 180 if (strncmp(str, "ISA", 3) == 0) { 145 - mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA; 146 - } else if (strncmp(str, "EISA", 4) == 0) { 147 - mp_bus_id_to_type[m->mpc_busid] = MP_BUS_EISA; 181 + set_bit(m->mpc_busid, mp_bus_not_pci); 148 182 } else if (strncmp(str, "PCI", 3) == 0) { 149 - mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI; 183 + clear_bit(m->mpc_busid, mp_bus_not_pci); 150 184 mp_bus_id_to_pci_bus[m->mpc_busid] = mp_current_pci_id; 151 185 mp_current_pci_id++; 152 - } else if (strncmp(str, "MCA", 3) == 0) { 153 - mp_bus_id_to_type[m->mpc_busid] = MP_BUS_MCA; 154 186 } else { 155 187 printk(KERN_ERR "Unknown bustype %s\n", str); 156 188 } ··· 157 197 if (!(m->mpc_flags & MPC_APIC_USABLE)) 158 198 return; 159 199 160 - printk("I/O APIC #%d Version %d at 0x%X.\n", 161 - m->mpc_apicid, m->mpc_apicver, m->mpc_apicaddr); 200 + printk("I/O APIC #%d at 0x%X.\n", 201 + m->mpc_apicid, m->mpc_apicaddr); 162 202 if (nr_ioapics >= MAX_IO_APICS) { 163 203 printk(KERN_ERR "Max # of I/O APICs (%d) exceeded (found %d).\n", 164 204 MAX_IO_APICS, nr_ioapics); ··· 192 232 m->mpc_irqtype, m->mpc_irqflag & 3, 193 233 (m->mpc_irqflag >> 2) &3, m->mpc_srcbusid, 194 234 m->mpc_srcbusirq, m->mpc_destapic, m->mpc_destapiclint); 195 - /* 196 - * Well it seems all SMP boards in existence 197 - * use ExtINT/LVT1 == LINT0 and 198 - * NMI/LVT2 == LINT1 - the following check 199 - * will show us if this assumptions is false. 200 - * Until then we do not have to add baggage. 201 - */ 202 - if ((m->mpc_irqtype == mp_ExtINT) && 203 - (m->mpc_destapiclint != 0)) 204 - BUG(); 205 - if ((m->mpc_irqtype == mp_NMI) && 206 - (m->mpc_destapiclint != 1)) 207 - BUG(); 208 235 } 209 236 210 237 /* ··· 205 258 unsigned char *mpt=((unsigned char *)mpc)+count; 206 259 207 260 if (memcmp(mpc->mpc_signature,MPC_SIGNATURE,4)) { 208 - printk("SMP mptable: bad signature [%c%c%c%c]!\n", 261 + printk("MPTABLE: bad signature [%c%c%c%c]!\n", 209 262 mpc->mpc_signature[0], 210 263 mpc->mpc_signature[1], 211 264 mpc->mpc_signature[2], ··· 213 266 return 0; 214 267 } 215 268 if (mpf_checksum((unsigned char *)mpc,mpc->mpc_length)) { 216 - printk("SMP mptable: checksum error!\n"); 269 + printk("MPTABLE: checksum error!\n"); 217 270 return 0; 218 271 } 219 272 if (mpc->mpc_spec!=0x01 && mpc->mpc_spec!=0x04) { 220 - printk(KERN_ERR "SMP mptable: bad table version (%d)!!\n", 273 + printk(KERN_ERR "MPTABLE: bad table version (%d)!!\n", 221 274 mpc->mpc_spec); 222 275 return 0; 223 276 } 224 277 if (!mpc->mpc_lapic) { 225 - printk(KERN_ERR "SMP mptable: null local APIC address!\n"); 278 + printk(KERN_ERR "MPTABLE: null local APIC address!\n"); 226 279 return 0; 227 280 } 228 281 memcpy(str,mpc->mpc_oem,8); 229 - str[8]=0; 230 - printk(KERN_INFO "OEM ID: %s ",str); 282 + str[8] = 0; 283 + printk(KERN_INFO "MPTABLE: OEM ID: %s ",str); 231 284 232 285 memcpy(str,mpc->mpc_productid,12); 233 - str[12]=0; 234 - printk("Product ID: %s ",str); 286 + str[12] = 0; 287 + printk("MPTABLE: Product ID: %s ",str); 235 288 236 - printk("APIC at: 0x%X\n",mpc->mpc_lapic); 289 + printk("MPTABLE: APIC at: 0x%X\n",mpc->mpc_lapic); 237 290 238 291 /* save the local APIC address, it might be non-default */ 239 292 if (!acpi_lapic) 240 - mp_lapic_addr = mpc->mpc_lapic; 293 + mp_lapic_addr = mpc->mpc_lapic; 241 294 242 295 /* 243 296 * Now process the configuration blocks. ··· 249 302 struct mpc_config_processor *m= 250 303 (struct mpc_config_processor *)mpt; 251 304 if (!acpi_lapic) 252 - MP_processor_info(m); 305 + MP_processor_info(m); 253 306 mpt += sizeof(*m); 254 307 count += sizeof(*m); 255 308 break; ··· 268 321 struct mpc_config_ioapic *m= 269 322 (struct mpc_config_ioapic *)mpt; 270 323 MP_ioapic_info(m); 271 - mpt+=sizeof(*m); 272 - count+=sizeof(*m); 324 + mpt += sizeof(*m); 325 + count += sizeof(*m); 273 326 break; 274 327 } 275 328 case MP_INTSRC: ··· 278 331 (struct mpc_config_intsrc *)mpt; 279 332 280 333 MP_intsrc_info(m); 281 - mpt+=sizeof(*m); 282 - count+=sizeof(*m); 334 + mpt += sizeof(*m); 335 + count += sizeof(*m); 283 336 break; 284 337 } 285 338 case MP_LINTSRC: ··· 287 340 struct mpc_config_lintsrc *m= 288 341 (struct mpc_config_lintsrc *)mpt; 289 342 MP_lintsrc_info(m); 290 - mpt+=sizeof(*m); 291 - count+=sizeof(*m); 343 + mpt += sizeof(*m); 344 + count += sizeof(*m); 292 345 break; 293 346 } 294 347 } 295 348 } 296 349 clustered_apic_check(); 297 350 if (!num_processors) 298 - printk(KERN_ERR "SMP mptable: no processors registered!\n"); 351 + printk(KERN_ERR "MPTABLE: no processors registered!\n"); 299 352 return num_processors; 300 353 } 301 354 ··· 391 444 * 2 CPUs, numbered 0 & 1. 392 445 */ 393 446 processor.mpc_type = MP_PROCESSOR; 394 - /* Either an integrated APIC or a discrete 82489DX. */ 395 - processor.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01; 447 + processor.mpc_apicver = 0; 396 448 processor.mpc_cpuflag = CPU_ENABLED; 397 - processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) | 398 - (boot_cpu_data.x86_model << 4) | 399 - boot_cpu_data.x86_mask; 400 - processor.mpc_featureflag = boot_cpu_data.x86_capability[0]; 449 + processor.mpc_cpufeature = 0; 450 + processor.mpc_featureflag = 0; 401 451 processor.mpc_reserved[0] = 0; 402 452 processor.mpc_reserved[1] = 0; 403 453 for (i = 0; i < 2; i++) { ··· 413 469 case 5: 414 470 memcpy(bus.mpc_bustype, "ISA ", 6); 415 471 break; 416 - case 2: 417 - case 6: 418 - case 3: 419 - memcpy(bus.mpc_bustype, "EISA ", 6); 420 - break; 421 - case 4: 422 - case 7: 423 - memcpy(bus.mpc_bustype, "MCA ", 6); 424 472 } 425 473 MP_bus_info(&bus); 426 474 if (mpc_default_type > 4) { ··· 423 487 424 488 ioapic.mpc_type = MP_IOAPIC; 425 489 ioapic.mpc_apicid = 2; 426 - ioapic.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01; 490 + ioapic.mpc_apicver = 0; 427 491 ioapic.mpc_flags = MPC_APIC_USABLE; 428 492 ioapic.mpc_apicaddr = 0xFEC00000; 429 493 MP_ioapic_info(&ioapic); ··· 466 530 printk(KERN_INFO "Using ACPI for processor (LAPIC) configuration information\n"); 467 531 468 532 printk("Intel MultiProcessor Specification v1.%d\n", mpf->mpf_specification); 469 - if (mpf->mpf_feature2 & (1<<7)) { 470 - printk(KERN_INFO " IMCR and PIC compatibility mode.\n"); 471 - pic_mode = 1; 472 - } else { 473 - printk(KERN_INFO " Virtual Wire compatibility mode.\n"); 474 - pic_mode = 0; 475 - } 476 533 477 534 /* 478 535 * Now see if we need to read further. ··· 545 616 return 0; 546 617 } 547 618 548 - void __init find_intel_smp (void) 619 + void __init find_smp_config(void) 549 620 { 550 621 unsigned int address; 551 622 ··· 562 633 smp_scan_config(0xF0000,0x10000)) 563 634 return; 564 635 /* 565 - * If it is an SMP machine we should know now, unless the 566 - * configuration is in an EISA/MCA bus machine with an 567 - * extended bios data area. 636 + * If it is an SMP machine we should know now. 568 637 * 569 638 * there is a real-mode segmented pointer pointing to the 570 639 * 4K EBDA area at 0x40E, calculate and scan it here. ··· 583 656 printk(KERN_INFO "No mptable found.\n"); 584 657 } 585 658 586 - /* 587 - * - Intel MP Configuration Table 588 - */ 589 - void __init find_smp_config (void) 590 - { 591 - #ifdef CONFIG_X86_LOCAL_APIC 592 - find_intel_smp(); 593 - #endif 594 - } 595 - 596 - 597 659 /* -------------------------------------------------------------------------- 598 660 ACPI-based MP Configuration 599 661 -------------------------------------------------------------------------- */ 600 662 601 663 #ifdef CONFIG_ACPI 602 664 603 - void __init mp_register_lapic_address ( 604 - u64 address) 665 + void __init mp_register_lapic_address(u64 address) 605 666 { 606 667 mp_lapic_addr = (unsigned long) address; 607 - 608 668 set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); 609 - 610 669 if (boot_cpu_id == -1U) 611 670 boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); 612 - 613 - Dprintk("Boot CPU = %d\n", boot_cpu_physical_apicid); 614 671 } 615 672 616 - 617 - void __cpuinit mp_register_lapic ( 618 - u8 id, 619 - u8 enabled) 673 + void __cpuinit mp_register_lapic (u8 id, u8 enabled) 620 674 { 621 675 struct mpc_config_processor processor; 622 676 int boot_cpu = 0; 623 677 624 - if (id >= MAX_APICS) { 625 - printk(KERN_WARNING "Processor #%d invalid (max %d)\n", 626 - id, MAX_APICS); 627 - return; 628 - } 629 - 630 - if (id == boot_cpu_physical_apicid) 678 + if (id == boot_cpu_id) 631 679 boot_cpu = 1; 632 680 633 681 processor.mpc_type = MP_PROCESSOR; 634 682 processor.mpc_apicid = id; 635 - processor.mpc_apicver = GET_APIC_VERSION(apic_read(APIC_LVR)); 683 + processor.mpc_apicver = 0; 636 684 processor.mpc_cpuflag = (enabled ? CPU_ENABLED : 0); 637 685 processor.mpc_cpuflag |= (boot_cpu ? CPU_BOOTPROCESSOR : 0); 638 - processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) | 639 - (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_mask; 640 - processor.mpc_featureflag = boot_cpu_data.x86_capability[0]; 686 + processor.mpc_cpufeature = 0; 687 + processor.mpc_featureflag = 0; 641 688 processor.mpc_reserved[0] = 0; 642 689 processor.mpc_reserved[1] = 0; 643 690 644 691 MP_processor_info(&processor); 645 692 } 646 - 647 - #ifdef CONFIG_X86_IO_APIC 648 693 649 694 #define MP_ISA_BUS 0 650 695 #define MP_MAX_IOAPIC_PIN 127 ··· 628 729 u32 pin_programmed[4]; 629 730 } mp_ioapic_routing[MAX_IO_APICS]; 630 731 631 - 632 - static int mp_find_ioapic ( 633 - int gsi) 732 + static int mp_find_ioapic(int gsi) 634 733 { 635 - int i = 0; 734 + int i = 0; 636 735 637 736 /* Find the IOAPIC that manages this GSI. */ 638 737 for (i = 0; i < nr_ioapics; i++) { ··· 640 743 } 641 744 642 745 printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi); 643 - 644 746 return -1; 645 747 } 646 - 647 748 648 - void __init mp_register_ioapic ( 649 - u8 id, 650 - u32 address, 651 - u32 gsi_base) 749 + void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base) 652 750 { 653 - int idx = 0; 751 + int idx = 0; 654 752 655 753 if (nr_ioapics >= MAX_IO_APICS) { 656 754 printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded " ··· 666 774 667 775 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); 668 776 mp_ioapics[idx].mpc_apicid = id; 669 - mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx); 777 + mp_ioapics[idx].mpc_apicver = 0; 670 778 671 779 /* 672 780 * Build basic IRQ lookup table to facilitate gsi->io_apic lookups ··· 677 785 mp_ioapic_routing[idx].gsi_end = gsi_base + 678 786 io_apic_get_redir_entries(idx); 679 787 680 - printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " 788 + printk(KERN_INFO "IOAPIC[%d]: apic_id %d, address 0x%x, " 681 789 "GSI %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, 682 - mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr, 790 + mp_ioapics[idx].mpc_apicaddr, 683 791 mp_ioapic_routing[idx].gsi_start, 684 792 mp_ioapic_routing[idx].gsi_end); 685 - 686 - return; 687 793 } 688 794 689 - 690 - void __init mp_override_legacy_irq ( 691 - u8 bus_irq, 692 - u8 polarity, 693 - u8 trigger, 694 - u32 gsi) 795 + void __init 796 + mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) 695 797 { 696 798 struct mpc_config_intsrc intsrc; 697 799 int ioapic = -1; ··· 723 837 mp_irqs[mp_irq_entries] = intsrc; 724 838 if (++mp_irq_entries == MAX_IRQ_SOURCES) 725 839 panic("Max # of irq sources exceeded!\n"); 726 - 727 - return; 728 840 } 729 841 730 - 731 - void __init mp_config_acpi_legacy_irqs (void) 842 + void __init mp_config_acpi_legacy_irqs(void) 732 843 { 733 844 struct mpc_config_intsrc intsrc; 734 - int i = 0; 735 - int ioapic = -1; 845 + int i = 0; 846 + int ioapic = -1; 736 847 737 848 /* 738 849 * Fabricate the legacy ISA bus (bus #31). 739 850 */ 740 - mp_bus_id_to_type[MP_ISA_BUS] = MP_BUS_ISA; 741 - Dprintk("Bus #%d is ISA\n", MP_ISA_BUS); 851 + set_bit(MP_ISA_BUS, mp_bus_not_pci); 742 852 743 853 /* 744 854 * Locate the IOAPIC that manages the ISA IRQs (0-15). ··· 787 905 if (++mp_irq_entries == MAX_IRQ_SOURCES) 788 906 panic("Max # of irq sources exceeded!\n"); 789 907 } 790 - 791 - return; 792 908 } 793 909 794 910 #define MAX_GSI_NUM 4096 795 911 796 912 int mp_register_gsi(u32 gsi, int triggering, int polarity) 797 913 { 798 - int ioapic = -1; 799 - int ioapic_pin = 0; 800 - int idx, bit = 0; 801 - static int pci_irq = 16; 914 + int ioapic = -1; 915 + int ioapic_pin = 0; 916 + int idx, bit = 0; 917 + static int pci_irq = 16; 802 918 /* 803 919 * Mapping between Global System Interrupts, which 804 920 * represent all possible interrupts, to the IRQs 805 921 * assigned to actual devices. 806 922 */ 807 - static int gsi_to_irq[MAX_GSI_NUM]; 923 + static int gsi_to_irq[MAX_GSI_NUM]; 808 924 809 925 if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) 810 926 return gsi; ··· 876 996 polarity == ACPI_ACTIVE_HIGH ? 0 : 1); 877 997 return gsi; 878 998 } 879 - 880 - #endif /*CONFIG_X86_IO_APIC*/ 881 999 #endif /*CONFIG_ACPI*/
+561 -287
arch/x86_64/kernel/nmi.c
··· 28 28 #include <asm/mce.h> 29 29 #include <asm/intel_arch_perfmon.h> 30 30 31 - /* 32 - * lapic_nmi_owner tracks the ownership of the lapic NMI hardware: 33 - * - it may be reserved by some other driver, or not 34 - * - when not reserved by some other driver, it may be used for 35 - * the NMI watchdog, or not 36 - * 37 - * This is maintained separately from nmi_active because the NMI 38 - * watchdog may also be driven from the I/O APIC timer. 31 + /* perfctr_nmi_owner tracks the ownership of the perfctr registers: 32 + * evtsel_nmi_owner tracks the ownership of the event selection 33 + * - different performance counters/ event selection may be reserved for 34 + * different subsystems this reservation system just tries to coordinate 35 + * things a little 39 36 */ 40 - static DEFINE_SPINLOCK(lapic_nmi_owner_lock); 41 - static unsigned int lapic_nmi_owner; 42 - #define LAPIC_NMI_WATCHDOG (1<<0) 43 - #define LAPIC_NMI_RESERVED (1<<1) 37 + static DEFINE_PER_CPU(unsigned, perfctr_nmi_owner); 38 + static DEFINE_PER_CPU(unsigned, evntsel_nmi_owner[2]); 39 + 40 + /* this number is calculated from Intel's MSR_P4_CRU_ESCR5 register and it's 41 + * offset from MSR_P4_BSU_ESCR0. It will be the max for all platforms (for now) 42 + */ 43 + #define NMI_MAX_COUNTER_BITS 66 44 44 45 45 /* nmi_active: 46 - * +1: the lapic NMI watchdog is active, but can be disabled 47 - * 0: the lapic NMI watchdog has not been set up, and cannot 46 + * >0: the lapic NMI watchdog is active, but can be disabled 47 + * <0: the lapic NMI watchdog has not been set up, and cannot 48 48 * be enabled 49 - * -1: the lapic NMI watchdog is disabled, but can be enabled 49 + * 0: the lapic NMI watchdog is disabled, but can be enabled 50 50 */ 51 - int nmi_active; /* oprofile uses this */ 51 + atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */ 52 52 int panic_on_timeout; 53 53 54 54 unsigned int nmi_watchdog = NMI_DEFAULT; 55 55 static unsigned int nmi_hz = HZ; 56 - static unsigned int nmi_perfctr_msr; /* the MSR to reset in NMI handler */ 57 - static unsigned int nmi_p4_cccr_val; 58 56 59 - /* Note that these events don't tick when the CPU idles. This means 60 - the frequency varies with CPU load. */ 57 + struct nmi_watchdog_ctlblk { 58 + int enabled; 59 + u64 check_bit; 60 + unsigned int cccr_msr; 61 + unsigned int perfctr_msr; /* the MSR to reset in NMI handler */ 62 + unsigned int evntsel_msr; /* the MSR to select the events to handle */ 63 + }; 64 + static DEFINE_PER_CPU(struct nmi_watchdog_ctlblk, nmi_watchdog_ctlblk); 61 65 62 - #define K7_EVNTSEL_ENABLE (1 << 22) 63 - #define K7_EVNTSEL_INT (1 << 20) 64 - #define K7_EVNTSEL_OS (1 << 17) 65 - #define K7_EVNTSEL_USR (1 << 16) 66 - #define K7_EVENT_CYCLES_PROCESSOR_IS_RUNNING 0x76 67 - #define K7_NMI_EVENT K7_EVENT_CYCLES_PROCESSOR_IS_RUNNING 66 + /* local prototypes */ 67 + static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu); 68 68 69 - #define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 70 - #define ARCH_PERFMON_NMI_EVENT_UMASK ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK 69 + /* converts an msr to an appropriate reservation bit */ 70 + static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr) 71 + { 72 + /* returns the bit offset of the performance counter register */ 73 + switch (boot_cpu_data.x86_vendor) { 74 + case X86_VENDOR_AMD: 75 + return (msr - MSR_K7_PERFCTR0); 76 + case X86_VENDOR_INTEL: 77 + if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) 78 + return (msr - MSR_ARCH_PERFMON_PERFCTR0); 79 + else 80 + return (msr - MSR_P4_BPU_PERFCTR0); 81 + } 82 + return 0; 83 + } 71 84 72 - #define MSR_P4_MISC_ENABLE 0x1A0 73 - #define MSR_P4_MISC_ENABLE_PERF_AVAIL (1<<7) 74 - #define MSR_P4_MISC_ENABLE_PEBS_UNAVAIL (1<<12) 75 - #define MSR_P4_PERFCTR0 0x300 76 - #define MSR_P4_CCCR0 0x360 77 - #define P4_ESCR_EVENT_SELECT(N) ((N)<<25) 78 - #define P4_ESCR_OS (1<<3) 79 - #define P4_ESCR_USR (1<<2) 80 - #define P4_CCCR_OVF_PMI0 (1<<26) 81 - #define P4_CCCR_OVF_PMI1 (1<<27) 82 - #define P4_CCCR_THRESHOLD(N) ((N)<<20) 83 - #define P4_CCCR_COMPLEMENT (1<<19) 84 - #define P4_CCCR_COMPARE (1<<18) 85 - #define P4_CCCR_REQUIRED (3<<16) 86 - #define P4_CCCR_ESCR_SELECT(N) ((N)<<13) 87 - #define P4_CCCR_ENABLE (1<<12) 88 - /* Set up IQ_COUNTER0 to behave like a clock, by having IQ_CCCR0 filter 89 - CRU_ESCR0 (with any non-null event selector) through a complemented 90 - max threshold. [IA32-Vol3, Section 14.9.9] */ 91 - #define MSR_P4_IQ_COUNTER0 0x30C 92 - #define P4_NMI_CRU_ESCR0 (P4_ESCR_EVENT_SELECT(0x3F)|P4_ESCR_OS|P4_ESCR_USR) 93 - #define P4_NMI_IQ_CCCR0 \ 94 - (P4_CCCR_OVF_PMI0|P4_CCCR_THRESHOLD(15)|P4_CCCR_COMPLEMENT| \ 95 - P4_CCCR_COMPARE|P4_CCCR_REQUIRED|P4_CCCR_ESCR_SELECT(4)|P4_CCCR_ENABLE) 85 + /* converts an msr to an appropriate reservation bit */ 86 + static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr) 87 + { 88 + /* returns the bit offset of the event selection register */ 89 + switch (boot_cpu_data.x86_vendor) { 90 + case X86_VENDOR_AMD: 91 + return (msr - MSR_K7_EVNTSEL0); 92 + case X86_VENDOR_INTEL: 93 + if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) 94 + return (msr - MSR_ARCH_PERFMON_EVENTSEL0); 95 + else 96 + return (msr - MSR_P4_BSU_ESCR0); 97 + } 98 + return 0; 99 + } 100 + 101 + /* checks for a bit availability (hack for oprofile) */ 102 + int avail_to_resrv_perfctr_nmi_bit(unsigned int counter) 103 + { 104 + BUG_ON(counter > NMI_MAX_COUNTER_BITS); 105 + 106 + return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 107 + } 108 + 109 + /* checks the an msr for availability */ 110 + int avail_to_resrv_perfctr_nmi(unsigned int msr) 111 + { 112 + unsigned int counter; 113 + 114 + counter = nmi_perfctr_msr_to_bit(msr); 115 + BUG_ON(counter > NMI_MAX_COUNTER_BITS); 116 + 117 + return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 118 + } 119 + 120 + int reserve_perfctr_nmi(unsigned int msr) 121 + { 122 + unsigned int counter; 123 + 124 + counter = nmi_perfctr_msr_to_bit(msr); 125 + BUG_ON(counter > NMI_MAX_COUNTER_BITS); 126 + 127 + if (!test_and_set_bit(counter, &__get_cpu_var(perfctr_nmi_owner))) 128 + return 1; 129 + return 0; 130 + } 131 + 132 + void release_perfctr_nmi(unsigned int msr) 133 + { 134 + unsigned int counter; 135 + 136 + counter = nmi_perfctr_msr_to_bit(msr); 137 + BUG_ON(counter > NMI_MAX_COUNTER_BITS); 138 + 139 + clear_bit(counter, &__get_cpu_var(perfctr_nmi_owner)); 140 + } 141 + 142 + int reserve_evntsel_nmi(unsigned int msr) 143 + { 144 + unsigned int counter; 145 + 146 + counter = nmi_evntsel_msr_to_bit(msr); 147 + BUG_ON(counter > NMI_MAX_COUNTER_BITS); 148 + 149 + if (!test_and_set_bit(counter, &__get_cpu_var(evntsel_nmi_owner))) 150 + return 1; 151 + return 0; 152 + } 153 + 154 + void release_evntsel_nmi(unsigned int msr) 155 + { 156 + unsigned int counter; 157 + 158 + counter = nmi_evntsel_msr_to_bit(msr); 159 + BUG_ON(counter > NMI_MAX_COUNTER_BITS); 160 + 161 + clear_bit(counter, &__get_cpu_var(evntsel_nmi_owner)); 162 + } 96 163 97 164 static __cpuinit inline int nmi_known_cpu(void) 98 165 { ··· 176 109 } 177 110 178 111 /* Run after command line and cpu_init init, but before all other checks */ 179 - void __cpuinit nmi_watchdog_default(void) 112 + void nmi_watchdog_default(void) 180 113 { 181 114 if (nmi_watchdog != NMI_DEFAULT) 182 115 return; ··· 212 145 int *counts; 213 146 int cpu; 214 147 148 + if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT)) 149 + return 0; 150 + 151 + if (!atomic_read(&nmi_active)) 152 + return 0; 153 + 215 154 counts = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL); 216 155 if (!counts) 217 156 return -1; ··· 235 162 mdelay((10*1000)/nmi_hz); // wait 10 ticks 236 163 237 164 for_each_online_cpu(cpu) { 165 + if (!per_cpu(nmi_watchdog_ctlblk, cpu).enabled) 166 + continue; 238 167 if (cpu_pda(cpu)->__nmi_count - counts[cpu] <= 5) { 239 - endflag = 1; 240 168 printk("CPU#%d: NMI appears to be stuck (%d->%d)!\n", 241 169 cpu, 242 170 counts[cpu], 243 171 cpu_pda(cpu)->__nmi_count); 244 - nmi_active = 0; 245 - lapic_nmi_owner &= ~LAPIC_NMI_WATCHDOG; 246 - nmi_perfctr_msr = 0; 247 - kfree(counts); 248 - return -1; 172 + per_cpu(nmi_watchdog_ctlblk, cpu).enabled = 0; 173 + atomic_dec(&nmi_active); 249 174 } 175 + } 176 + if (!atomic_read(&nmi_active)) { 177 + kfree(counts); 178 + atomic_set(&nmi_active, -1); 179 + return -1; 250 180 } 251 181 endflag = 1; 252 182 printk("OK.\n"); 253 183 254 184 /* now that we know it works we can reduce NMI frequency to 255 185 something more reasonable; makes a difference in some configs */ 256 - if (nmi_watchdog == NMI_LOCAL_APIC) 186 + if (nmi_watchdog == NMI_LOCAL_APIC) { 187 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 188 + 257 189 nmi_hz = 1; 190 + /* 191 + * On Intel CPUs with ARCH_PERFMON only 32 bits in the counter 192 + * are writable, with higher bits sign extending from bit 31. 193 + * So, we can only program the counter with 31 bit values and 194 + * 32nd bit should be 1, for 33.. to be 1. 195 + * Find the appropriate nmi_hz 196 + */ 197 + if (wd->perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0 && 198 + ((u64)cpu_khz * 1000) > 0x7fffffffULL) { 199 + nmi_hz = ((u64)cpu_khz * 1000) / 0x7fffffffUL + 1; 200 + } 201 + } 258 202 259 203 kfree(counts); 260 204 return 0; ··· 291 201 292 202 get_option(&str, &nmi); 293 203 294 - if (nmi >= NMI_INVALID) 204 + if ((nmi >= NMI_INVALID) || (nmi < NMI_NONE)) 295 205 return 0; 206 + 207 + if ((nmi == NMI_LOCAL_APIC) && (nmi_known_cpu() == 0)) 208 + return 0; /* no lapic support */ 296 209 nmi_watchdog = nmi; 297 210 return 1; 298 211 } 299 212 300 213 __setup("nmi_watchdog=", setup_nmi_watchdog); 301 214 302 - static void disable_intel_arch_watchdog(void); 303 - 304 215 static void disable_lapic_nmi_watchdog(void) 305 216 { 306 - if (nmi_active <= 0) 217 + BUG_ON(nmi_watchdog != NMI_LOCAL_APIC); 218 + 219 + if (atomic_read(&nmi_active) <= 0) 307 220 return; 308 - switch (boot_cpu_data.x86_vendor) { 309 - case X86_VENDOR_AMD: 310 - wrmsr(MSR_K7_EVNTSEL0, 0, 0); 311 - break; 312 - case X86_VENDOR_INTEL: 313 - if (boot_cpu_data.x86 == 15) { 314 - wrmsr(MSR_P4_IQ_CCCR0, 0, 0); 315 - wrmsr(MSR_P4_CRU_ESCR0, 0, 0); 316 - } else if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) { 317 - disable_intel_arch_watchdog(); 318 - } 319 - break; 320 - } 321 - nmi_active = -1; 322 - /* tell do_nmi() and others that we're not active any more */ 323 - nmi_watchdog = 0; 221 + 222 + on_each_cpu(stop_apic_nmi_watchdog, NULL, 0, 1); 223 + 224 + BUG_ON(atomic_read(&nmi_active) != 0); 324 225 } 325 226 326 227 static void enable_lapic_nmi_watchdog(void) 327 228 { 328 - if (nmi_active < 0) { 329 - nmi_watchdog = NMI_LOCAL_APIC; 330 - touch_nmi_watchdog(); 331 - setup_apic_nmi_watchdog(); 332 - } 333 - } 229 + BUG_ON(nmi_watchdog != NMI_LOCAL_APIC); 334 230 335 - int reserve_lapic_nmi(void) 336 - { 337 - unsigned int old_owner; 231 + /* are we already enabled */ 232 + if (atomic_read(&nmi_active) != 0) 233 + return; 338 234 339 - spin_lock(&lapic_nmi_owner_lock); 340 - old_owner = lapic_nmi_owner; 341 - lapic_nmi_owner |= LAPIC_NMI_RESERVED; 342 - spin_unlock(&lapic_nmi_owner_lock); 343 - if (old_owner & LAPIC_NMI_RESERVED) 344 - return -EBUSY; 345 - if (old_owner & LAPIC_NMI_WATCHDOG) 346 - disable_lapic_nmi_watchdog(); 347 - return 0; 348 - } 235 + /* are we lapic aware */ 236 + if (nmi_known_cpu() <= 0) 237 + return; 349 238 350 - void release_lapic_nmi(void) 351 - { 352 - unsigned int new_owner; 353 - 354 - spin_lock(&lapic_nmi_owner_lock); 355 - new_owner = lapic_nmi_owner & ~LAPIC_NMI_RESERVED; 356 - lapic_nmi_owner = new_owner; 357 - spin_unlock(&lapic_nmi_owner_lock); 358 - if (new_owner & LAPIC_NMI_WATCHDOG) 359 - enable_lapic_nmi_watchdog(); 239 + on_each_cpu(setup_apic_nmi_watchdog, NULL, 0, 1); 240 + touch_nmi_watchdog(); 360 241 } 361 242 362 243 void disable_timer_nmi_watchdog(void) 363 244 { 364 - if ((nmi_watchdog != NMI_IO_APIC) || (nmi_active <= 0)) 245 + BUG_ON(nmi_watchdog != NMI_IO_APIC); 246 + 247 + if (atomic_read(&nmi_active) <= 0) 365 248 return; 366 249 367 250 disable_irq(0); 368 - unset_nmi_callback(); 369 - nmi_active = -1; 370 - nmi_watchdog = NMI_NONE; 251 + on_each_cpu(stop_apic_nmi_watchdog, NULL, 0, 1); 252 + 253 + BUG_ON(atomic_read(&nmi_active) != 0); 371 254 } 372 255 373 256 void enable_timer_nmi_watchdog(void) 374 257 { 375 - if (nmi_active < 0) { 376 - nmi_watchdog = NMI_IO_APIC; 258 + BUG_ON(nmi_watchdog != NMI_IO_APIC); 259 + 260 + if (atomic_read(&nmi_active) == 0) { 377 261 touch_nmi_watchdog(); 378 - nmi_active = 1; 262 + on_each_cpu(setup_apic_nmi_watchdog, NULL, 0, 1); 379 263 enable_irq(0); 380 264 } 381 265 } ··· 360 296 361 297 static int lapic_nmi_suspend(struct sys_device *dev, pm_message_t state) 362 298 { 363 - nmi_pm_active = nmi_active; 364 - disable_lapic_nmi_watchdog(); 299 + /* only CPU0 goes here, other CPUs should be offline */ 300 + nmi_pm_active = atomic_read(&nmi_active); 301 + stop_apic_nmi_watchdog(NULL); 302 + BUG_ON(atomic_read(&nmi_active) != 0); 365 303 return 0; 366 304 } 367 305 368 306 static int lapic_nmi_resume(struct sys_device *dev) 369 307 { 370 - if (nmi_pm_active > 0) 371 - enable_lapic_nmi_watchdog(); 308 + /* only CPU0 goes here, other CPUs should be offline */ 309 + if (nmi_pm_active > 0) { 310 + setup_apic_nmi_watchdog(NULL); 311 + touch_nmi_watchdog(); 312 + } 372 313 return 0; 373 314 } 374 315 ··· 392 323 { 393 324 int error; 394 325 395 - if (nmi_active == 0 || nmi_watchdog != NMI_LOCAL_APIC) 326 + /* should really be a BUG_ON but b/c this is an 327 + * init call, it just doesn't work. -dcz 328 + */ 329 + if (nmi_watchdog != NMI_LOCAL_APIC) 330 + return 0; 331 + 332 + if ( atomic_read(&nmi_active) < 0 ) 396 333 return 0; 397 334 398 335 error = sysdev_class_register(&nmi_sysclass); ··· 416 341 * Original code written by Keith Owens. 417 342 */ 418 343 419 - static void clear_msr_range(unsigned int base, unsigned int n) 420 - { 421 - unsigned int i; 344 + /* Note that these events don't tick when the CPU idles. This means 345 + the frequency varies with CPU load. */ 422 346 423 - for(i = 0; i < n; ++i) 424 - wrmsr(base+i, 0, 0); 425 - } 347 + #define K7_EVNTSEL_ENABLE (1 << 22) 348 + #define K7_EVNTSEL_INT (1 << 20) 349 + #define K7_EVNTSEL_OS (1 << 17) 350 + #define K7_EVNTSEL_USR (1 << 16) 351 + #define K7_EVENT_CYCLES_PROCESSOR_IS_RUNNING 0x76 352 + #define K7_NMI_EVENT K7_EVENT_CYCLES_PROCESSOR_IS_RUNNING 426 353 427 - static void setup_k7_watchdog(void) 354 + static int setup_k7_watchdog(void) 428 355 { 429 - int i; 356 + unsigned int perfctr_msr, evntsel_msr; 430 357 unsigned int evntsel; 358 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 431 359 432 - nmi_perfctr_msr = MSR_K7_PERFCTR0; 360 + perfctr_msr = MSR_K7_PERFCTR0; 361 + evntsel_msr = MSR_K7_EVNTSEL0; 362 + if (!reserve_perfctr_nmi(perfctr_msr)) 363 + goto fail; 433 364 434 - for(i = 0; i < 4; ++i) { 435 - /* Simulator may not support it */ 436 - if (checking_wrmsrl(MSR_K7_EVNTSEL0+i, 0UL)) { 437 - nmi_perfctr_msr = 0; 438 - return; 439 - } 440 - wrmsrl(MSR_K7_PERFCTR0+i, 0UL); 441 - } 365 + if (!reserve_evntsel_nmi(evntsel_msr)) 366 + goto fail1; 367 + 368 + /* Simulator may not support it */ 369 + if (checking_wrmsrl(evntsel_msr, 0UL)) 370 + goto fail2; 371 + wrmsrl(perfctr_msr, 0UL); 442 372 443 373 evntsel = K7_EVNTSEL_INT 444 374 | K7_EVNTSEL_OS 445 375 | K7_EVNTSEL_USR 446 376 | K7_NMI_EVENT; 447 377 448 - wrmsr(MSR_K7_EVNTSEL0, evntsel, 0); 449 - wrmsrl(MSR_K7_PERFCTR0, -((u64)cpu_khz * 1000 / nmi_hz)); 378 + /* setup the timer */ 379 + wrmsr(evntsel_msr, evntsel, 0); 380 + wrmsrl(perfctr_msr, -((u64)cpu_khz * 1000 / nmi_hz)); 450 381 apic_write(APIC_LVTPC, APIC_DM_NMI); 451 382 evntsel |= K7_EVNTSEL_ENABLE; 452 - wrmsr(MSR_K7_EVNTSEL0, evntsel, 0); 383 + wrmsr(evntsel_msr, evntsel, 0); 384 + 385 + wd->perfctr_msr = perfctr_msr; 386 + wd->evntsel_msr = evntsel_msr; 387 + wd->cccr_msr = 0; //unused 388 + wd->check_bit = 1ULL<<63; 389 + return 1; 390 + fail2: 391 + release_evntsel_nmi(evntsel_msr); 392 + fail1: 393 + release_perfctr_nmi(perfctr_msr); 394 + fail: 395 + return 0; 453 396 } 454 397 455 - static void disable_intel_arch_watchdog(void) 398 + static void stop_k7_watchdog(void) 456 399 { 457 - unsigned ebx; 400 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 458 401 459 - /* 460 - * Check whether the Architectural PerfMon supports 461 - * Unhalted Core Cycles Event or not. 462 - * NOTE: Corresponding bit = 0 in ebp indicates event present. 463 - */ 464 - ebx = cpuid_ebx(10); 465 - if (!(ebx & ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT)) 466 - wrmsr(MSR_ARCH_PERFMON_EVENTSEL0, 0, 0); 402 + wrmsr(wd->evntsel_msr, 0, 0); 403 + 404 + release_evntsel_nmi(wd->evntsel_msr); 405 + release_perfctr_nmi(wd->perfctr_msr); 467 406 } 407 + 408 + /* Note that these events don't tick when the CPU idles. This means 409 + the frequency varies with CPU load. */ 410 + 411 + #define MSR_P4_MISC_ENABLE_PERF_AVAIL (1<<7) 412 + #define P4_ESCR_EVENT_SELECT(N) ((N)<<25) 413 + #define P4_ESCR_OS (1<<3) 414 + #define P4_ESCR_USR (1<<2) 415 + #define P4_CCCR_OVF_PMI0 (1<<26) 416 + #define P4_CCCR_OVF_PMI1 (1<<27) 417 + #define P4_CCCR_THRESHOLD(N) ((N)<<20) 418 + #define P4_CCCR_COMPLEMENT (1<<19) 419 + #define P4_CCCR_COMPARE (1<<18) 420 + #define P4_CCCR_REQUIRED (3<<16) 421 + #define P4_CCCR_ESCR_SELECT(N) ((N)<<13) 422 + #define P4_CCCR_ENABLE (1<<12) 423 + #define P4_CCCR_OVF (1<<31) 424 + /* Set up IQ_COUNTER0 to behave like a clock, by having IQ_CCCR0 filter 425 + CRU_ESCR0 (with any non-null event selector) through a complemented 426 + max threshold. [IA32-Vol3, Section 14.9.9] */ 427 + 428 + static int setup_p4_watchdog(void) 429 + { 430 + unsigned int perfctr_msr, evntsel_msr, cccr_msr; 431 + unsigned int evntsel, cccr_val; 432 + unsigned int misc_enable, dummy; 433 + unsigned int ht_num; 434 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 435 + 436 + rdmsr(MSR_IA32_MISC_ENABLE, misc_enable, dummy); 437 + if (!(misc_enable & MSR_P4_MISC_ENABLE_PERF_AVAIL)) 438 + return 0; 439 + 440 + #ifdef CONFIG_SMP 441 + /* detect which hyperthread we are on */ 442 + if (smp_num_siblings == 2) { 443 + unsigned int ebx, apicid; 444 + 445 + ebx = cpuid_ebx(1); 446 + apicid = (ebx >> 24) & 0xff; 447 + ht_num = apicid & 1; 448 + } else 449 + #endif 450 + ht_num = 0; 451 + 452 + /* performance counters are shared resources 453 + * assign each hyperthread its own set 454 + * (re-use the ESCR0 register, seems safe 455 + * and keeps the cccr_val the same) 456 + */ 457 + if (!ht_num) { 458 + /* logical cpu 0 */ 459 + perfctr_msr = MSR_P4_IQ_PERFCTR0; 460 + evntsel_msr = MSR_P4_CRU_ESCR0; 461 + cccr_msr = MSR_P4_IQ_CCCR0; 462 + cccr_val = P4_CCCR_OVF_PMI0 | P4_CCCR_ESCR_SELECT(4); 463 + } else { 464 + /* logical cpu 1 */ 465 + perfctr_msr = MSR_P4_IQ_PERFCTR1; 466 + evntsel_msr = MSR_P4_CRU_ESCR0; 467 + cccr_msr = MSR_P4_IQ_CCCR1; 468 + cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4); 469 + } 470 + 471 + if (!reserve_perfctr_nmi(perfctr_msr)) 472 + goto fail; 473 + 474 + if (!reserve_evntsel_nmi(evntsel_msr)) 475 + goto fail1; 476 + 477 + evntsel = P4_ESCR_EVENT_SELECT(0x3F) 478 + | P4_ESCR_OS 479 + | P4_ESCR_USR; 480 + 481 + cccr_val |= P4_CCCR_THRESHOLD(15) 482 + | P4_CCCR_COMPLEMENT 483 + | P4_CCCR_COMPARE 484 + | P4_CCCR_REQUIRED; 485 + 486 + wrmsr(evntsel_msr, evntsel, 0); 487 + wrmsr(cccr_msr, cccr_val, 0); 488 + wrmsrl(perfctr_msr, -((u64)cpu_khz * 1000 / nmi_hz)); 489 + apic_write(APIC_LVTPC, APIC_DM_NMI); 490 + cccr_val |= P4_CCCR_ENABLE; 491 + wrmsr(cccr_msr, cccr_val, 0); 492 + 493 + wd->perfctr_msr = perfctr_msr; 494 + wd->evntsel_msr = evntsel_msr; 495 + wd->cccr_msr = cccr_msr; 496 + wd->check_bit = 1ULL<<39; 497 + return 1; 498 + fail1: 499 + release_perfctr_nmi(perfctr_msr); 500 + fail: 501 + return 0; 502 + } 503 + 504 + static void stop_p4_watchdog(void) 505 + { 506 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 507 + 508 + wrmsr(wd->cccr_msr, 0, 0); 509 + wrmsr(wd->evntsel_msr, 0, 0); 510 + 511 + release_evntsel_nmi(wd->evntsel_msr); 512 + release_perfctr_nmi(wd->perfctr_msr); 513 + } 514 + 515 + #define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 516 + #define ARCH_PERFMON_NMI_EVENT_UMASK ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK 468 517 469 518 static int setup_intel_arch_watchdog(void) 470 519 { 520 + unsigned int ebx; 521 + union cpuid10_eax eax; 522 + unsigned int unused; 523 + unsigned int perfctr_msr, evntsel_msr; 471 524 unsigned int evntsel; 472 - unsigned ebx; 525 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 473 526 474 527 /* 475 528 * Check whether the Architectural PerfMon supports 476 529 * Unhalted Core Cycles Event or not. 477 - * NOTE: Corresponding bit = 0 in ebp indicates event present. 530 + * NOTE: Corresponding bit = 0 in ebx indicates event present. 478 531 */ 479 - ebx = cpuid_ebx(10); 480 - if ((ebx & ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT)) 481 - return 0; 532 + cpuid(10, &(eax.full), &ebx, &unused, &unused); 533 + if ((eax.split.mask_length < (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX+1)) || 534 + (ebx & ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT)) 535 + goto fail; 482 536 483 - nmi_perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0; 537 + perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0; 538 + evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0; 484 539 485 - clear_msr_range(MSR_ARCH_PERFMON_EVENTSEL0, 2); 486 - clear_msr_range(MSR_ARCH_PERFMON_PERFCTR0, 2); 540 + if (!reserve_perfctr_nmi(perfctr_msr)) 541 + goto fail; 542 + 543 + if (!reserve_evntsel_nmi(evntsel_msr)) 544 + goto fail1; 545 + 546 + wrmsrl(perfctr_msr, 0UL); 487 547 488 548 evntsel = ARCH_PERFMON_EVENTSEL_INT 489 549 | ARCH_PERFMON_EVENTSEL_OS ··· 626 416 | ARCH_PERFMON_NMI_EVENT_SEL 627 417 | ARCH_PERFMON_NMI_EVENT_UMASK; 628 418 629 - wrmsr(MSR_ARCH_PERFMON_EVENTSEL0, evntsel, 0); 630 - wrmsrl(MSR_ARCH_PERFMON_PERFCTR0, -((u64)cpu_khz * 1000 / nmi_hz)); 419 + /* setup the timer */ 420 + wrmsr(evntsel_msr, evntsel, 0); 421 + wrmsrl(perfctr_msr, -((u64)cpu_khz * 1000 / nmi_hz)); 422 + 631 423 apic_write(APIC_LVTPC, APIC_DM_NMI); 632 424 evntsel |= ARCH_PERFMON_EVENTSEL0_ENABLE; 633 - wrmsr(MSR_ARCH_PERFMON_EVENTSEL0, evntsel, 0); 425 + wrmsr(evntsel_msr, evntsel, 0); 426 + 427 + wd->perfctr_msr = perfctr_msr; 428 + wd->evntsel_msr = evntsel_msr; 429 + wd->cccr_msr = 0; //unused 430 + wd->check_bit = 1ULL << (eax.split.bit_width - 1); 634 431 return 1; 432 + fail1: 433 + release_perfctr_nmi(perfctr_msr); 434 + fail: 435 + return 0; 635 436 } 636 437 637 - 638 - static int setup_p4_watchdog(void) 438 + static void stop_intel_arch_watchdog(void) 639 439 { 640 - unsigned int misc_enable, dummy; 440 + unsigned int ebx; 441 + union cpuid10_eax eax; 442 + unsigned int unused; 443 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 641 444 642 - rdmsr(MSR_P4_MISC_ENABLE, misc_enable, dummy); 643 - if (!(misc_enable & MSR_P4_MISC_ENABLE_PERF_AVAIL)) 644 - return 0; 445 + /* 446 + * Check whether the Architectural PerfMon supports 447 + * Unhalted Core Cycles Event or not. 448 + * NOTE: Corresponding bit = 0 in ebx indicates event present. 449 + */ 450 + cpuid(10, &(eax.full), &ebx, &unused, &unused); 451 + if ((eax.split.mask_length < (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX+1)) || 452 + (ebx & ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT)) 453 + return; 645 454 646 - nmi_perfctr_msr = MSR_P4_IQ_COUNTER0; 647 - nmi_p4_cccr_val = P4_NMI_IQ_CCCR0; 648 - #ifdef CONFIG_SMP 649 - if (smp_num_siblings == 2) 650 - nmi_p4_cccr_val |= P4_CCCR_OVF_PMI1; 651 - #endif 455 + wrmsr(wd->evntsel_msr, 0, 0); 652 456 653 - if (!(misc_enable & MSR_P4_MISC_ENABLE_PEBS_UNAVAIL)) 654 - clear_msr_range(0x3F1, 2); 655 - /* MSR 0x3F0 seems to have a default value of 0xFC00, but current 656 - docs doesn't fully define it, so leave it alone for now. */ 657 - if (boot_cpu_data.x86_model >= 0x3) { 658 - /* MSR_P4_IQ_ESCR0/1 (0x3ba/0x3bb) removed */ 659 - clear_msr_range(0x3A0, 26); 660 - clear_msr_range(0x3BC, 3); 661 - } else { 662 - clear_msr_range(0x3A0, 31); 663 - } 664 - clear_msr_range(0x3C0, 6); 665 - clear_msr_range(0x3C8, 6); 666 - clear_msr_range(0x3E0, 2); 667 - clear_msr_range(MSR_P4_CCCR0, 18); 668 - clear_msr_range(MSR_P4_PERFCTR0, 18); 669 - 670 - wrmsr(MSR_P4_CRU_ESCR0, P4_NMI_CRU_ESCR0, 0); 671 - wrmsr(MSR_P4_IQ_CCCR0, P4_NMI_IQ_CCCR0 & ~P4_CCCR_ENABLE, 0); 672 - Dprintk("setting P4_IQ_COUNTER0 to 0x%08lx\n", -(cpu_khz * 1000UL / nmi_hz)); 673 - wrmsrl(MSR_P4_IQ_COUNTER0, -((u64)cpu_khz * 1000 / nmi_hz)); 674 - apic_write(APIC_LVTPC, APIC_DM_NMI); 675 - wrmsr(MSR_P4_IQ_CCCR0, nmi_p4_cccr_val, 0); 676 - return 1; 457 + release_evntsel_nmi(wd->evntsel_msr); 458 + release_perfctr_nmi(wd->perfctr_msr); 677 459 } 678 460 679 - void setup_apic_nmi_watchdog(void) 461 + void setup_apic_nmi_watchdog(void *unused) 680 462 { 681 - switch (boot_cpu_data.x86_vendor) { 682 - case X86_VENDOR_AMD: 683 - if (boot_cpu_data.x86 != 15) 684 - return; 685 - if (strstr(boot_cpu_data.x86_model_id, "Screwdriver")) 686 - return; 687 - setup_k7_watchdog(); 688 - break; 689 - case X86_VENDOR_INTEL: 690 - if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) { 691 - if (!setup_intel_arch_watchdog()) 463 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 464 + 465 + /* only support LOCAL and IO APICs for now */ 466 + if ((nmi_watchdog != NMI_LOCAL_APIC) && 467 + (nmi_watchdog != NMI_IO_APIC)) 468 + return; 469 + 470 + if (wd->enabled == 1) 471 + return; 472 + 473 + /* cheap hack to support suspend/resume */ 474 + /* if cpu0 is not active neither should the other cpus */ 475 + if ((smp_processor_id() != 0) && (atomic_read(&nmi_active) <= 0)) 476 + return; 477 + 478 + if (nmi_watchdog == NMI_LOCAL_APIC) { 479 + switch (boot_cpu_data.x86_vendor) { 480 + case X86_VENDOR_AMD: 481 + if (strstr(boot_cpu_data.x86_model_id, "Screwdriver")) 692 482 return; 693 - } else if (boot_cpu_data.x86 == 15) { 483 + if (!setup_k7_watchdog()) 484 + return; 485 + break; 486 + case X86_VENDOR_INTEL: 487 + if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) { 488 + if (!setup_intel_arch_watchdog()) 489 + return; 490 + break; 491 + } 694 492 if (!setup_p4_watchdog()) 695 493 return; 696 - } else { 494 + break; 495 + default: 697 496 return; 698 497 } 699 - 700 - break; 701 - 702 - default: 703 - return; 704 498 } 705 - lapic_nmi_owner = LAPIC_NMI_WATCHDOG; 706 - nmi_active = 1; 499 + wd->enabled = 1; 500 + atomic_inc(&nmi_active); 501 + } 502 + 503 + void stop_apic_nmi_watchdog(void *unused) 504 + { 505 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 506 + 507 + /* only support LOCAL and IO APICs for now */ 508 + if ((nmi_watchdog != NMI_LOCAL_APIC) && 509 + (nmi_watchdog != NMI_IO_APIC)) 510 + return; 511 + 512 + if (wd->enabled == 0) 513 + return; 514 + 515 + if (nmi_watchdog == NMI_LOCAL_APIC) { 516 + switch (boot_cpu_data.x86_vendor) { 517 + case X86_VENDOR_AMD: 518 + if (strstr(boot_cpu_data.x86_model_id, "Screwdriver")) 519 + return; 520 + stop_k7_watchdog(); 521 + break; 522 + case X86_VENDOR_INTEL: 523 + if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) { 524 + stop_intel_arch_watchdog(); 525 + break; 526 + } 527 + stop_p4_watchdog(); 528 + break; 529 + default: 530 + return; 531 + } 532 + } 533 + wd->enabled = 0; 534 + atomic_dec(&nmi_active); 707 535 } 708 536 709 537 /* ··· 774 526 touch_softlockup_watchdog(); 775 527 } 776 528 777 - void __kprobes nmi_watchdog_tick(struct pt_regs * regs, unsigned reason) 529 + int __kprobes nmi_watchdog_tick(struct pt_regs * regs, unsigned reason) 778 530 { 779 531 int sum; 780 532 int touched = 0; 533 + struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 534 + u64 dummy; 535 + int rc=0; 536 + 537 + /* check for other users first */ 538 + if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) 539 + == NOTIFY_STOP) { 540 + rc = 1; 541 + touched = 1; 542 + } 781 543 782 544 sum = read_pda(apic_timer_irqs); 783 545 if (__get_cpu_var(nmi_touch)) { 784 546 __get_cpu_var(nmi_touch) = 0; 785 547 touched = 1; 786 548 } 549 + 787 550 #ifdef CONFIG_X86_MCE 788 551 /* Could check oops_in_progress here too, but it's safer 789 552 not too */ 790 553 if (atomic_read(&mce_entry) > 0) 791 554 touched = 1; 792 555 #endif 556 + /* if the apic timer isn't firing, this cpu isn't doing much */ 793 557 if (!touched && __get_cpu_var(last_irq_sum) == sum) { 794 558 /* 795 559 * Ayiee, looks like this CPU is stuck ... 796 560 * wait a few IRQs (5 seconds) before doing the oops ... 797 561 */ 798 562 local_inc(&__get_cpu_var(alert_counter)); 799 - if (local_read(&__get_cpu_var(alert_counter)) == 5*nmi_hz) { 800 - if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) 801 - == NOTIFY_STOP) { 802 - local_set(&__get_cpu_var(alert_counter), 0); 803 - return; 804 - } 805 - die_nmi("NMI Watchdog detected LOCKUP on CPU %d\n", regs); 806 - } 563 + if (local_read(&__get_cpu_var(alert_counter)) == 5*nmi_hz) 564 + die_nmi("NMI Watchdog detected LOCKUP on CPU %d\n", regs, 565 + panic_on_timeout); 807 566 } else { 808 567 __get_cpu_var(last_irq_sum) = sum; 809 568 local_set(&__get_cpu_var(alert_counter), 0); 810 569 } 811 - if (nmi_perfctr_msr) { 812 - if (nmi_perfctr_msr == MSR_P4_IQ_COUNTER0) { 813 - /* 814 - * P4 quirks: 815 - * - An overflown perfctr will assert its interrupt 816 - * until the OVF flag in its CCCR is cleared. 817 - * - LVTPC is masked on interrupt and must be 818 - * unmasked by the LVTPC handler. 819 - */ 820 - wrmsr(MSR_P4_IQ_CCCR0, nmi_p4_cccr_val, 0); 821 - apic_write(APIC_LVTPC, APIC_DM_NMI); 822 - } else if (nmi_perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0) { 823 - /* 824 - * For Intel based architectural perfmon 825 - * - LVTPC is masked on interrupt and must be 826 - * unmasked by the LVTPC handler. 570 + 571 + /* see if the nmi watchdog went off */ 572 + if (wd->enabled) { 573 + if (nmi_watchdog == NMI_LOCAL_APIC) { 574 + rdmsrl(wd->perfctr_msr, dummy); 575 + if (dummy & wd->check_bit){ 576 + /* this wasn't a watchdog timer interrupt */ 577 + goto done; 578 + } 579 + 580 + /* only Intel uses the cccr msr */ 581 + if (wd->cccr_msr != 0) { 582 + /* 583 + * P4 quirks: 584 + * - An overflown perfctr will assert its interrupt 585 + * until the OVF flag in its CCCR is cleared. 586 + * - LVTPC is masked on interrupt and must be 587 + * unmasked by the LVTPC handler. 588 + */ 589 + rdmsrl(wd->cccr_msr, dummy); 590 + dummy &= ~P4_CCCR_OVF; 591 + wrmsrl(wd->cccr_msr, dummy); 592 + apic_write(APIC_LVTPC, APIC_DM_NMI); 593 + } else if (wd->perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0) { 594 + /* 595 + * ArchPerfom/Core Duo needs to re-unmask 596 + * the apic vector 597 + */ 598 + apic_write(APIC_LVTPC, APIC_DM_NMI); 599 + } 600 + /* start the cycle over again */ 601 + wrmsrl(wd->perfctr_msr, -((u64)cpu_khz * 1000 / nmi_hz)); 602 + rc = 1; 603 + } else if (nmi_watchdog == NMI_IO_APIC) { 604 + /* don't know how to accurately check for this. 605 + * just assume it was a watchdog timer interrupt 606 + * This matches the old behaviour. 827 607 */ 828 - apic_write(APIC_LVTPC, APIC_DM_NMI); 829 - } 830 - wrmsrl(nmi_perfctr_msr, -((u64)cpu_khz * 1000 / nmi_hz)); 608 + rc = 1; 609 + } else 610 + printk(KERN_WARNING "Unknown enabled NMI hardware?!\n"); 831 611 } 612 + done: 613 + return rc; 832 614 } 833 615 834 - static __kprobes int dummy_nmi_callback(struct pt_regs * regs, int cpu) 835 - { 836 - return 0; 837 - } 838 - 839 - static nmi_callback_t nmi_callback = dummy_nmi_callback; 840 - 841 616 asmlinkage __kprobes void do_nmi(struct pt_regs * regs, long error_code) 842 617 { 843 - int cpu = safe_smp_processor_id(); 844 - 845 618 nmi_enter(); 846 619 add_pda(__nmi_count,1); 847 - if (!rcu_dereference(nmi_callback)(regs, cpu)) 848 - default_do_nmi(regs); 620 + default_do_nmi(regs); 849 621 nmi_exit(); 850 622 } 851 623 852 - void set_nmi_callback(nmi_callback_t callback) 624 + int do_nmi_callback(struct pt_regs * regs, int cpu) 853 625 { 854 - vmalloc_sync_all(); 855 - rcu_assign_pointer(nmi_callback, callback); 626 + #ifdef CONFIG_SYSCTL 627 + if (unknown_nmi_panic) 628 + return unknown_nmi_panic_callback(regs, cpu); 629 + #endif 630 + return 0; 856 631 } 857 - EXPORT_SYMBOL_GPL(set_nmi_callback); 858 - 859 - void unset_nmi_callback(void) 860 - { 861 - nmi_callback = dummy_nmi_callback; 862 - } 863 - EXPORT_SYMBOL_GPL(unset_nmi_callback); 864 632 865 633 #ifdef CONFIG_SYSCTL 866 634 ··· 885 621 unsigned char reason = get_nmi_reason(); 886 622 char buf[64]; 887 623 888 - if (!(reason & 0xc0)) { 889 - sprintf(buf, "NMI received for unknown reason %02x\n", reason); 890 - die_nmi(buf,regs); 891 - } 624 + sprintf(buf, "NMI received for unknown reason %02x\n", reason); 625 + die_nmi(buf, regs, 1); /* Always panic here */ 892 626 return 0; 893 627 } 894 628 895 629 /* 896 - * proc handler for /proc/sys/kernel/unknown_nmi_panic 630 + * proc handler for /proc/sys/kernel/nmi 897 631 */ 898 - int proc_unknown_nmi_panic(struct ctl_table *table, int write, struct file *file, 632 + int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file, 899 633 void __user *buffer, size_t *length, loff_t *ppos) 900 634 { 901 635 int old_state; 902 636 903 - old_state = unknown_nmi_panic; 637 + nmi_watchdog_enabled = (atomic_read(&nmi_active) > 0) ? 1 : 0; 638 + old_state = nmi_watchdog_enabled; 904 639 proc_dointvec(table, write, file, buffer, length, ppos); 905 - if (!!old_state == !!unknown_nmi_panic) 640 + if (!!old_state == !!nmi_watchdog_enabled) 906 641 return 0; 907 642 908 - if (unknown_nmi_panic) { 909 - if (reserve_lapic_nmi() < 0) { 910 - unknown_nmi_panic = 0; 911 - return -EBUSY; 912 - } else { 913 - set_nmi_callback(unknown_nmi_panic_callback); 914 - } 643 + if (atomic_read(&nmi_active) < 0) { 644 + printk( KERN_WARNING "NMI watchdog is permanently disabled\n"); 645 + return -EIO; 646 + } 647 + 648 + /* if nmi_watchdog is not set yet, then set it */ 649 + nmi_watchdog_default(); 650 + 651 + if (nmi_watchdog == NMI_LOCAL_APIC) { 652 + if (nmi_watchdog_enabled) 653 + enable_lapic_nmi_watchdog(); 654 + else 655 + disable_lapic_nmi_watchdog(); 915 656 } else { 916 - release_lapic_nmi(); 917 - unset_nmi_callback(); 657 + printk( KERN_WARNING 658 + "NMI watchdog doesn't know what hardware to touch\n"); 659 + return -EIO; 918 660 } 919 661 return 0; 920 662 } ··· 929 659 930 660 EXPORT_SYMBOL(nmi_active); 931 661 EXPORT_SYMBOL(nmi_watchdog); 932 - EXPORT_SYMBOL(reserve_lapic_nmi); 933 - EXPORT_SYMBOL(release_lapic_nmi); 662 + EXPORT_SYMBOL(avail_to_resrv_perfctr_nmi); 663 + EXPORT_SYMBOL(avail_to_resrv_perfctr_nmi_bit); 664 + EXPORT_SYMBOL(reserve_perfctr_nmi); 665 + EXPORT_SYMBOL(release_perfctr_nmi); 666 + EXPORT_SYMBOL(reserve_evntsel_nmi); 667 + EXPORT_SYMBOL(release_evntsel_nmi); 934 668 EXPORT_SYMBOL(disable_timer_nmi_watchdog); 935 669 EXPORT_SYMBOL(enable_timer_nmi_watchdog); 936 670 EXPORT_SYMBOL(touch_nmi_watchdog);
+90 -52
arch/x86_64/kernel/pci-calgary.c
··· 86 86 87 87 #define MAX_NUM_OF_PHBS 8 /* how many PHBs in total? */ 88 88 #define MAX_NUM_CHASSIS 8 /* max number of chassis */ 89 - #define MAX_PHB_BUS_NUM (MAX_NUM_OF_PHBS * MAX_NUM_CHASSIS * 2) /* max dev->bus->number */ 89 + /* MAX_PHB_BUS_NUM is the maximal possible dev->bus->number */ 90 + #define MAX_PHB_BUS_NUM (MAX_NUM_OF_PHBS * MAX_NUM_CHASSIS * 2) 90 91 #define PHBS_PER_CALGARY 4 91 92 92 93 /* register offsets in Calgary's internal register space */ ··· 112 111 0xB000 /* PHB3 */ 113 112 }; 114 113 115 - static char bus_to_phb[MAX_PHB_BUS_NUM]; 116 - void* tce_table_kva[MAX_PHB_BUS_NUM]; 117 114 unsigned int specified_table_size = TCE_TABLE_SIZE_UNSPECIFIED; 118 115 static int translate_empty_slots __read_mostly = 0; 119 116 static int calgary_detected __read_mostly = 0; 120 117 121 - /* 122 - * the bitmap of PHBs the user requested that we disable 123 - * translation on. 124 - */ 125 - static DECLARE_BITMAP(translation_disabled, MAX_PHB_BUS_NUM); 118 + struct calgary_bus_info { 119 + void *tce_space; 120 + unsigned char translation_disabled; 121 + signed char phbid; 122 + }; 123 + 124 + static struct calgary_bus_info bus_info[MAX_PHB_BUS_NUM] = { { NULL, 0, 0 }, }; 126 125 127 126 static void tce_cache_blast(struct iommu_table *tbl); 128 127 129 128 /* enable this to stress test the chip's TCE cache */ 130 129 #ifdef CONFIG_IOMMU_DEBUG 131 - static inline void tce_cache_blast_stress(struct iommu_table *tbl) 130 + int debugging __read_mostly = 1; 131 + 132 + static inline unsigned long verify_bit_range(unsigned long* bitmap, 133 + int expected, unsigned long start, unsigned long end) 132 134 { 133 - tce_cache_blast(tbl); 135 + unsigned long idx = start; 136 + 137 + BUG_ON(start >= end); 138 + 139 + while (idx < end) { 140 + if (!!test_bit(idx, bitmap) != expected) 141 + return idx; 142 + ++idx; 143 + } 144 + 145 + /* all bits have the expected value */ 146 + return ~0UL; 134 147 } 135 - #else 136 - static inline void tce_cache_blast_stress(struct iommu_table *tbl) 148 + #else /* debugging is disabled */ 149 + int debugging __read_mostly = 0; 150 + 151 + static inline unsigned long verify_bit_range(unsigned long* bitmap, 152 + int expected, unsigned long start, unsigned long end) 137 153 { 154 + return ~0UL; 138 155 } 139 - #endif /* BLAST_TCE_CACHE_ON_UNMAP */ 156 + #endif /* CONFIG_IOMMU_DEBUG */ 140 157 141 158 static inline unsigned int num_dma_pages(unsigned long dma, unsigned int dmalen) 142 159 { ··· 168 149 169 150 static inline int translate_phb(struct pci_dev* dev) 170 151 { 171 - int disabled = test_bit(dev->bus->number, translation_disabled); 152 + int disabled = bus_info[dev->bus->number].translation_disabled; 172 153 return !disabled; 173 154 } 174 155 ··· 177 158 { 178 159 unsigned long index; 179 160 unsigned long end; 161 + unsigned long badbit; 180 162 181 163 index = start_addr >> PAGE_SHIFT; 182 164 ··· 189 169 if (end > tbl->it_size) /* don't go off the table */ 190 170 end = tbl->it_size; 191 171 192 - while (index < end) { 193 - if (test_bit(index, tbl->it_map)) 172 + badbit = verify_bit_range(tbl->it_map, 0, index, end); 173 + if (badbit != ~0UL) { 174 + if (printk_ratelimit()) 194 175 printk(KERN_ERR "Calgary: entry already allocated at " 195 176 "0x%lx tbl %p dma 0x%lx npages %u\n", 196 - index, tbl, start_addr, npages); 197 - ++index; 177 + badbit, tbl, start_addr, npages); 198 178 } 199 - set_bit_string(tbl->it_map, start_addr >> PAGE_SHIFT, npages); 179 + 180 + set_bit_string(tbl->it_map, index, npages); 200 181 } 201 182 202 183 static unsigned long iommu_range_alloc(struct iommu_table *tbl, ··· 264 243 unsigned int npages) 265 244 { 266 245 unsigned long entry; 267 - unsigned long i; 246 + unsigned long badbit; 268 247 269 248 entry = dma_addr >> PAGE_SHIFT; 270 249 ··· 272 251 273 252 tce_free(tbl, entry, npages); 274 253 275 - for (i = 0; i < npages; ++i) { 276 - if (!test_bit(entry + i, tbl->it_map)) 254 + badbit = verify_bit_range(tbl->it_map, 1, entry, entry + npages); 255 + if (badbit != ~0UL) { 256 + if (printk_ratelimit()) 277 257 printk(KERN_ERR "Calgary: bit is off at 0x%lx " 278 258 "tbl %p dma 0x%Lx entry 0x%lx npages %u\n", 279 - entry + i, tbl, dma_addr, entry, npages); 259 + badbit, tbl, dma_addr, entry, npages); 280 260 } 281 261 282 262 __clear_bit_string(tbl->it_map, entry, npages); 283 - 284 - tce_cache_blast_stress(tbl); 285 263 } 286 264 287 265 static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr, ··· 474 454 475 455 static inline int busno_to_phbid(unsigned char num) 476 456 { 477 - return bus_to_phb[num]; 457 + return bus_info[num].phbid; 478 458 } 479 459 480 460 static inline unsigned long split_queue_offset(unsigned char num) ··· 651 631 if (ret) 652 632 return ret; 653 633 634 + tbl = dev->sysdata; 635 + tbl->it_base = (unsigned long)bus_info[dev->bus->number].tce_space; 636 + tce_free(tbl, 0, tbl->it_size); 637 + 654 638 calgary_reserve_regions(dev); 655 639 656 640 /* set TARs for each PHB */ ··· 678 654 return 0; 679 655 } 680 656 681 - static void __init calgary_free_tar(struct pci_dev *dev) 657 + static void __init calgary_free_bus(struct pci_dev *dev) 682 658 { 683 659 u64 val64; 684 660 struct iommu_table *tbl = dev->sysdata; 685 661 void __iomem *target; 662 + unsigned int bitmapsz; 686 663 687 664 target = calgary_reg(tbl->bbar, tar_offset(dev->bus->number)); 688 665 val64 = be64_to_cpu(readq(target)); ··· 691 666 writeq(cpu_to_be64(val64), target); 692 667 readq(target); /* flush */ 693 668 669 + bitmapsz = tbl->it_size / BITS_PER_BYTE; 670 + free_pages((unsigned long)tbl->it_map, get_order(bitmapsz)); 671 + tbl->it_map = NULL; 672 + 694 673 kfree(tbl); 695 674 dev->sysdata = NULL; 675 + 676 + /* Can't free bootmem allocated memory after system is up :-( */ 677 + bus_info[dev->bus->number].tce_space = NULL; 696 678 } 697 679 698 680 static void calgary_watchdog(unsigned long data) ··· 804 772 return address; 805 773 } 806 774 807 - static int __init calgary_init_one_nontraslated(struct pci_dev *dev) 775 + static void __init calgary_init_one_nontraslated(struct pci_dev *dev) 808 776 { 777 + pci_dev_get(dev); 809 778 dev->sysdata = NULL; 810 779 dev->bus->self = dev; 811 - 812 - return 0; 813 780 } 814 781 815 782 static int __init calgary_init_one(struct pci_dev *dev) ··· 829 798 if (ret) 830 799 goto iounmap; 831 800 801 + pci_dev_get(dev); 832 802 dev->bus->self = dev; 833 803 calgary_enable_translation(dev); 834 804 ··· 856 824 calgary_init_one_nontraslated(dev); 857 825 continue; 858 826 } 859 - if (!tce_table_kva[dev->bus->number] && !translate_empty_slots) { 860 - pci_dev_put(dev); 827 + if (!bus_info[dev->bus->number].tce_space && !translate_empty_slots) 861 828 continue; 862 - } 829 + 863 830 ret = calgary_init_one(dev); 864 831 if (ret) 865 832 goto error; ··· 871 840 dev = pci_find_device_reverse(PCI_VENDOR_ID_IBM, 872 841 PCI_DEVICE_ID_IBM_CALGARY, 873 842 dev); 843 + if (!dev) 844 + break; 874 845 if (!translate_phb(dev)) { 875 846 pci_dev_put(dev); 876 847 continue; 877 848 } 878 - if (!tce_table_kva[dev->bus->number] && !translate_empty_slots) 849 + if (!bus_info[dev->bus->number].tce_space && !translate_empty_slots) 879 850 continue; 851 + 880 852 calgary_disable_translation(dev); 881 - calgary_free_tar(dev); 882 - pci_dev_put(dev); 853 + calgary_free_bus(dev); 854 + pci_dev_put(dev); /* Undo calgary_init_one()'s pci_dev_get() */ 883 855 } 884 856 885 857 return ret; ··· 924 890 if (swiotlb || no_iommu || iommu_detected) 925 891 return; 926 892 893 + if (!early_pci_allowed()) 894 + return; 895 + 927 896 specified_table_size = determine_tce_table_size(end_pfn * PAGE_SIZE); 928 897 929 898 for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) { 930 899 int dev; 931 - 932 - tce_table_kva[bus] = NULL; 933 - bus_to_phb[bus] = -1; 900 + struct calgary_bus_info *info = &bus_info[bus]; 901 + info->phbid = -1; 934 902 935 903 if (read_pci_config(bus, 0, 0, 0) != PCI_VENDOR_DEVICE_ID_CALGARY) 936 904 continue; ··· 943 907 */ 944 908 phb = (phb + 1) % PHBS_PER_CALGARY; 945 909 946 - if (test_bit(bus, translation_disabled)) { 947 - printk(KERN_INFO "Calgary: translation is disabled for " 948 - "PHB 0x%x\n", bus); 949 - /* skip this phb, don't allocate a tbl for it */ 910 + if (info->translation_disabled) 950 911 continue; 951 - } 912 + 952 913 /* 953 914 * Scan the slots of the PCI bus to see if there is a device present. 954 915 * The parent bus will be the zero-ith device, so start at 1. ··· 956 923 tbl = alloc_tce_table(); 957 924 if (!tbl) 958 925 goto cleanup; 959 - tce_table_kva[bus] = tbl; 960 - bus_to_phb[bus] = phb; 926 + info->tce_space = tbl; 927 + info->phbid = phb; 961 928 calgary_found = 1; 962 929 break; 963 930 } ··· 967 934 if (calgary_found) { 968 935 iommu_detected = 1; 969 936 calgary_detected = 1; 970 - printk(KERN_INFO "PCI-DMA: Calgary IOMMU detected. " 971 - "TCE table spec is %d.\n", specified_table_size); 937 + printk(KERN_INFO "PCI-DMA: Calgary IOMMU detected.\n"); 938 + printk(KERN_INFO "PCI-DMA: Calgary TCE table spec is %d, " 939 + "CONFIG_IOMMU_DEBUG is %s.\n", specified_table_size, 940 + debugging ? "enabled" : "disabled"); 972 941 } 973 942 return; 974 943 975 944 cleanup: 976 - for (--bus; bus >= 0; --bus) 977 - if (tce_table_kva[bus]) 978 - free_tce_table(tce_table_kva[bus]); 945 + for (--bus; bus >= 0; --bus) { 946 + struct calgary_bus_info *info = &bus_info[bus]; 947 + 948 + if (info->tce_space) 949 + free_tce_table(info->tce_space); 950 + } 979 951 } 980 952 981 953 int __init calgary_iommu_init(void) ··· 1054 1016 if (bridge < MAX_PHB_BUS_NUM) { 1055 1017 printk(KERN_INFO "Calgary: disabling " 1056 1018 "translation for PHB 0x%x\n", bridge); 1057 - set_bit(bridge, translation_disabled); 1019 + bus_info[bridge].translation_disabled = 1; 1058 1020 } 1059 1021 } 1060 1022
+5 -2
arch/x86_64/kernel/pci-dma.c
··· 236 236 { 237 237 iommu_merge = 1; 238 238 239 + if (!p) 240 + return -EINVAL; 241 + 239 242 while (*p) { 240 243 if (!strncmp(p,"off",3)) 241 244 no_iommu = 1; ··· 281 278 if (*p == ',') 282 279 ++p; 283 280 } 284 - return 1; 281 + return 0; 285 282 } 286 - __setup("iommu=", iommu_setup); 283 + early_param("iommu", iommu_setup); 287 284 288 285 void __init pci_iommu_alloc(void) 289 286 {
-3
arch/x86_64/kernel/pci-gart.c
··· 239 239 { 240 240 unsigned long phys_mem, bus; 241 241 242 - BUG_ON(dir == DMA_NONE); 243 - 244 242 if (!dev) 245 243 dev = &fallback_dev; 246 244 ··· 381 383 unsigned long pages = 0; 382 384 int need = 0, nextneed; 383 385 384 - BUG_ON(dir == DMA_NONE); 385 386 if (nents == 0) 386 387 return 0; 387 388
-1
arch/x86_64/kernel/pci-nommu.c
··· 59 59 { 60 60 int i; 61 61 62 - BUG_ON(direction == DMA_NONE); 63 62 for (i = 0; i < nents; i++ ) { 64 63 struct scatterlist *s = &sg[i]; 65 64 BUG_ON(!s->page);
+71 -39
arch/x86_64/kernel/process.c
··· 80 80 } 81 81 EXPORT_SYMBOL(idle_notifier_unregister); 82 82 83 - enum idle_state { CPU_IDLE, CPU_NOT_IDLE }; 84 - static DEFINE_PER_CPU(enum idle_state, idle_state) = CPU_NOT_IDLE; 85 - 86 83 void enter_idle(void) 87 84 { 88 - __get_cpu_var(idle_state) = CPU_IDLE; 85 + write_pda(isidle, 1); 89 86 atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL); 90 87 } 91 88 92 89 static void __exit_idle(void) 93 90 { 94 - __get_cpu_var(idle_state) = CPU_NOT_IDLE; 91 + if (read_pda(isidle) == 0) 92 + return; 93 + write_pda(isidle, 0); 95 94 atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL); 96 95 } 97 96 98 97 /* Called from interrupts to signify idle end */ 99 98 void exit_idle(void) 100 99 { 101 - if (current->pid | read_pda(irqcount)) 100 + /* idle loop has pid 0 */ 101 + if (current->pid) 102 102 return; 103 103 __exit_idle(); 104 104 } ··· 220 220 play_dead(); 221 221 enter_idle(); 222 222 idle(); 223 + /* In many cases the interrupt that ended idle 224 + has already called exit_idle. But some idle 225 + loops can be woken up without interrupt. */ 223 226 __exit_idle(); 224 227 } 225 228 ··· 353 350 354 351 kfree(t->io_bitmap_ptr); 355 352 t->io_bitmap_ptr = NULL; 353 + clear_thread_flag(TIF_IO_BITMAP); 356 354 /* 357 355 * Careful, clear this in the TSS too: 358 356 */ ··· 373 369 if (t->flags & _TIF_IA32) 374 370 current_thread_info()->status |= TS_COMPAT; 375 371 } 372 + t->flags &= ~_TIF_DEBUG; 376 373 377 374 tsk->thread.debugreg0 = 0; 378 375 tsk->thread.debugreg1 = 0; ··· 466 461 asm("mov %%es,%0" : "=m" (p->thread.es)); 467 462 asm("mov %%ds,%0" : "=m" (p->thread.ds)); 468 463 469 - if (unlikely(me->thread.io_bitmap_ptr != NULL)) { 464 + if (unlikely(test_tsk_thread_flag(me, TIF_IO_BITMAP))) { 470 465 p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); 471 466 if (!p->thread.io_bitmap_ptr) { 472 467 p->thread.io_bitmap_max = 0; ··· 474 469 } 475 470 memcpy(p->thread.io_bitmap_ptr, me->thread.io_bitmap_ptr, 476 471 IO_BITMAP_BYTES); 472 + set_tsk_thread_flag(p, TIF_IO_BITMAP); 477 473 } 478 474 479 475 /* ··· 504 498 */ 505 499 #define loaddebug(thread,r) set_debugreg(thread->debugreg ## r, r) 506 500 501 + static inline void __switch_to_xtra(struct task_struct *prev_p, 502 + struct task_struct *next_p, 503 + struct tss_struct *tss) 504 + { 505 + struct thread_struct *prev, *next; 506 + 507 + prev = &prev_p->thread, 508 + next = &next_p->thread; 509 + 510 + if (test_tsk_thread_flag(next_p, TIF_DEBUG)) { 511 + loaddebug(next, 0); 512 + loaddebug(next, 1); 513 + loaddebug(next, 2); 514 + loaddebug(next, 3); 515 + /* no 4 and 5 */ 516 + loaddebug(next, 6); 517 + loaddebug(next, 7); 518 + } 519 + 520 + if (test_tsk_thread_flag(next_p, TIF_IO_BITMAP)) { 521 + /* 522 + * Copy the relevant range of the IO bitmap. 523 + * Normally this is 128 bytes or less: 524 + */ 525 + memcpy(tss->io_bitmap, next->io_bitmap_ptr, 526 + max(prev->io_bitmap_max, next->io_bitmap_max)); 527 + } else if (test_tsk_thread_flag(prev_p, TIF_IO_BITMAP)) { 528 + /* 529 + * Clear any possible leftover bits: 530 + */ 531 + memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); 532 + } 533 + } 534 + 507 535 /* 508 536 * switch_to(x,y) should switch tasks from x to y. 509 537 * ··· 554 514 *next = &next_p->thread; 555 515 int cpu = smp_processor_id(); 556 516 struct tss_struct *tss = &per_cpu(init_tss, cpu); 517 + 518 + /* we're going to use this soon, after a few expensive things */ 519 + if (next_p->fpu_counter>5) 520 + prefetch(&next->i387.fxsave); 557 521 558 522 /* 559 523 * Reload esp0, LDT and the page table pointer: ··· 627 583 And the AMD workaround requires it to be after DS reload. */ 628 584 unlazy_fpu(prev_p); 629 585 write_pda(kernelstack, 630 - task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET); 586 + (unsigned long)task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET); 587 + #ifdef CONFIG_CC_STACKPROTECTOR 588 + write_pda(stack_canary, next_p->stack_canary); 589 + /* 590 + * Build time only check to make sure the stack_canary is at 591 + * offset 40 in the pda; this is a gcc ABI requirement 592 + */ 593 + BUILD_BUG_ON(offsetof(struct x8664_pda, stack_canary) != 40); 594 + #endif 631 595 632 596 /* 633 - * Now maybe reload the debug registers 597 + * Now maybe reload the debug registers and handle I/O bitmaps 634 598 */ 635 - if (unlikely(next->debugreg7)) { 636 - loaddebug(next, 0); 637 - loaddebug(next, 1); 638 - loaddebug(next, 2); 639 - loaddebug(next, 3); 640 - /* no 4 and 5 */ 641 - loaddebug(next, 6); 642 - loaddebug(next, 7); 643 - } 599 + if (unlikely((task_thread_info(next_p)->flags & _TIF_WORK_CTXSW)) 600 + || test_tsk_thread_flag(prev_p, TIF_IO_BITMAP)) 601 + __switch_to_xtra(prev_p, next_p, tss); 644 602 645 - 646 - /* 647 - * Handle the IO bitmap 648 - */ 649 - if (unlikely(prev->io_bitmap_ptr || next->io_bitmap_ptr)) { 650 - if (next->io_bitmap_ptr) 651 - /* 652 - * Copy the relevant range of the IO bitmap. 653 - * Normally this is 128 bytes or less: 654 - */ 655 - memcpy(tss->io_bitmap, next->io_bitmap_ptr, 656 - max(prev->io_bitmap_max, next->io_bitmap_max)); 657 - else { 658 - /* 659 - * Clear any possible leftover bits: 660 - */ 661 - memset(tss->io_bitmap, 0xff, prev->io_bitmap_max); 662 - } 663 - } 664 - 603 + /* If the task has used fpu the last 5 timeslices, just do a full 604 + * restore of the math state immediately to avoid the trap; the 605 + * chances of needing FPU soon are obviously high now 606 + */ 607 + if (next_p->fpu_counter>5) 608 + math_state_restore(); 665 609 return prev_p; 666 610 } 667 611 ··· 866 834 867 835 unsigned long arch_align_stack(unsigned long sp) 868 836 { 869 - if (randomize_va_space) 837 + if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) 870 838 sp -= get_random_int() % 8192; 871 839 return sp & ~0xf; 872 840 }
+17 -12
arch/x86_64/kernel/ptrace.c
··· 116 116 return addr; 117 117 } 118 118 119 - static int is_at_popf(struct task_struct *child, struct pt_regs *regs) 119 + static int is_setting_trap_flag(struct task_struct *child, struct pt_regs *regs) 120 120 { 121 121 int i, copied; 122 - unsigned char opcode[16]; 122 + unsigned char opcode[15]; 123 123 unsigned long addr = convert_rip_to_linear(child, regs); 124 124 125 125 copied = access_process_vm(child, addr, opcode, sizeof(opcode), 0); 126 126 for (i = 0; i < copied; i++) { 127 127 switch (opcode[i]) { 128 - /* popf */ 129 - case 0x9d: 128 + /* popf and iret */ 129 + case 0x9d: case 0xcf: 130 130 return 1; 131 131 132 132 /* CHECKME: 64 65 */ ··· 138 138 case 0x26: case 0x2e: 139 139 case 0x36: case 0x3e: 140 140 case 0x64: case 0x65: 141 - case 0xf0: case 0xf2: case 0xf3: 141 + case 0xf2: case 0xf3: 142 142 continue; 143 143 144 - /* REX prefixes */ 145 144 case 0x40 ... 0x4f: 145 + if (regs->cs != __USER_CS) 146 + /* 32-bit mode: register increment */ 147 + return 0; 148 + /* 64-bit mode: REX prefix */ 146 149 continue; 147 150 148 - /* CHECKME: f0, f2, f3 */ 151 + /* CHECKME: f2, f3 */ 149 152 150 153 /* 151 154 * pushf: NOTE! We should probably not let ··· 189 186 * ..but if TF is changed by the instruction we will trace, 190 187 * don't mark it as being "us" that set it, so that we 191 188 * won't clear it by hand later. 192 - * 193 - * AK: this is not enough, LAHF and IRET can change TF in user space too. 194 189 */ 195 - if (is_at_popf(child, regs)) 190 + if (is_setting_trap_flag(child, regs)) 196 191 return; 197 192 198 193 child->ptrace |= PT_DTRACE; ··· 421 420 if ((0x5554 >> ((data >> (16 + 4*i)) & 0xf)) & 1) 422 421 break; 423 422 if (i == 4) { 424 - child->thread.debugreg7 = data; 423 + child->thread.debugreg7 = data; 424 + if (data) 425 + set_tsk_thread_flag(child, TIF_DEBUG); 426 + else 427 + clear_tsk_thread_flag(child, TIF_DEBUG); 425 428 ret = 0; 426 - } 429 + } 427 430 break; 428 431 } 429 432 break;
+153 -20
arch/x86_64/kernel/relocate_kernel.S
··· 7 7 */ 8 8 9 9 #include <linux/linkage.h> 10 + #include <asm/page.h> 11 + #include <asm/kexec.h> 10 12 11 - /* 12 - * Must be relocatable PIC code callable as a C function, that once 13 - * it starts can not use the previous processes stack. 14 - */ 15 - .globl relocate_new_kernel 13 + /* 14 + * Must be relocatable PIC code callable as a C function 15 + */ 16 + 17 + #define PTR(x) (x << 3) 18 + #define PAGE_ALIGNED (1 << PAGE_SHIFT) 19 + #define PAGE_ATTR 0x63 /* _PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY */ 20 + 21 + .text 22 + .align PAGE_ALIGNED 16 23 .code64 17 - relocate_new_kernel: 18 - /* %rdi page_list 19 - * %rsi reboot_code_buffer 24 + .globl relocate_kernel 25 + relocate_kernel: 26 + /* %rdi indirection_page 27 + * %rsi page_list 20 28 * %rdx start address 21 - * %rcx page_table 22 - * %r8 arg5 23 - * %r9 arg6 29 + */ 30 + 31 + /* map the control page at its virtual address */ 32 + 33 + movq $0x0000ff8000000000, %r10 /* mask */ 34 + mov $(39 - 3), %cl /* bits to shift */ 35 + movq PTR(VA_CONTROL_PAGE)(%rsi), %r11 /* address to map */ 36 + 37 + movq %r11, %r9 38 + andq %r10, %r9 39 + shrq %cl, %r9 40 + 41 + movq PTR(VA_PGD)(%rsi), %r8 42 + addq %r8, %r9 43 + movq PTR(PA_PUD_0)(%rsi), %r8 44 + orq $PAGE_ATTR, %r8 45 + movq %r8, (%r9) 46 + 47 + shrq $9, %r10 48 + sub $9, %cl 49 + 50 + movq %r11, %r9 51 + andq %r10, %r9 52 + shrq %cl, %r9 53 + 54 + movq PTR(VA_PUD_0)(%rsi), %r8 55 + addq %r8, %r9 56 + movq PTR(PA_PMD_0)(%rsi), %r8 57 + orq $PAGE_ATTR, %r8 58 + movq %r8, (%r9) 59 + 60 + shrq $9, %r10 61 + sub $9, %cl 62 + 63 + movq %r11, %r9 64 + andq %r10, %r9 65 + shrq %cl, %r9 66 + 67 + movq PTR(VA_PMD_0)(%rsi), %r8 68 + addq %r8, %r9 69 + movq PTR(PA_PTE_0)(%rsi), %r8 70 + orq $PAGE_ATTR, %r8 71 + movq %r8, (%r9) 72 + 73 + shrq $9, %r10 74 + sub $9, %cl 75 + 76 + movq %r11, %r9 77 + andq %r10, %r9 78 + shrq %cl, %r9 79 + 80 + movq PTR(VA_PTE_0)(%rsi), %r8 81 + addq %r8, %r9 82 + movq PTR(PA_CONTROL_PAGE)(%rsi), %r8 83 + orq $PAGE_ATTR, %r8 84 + movq %r8, (%r9) 85 + 86 + /* identity map the control page at its physical address */ 87 + 88 + movq $0x0000ff8000000000, %r10 /* mask */ 89 + mov $(39 - 3), %cl /* bits to shift */ 90 + movq PTR(PA_CONTROL_PAGE)(%rsi), %r11 /* address to map */ 91 + 92 + movq %r11, %r9 93 + andq %r10, %r9 94 + shrq %cl, %r9 95 + 96 + movq PTR(VA_PGD)(%rsi), %r8 97 + addq %r8, %r9 98 + movq PTR(PA_PUD_1)(%rsi), %r8 99 + orq $PAGE_ATTR, %r8 100 + movq %r8, (%r9) 101 + 102 + shrq $9, %r10 103 + sub $9, %cl 104 + 105 + movq %r11, %r9 106 + andq %r10, %r9 107 + shrq %cl, %r9 108 + 109 + movq PTR(VA_PUD_1)(%rsi), %r8 110 + addq %r8, %r9 111 + movq PTR(PA_PMD_1)(%rsi), %r8 112 + orq $PAGE_ATTR, %r8 113 + movq %r8, (%r9) 114 + 115 + shrq $9, %r10 116 + sub $9, %cl 117 + 118 + movq %r11, %r9 119 + andq %r10, %r9 120 + shrq %cl, %r9 121 + 122 + movq PTR(VA_PMD_1)(%rsi), %r8 123 + addq %r8, %r9 124 + movq PTR(PA_PTE_1)(%rsi), %r8 125 + orq $PAGE_ATTR, %r8 126 + movq %r8, (%r9) 127 + 128 + shrq $9, %r10 129 + sub $9, %cl 130 + 131 + movq %r11, %r9 132 + andq %r10, %r9 133 + shrq %cl, %r9 134 + 135 + movq PTR(VA_PTE_1)(%rsi), %r8 136 + addq %r8, %r9 137 + movq PTR(PA_CONTROL_PAGE)(%rsi), %r8 138 + orq $PAGE_ATTR, %r8 139 + movq %r8, (%r9) 140 + 141 + relocate_new_kernel: 142 + /* %rdi indirection_page 143 + * %rsi page_list 144 + * %rdx start address 24 145 */ 25 146 26 147 /* zero out flags, and disable interrupts */ 27 148 pushq $0 28 149 popfq 29 150 30 - /* set a new stack at the bottom of our page... */ 31 - lea 4096(%rsi), %rsp 151 + /* get physical address of control page now */ 152 + /* this is impossible after page table switch */ 153 + movq PTR(PA_CONTROL_PAGE)(%rsi), %r8 32 154 33 - /* store the parameters back on the stack */ 34 - pushq %rdx /* store the start address */ 155 + /* get physical address of page table now too */ 156 + movq PTR(PA_TABLE_PAGE)(%rsi), %rcx 157 + 158 + /* switch to new set of page tables */ 159 + movq PTR(PA_PGD)(%rsi), %r9 160 + movq %r9, %cr3 161 + 162 + /* setup a new stack at the end of the physical control page */ 163 + lea 4096(%r8), %rsp 164 + 165 + /* jump to identity mapped page */ 166 + addq $(identity_mapped - relocate_kernel), %r8 167 + pushq %r8 168 + ret 169 + 170 + identity_mapped: 171 + /* store the start address on the stack */ 172 + pushq %rdx 35 173 36 174 /* Set cr0 to a known state: 37 175 * 31 1 == Paging enabled ··· 274 136 xorq %r15, %r15 275 137 276 138 ret 277 - relocate_new_kernel_end: 278 - 279 - .globl relocate_new_kernel_size 280 - relocate_new_kernel_size: 281 - .quad relocate_new_kernel_end - relocate_new_kernel
+43 -200
arch/x86_64/kernel/setup.c
··· 74 74 75 75 unsigned long mmu_cr4_features; 76 76 77 - int acpi_disabled; 78 - EXPORT_SYMBOL(acpi_disabled); 79 - #ifdef CONFIG_ACPI 80 - extern int __initdata acpi_ht; 81 - extern acpi_interrupt_flags acpi_sci_flags; 82 - int __initdata acpi_force = 0; 83 - #endif 84 - 85 - int acpi_numa __initdata; 86 - 87 77 /* Boot loader ID as an integer, for the benefit of proc_dointvec */ 88 78 int bootloader_type; 89 79 ··· 97 107 98 108 struct edid_info edid_info; 99 109 EXPORT_SYMBOL_GPL(edid_info); 100 - struct e820map e820; 101 110 102 111 extern int root_mountflags; 103 112 ··· 265 276 } 266 277 } 267 278 268 - /* Check for full argument with no trailing characters */ 269 - static int fullarg(char *p, char *arg) 270 - { 271 - int l = strlen(arg); 272 - return !memcmp(p, arg, l) && (p[l] == 0 || isspace(p[l])); 273 - } 274 - 275 - static __init void parse_cmdline_early (char ** cmdline_p) 276 - { 277 - char c = ' ', *to = command_line, *from = COMMAND_LINE; 278 - int len = 0; 279 - int userdef = 0; 280 - 281 - for (;;) { 282 - if (c != ' ') 283 - goto next_char; 284 - 285 - #ifdef CONFIG_SMP 286 - /* 287 - * If the BIOS enumerates physical processors before logical, 288 - * maxcpus=N at enumeration-time can be used to disable HT. 289 - */ 290 - else if (!memcmp(from, "maxcpus=", 8)) { 291 - extern unsigned int maxcpus; 292 - 293 - maxcpus = simple_strtoul(from + 8, NULL, 0); 294 - } 295 - #endif 296 - #ifdef CONFIG_ACPI 297 - /* "acpi=off" disables both ACPI table parsing and interpreter init */ 298 - if (fullarg(from,"acpi=off")) 299 - disable_acpi(); 300 - 301 - if (fullarg(from, "acpi=force")) { 302 - /* add later when we do DMI horrors: */ 303 - acpi_force = 1; 304 - acpi_disabled = 0; 305 - } 306 - 307 - /* acpi=ht just means: do ACPI MADT parsing 308 - at bootup, but don't enable the full ACPI interpreter */ 309 - if (fullarg(from, "acpi=ht")) { 310 - if (!acpi_force) 311 - disable_acpi(); 312 - acpi_ht = 1; 313 - } 314 - else if (fullarg(from, "pci=noacpi")) 315 - acpi_disable_pci(); 316 - else if (fullarg(from, "acpi=noirq")) 317 - acpi_noirq_set(); 318 - 319 - else if (fullarg(from, "acpi_sci=edge")) 320 - acpi_sci_flags.trigger = 1; 321 - else if (fullarg(from, "acpi_sci=level")) 322 - acpi_sci_flags.trigger = 3; 323 - else if (fullarg(from, "acpi_sci=high")) 324 - acpi_sci_flags.polarity = 1; 325 - else if (fullarg(from, "acpi_sci=low")) 326 - acpi_sci_flags.polarity = 3; 327 - 328 - /* acpi=strict disables out-of-spec workarounds */ 329 - else if (fullarg(from, "acpi=strict")) { 330 - acpi_strict = 1; 331 - } 332 - #ifdef CONFIG_X86_IO_APIC 333 - else if (fullarg(from, "acpi_skip_timer_override")) 334 - acpi_skip_timer_override = 1; 335 - #endif 336 - #endif 337 - 338 - if (fullarg(from, "disable_timer_pin_1")) 339 - disable_timer_pin_1 = 1; 340 - if (fullarg(from, "enable_timer_pin_1")) 341 - disable_timer_pin_1 = -1; 342 - 343 - if (fullarg(from, "nolapic") || fullarg(from, "disableapic")) { 344 - clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability); 345 - disable_apic = 1; 346 - } 347 - 348 - if (fullarg(from, "noapic")) 349 - skip_ioapic_setup = 1; 350 - 351 - if (fullarg(from,"apic")) { 352 - skip_ioapic_setup = 0; 353 - ioapic_force = 1; 354 - } 355 - 356 - if (!memcmp(from, "mem=", 4)) 357 - parse_memopt(from+4, &from); 358 - 359 - if (!memcmp(from, "memmap=", 7)) { 360 - /* exactmap option is for used defined memory */ 361 - if (!memcmp(from+7, "exactmap", 8)) { 362 - #ifdef CONFIG_CRASH_DUMP 363 - /* If we are doing a crash dump, we 364 - * still need to know the real mem 365 - * size before original memory map is 366 - * reset. 367 - */ 368 - saved_max_pfn = e820_end_of_ram(); 369 - #endif 370 - from += 8+7; 371 - end_pfn_map = 0; 372 - e820.nr_map = 0; 373 - userdef = 1; 374 - } 375 - else { 376 - parse_memmapopt(from+7, &from); 377 - userdef = 1; 378 - } 379 - } 380 - 381 - #ifdef CONFIG_NUMA 382 - if (!memcmp(from, "numa=", 5)) 383 - numa_setup(from+5); 384 - #endif 385 - 386 - if (!memcmp(from,"iommu=",6)) { 387 - iommu_setup(from+6); 388 - } 389 - 390 - if (fullarg(from,"oops=panic")) 391 - panic_on_oops = 1; 392 - 393 - if (!memcmp(from, "noexec=", 7)) 394 - nonx_setup(from + 7); 395 - 396 - #ifdef CONFIG_KEXEC 397 - /* crashkernel=size@addr specifies the location to reserve for 398 - * a crash kernel. By reserving this memory we guarantee 399 - * that linux never set's it up as a DMA target. 400 - * Useful for holding code to do something appropriate 401 - * after a kernel panic. 402 - */ 403 - else if (!memcmp(from, "crashkernel=", 12)) { 404 - unsigned long size, base; 405 - size = memparse(from+12, &from); 406 - if (*from == '@') { 407 - base = memparse(from+1, &from); 408 - /* FIXME: Do I want a sanity check 409 - * to validate the memory range? 410 - */ 411 - crashk_res.start = base; 412 - crashk_res.end = base + size - 1; 413 - } 414 - } 415 - #endif 416 - 417 279 #ifdef CONFIG_PROC_VMCORE 418 - /* elfcorehdr= specifies the location of elf core header 419 - * stored by the crashed kernel. This option will be passed 420 - * by kexec loader to the capture kernel. 421 - */ 422 - else if(!memcmp(from, "elfcorehdr=", 11)) 423 - elfcorehdr_addr = memparse(from+11, &from); 424 - #endif 425 - 426 - #ifdef CONFIG_HOTPLUG_CPU 427 - else if (!memcmp(from, "additional_cpus=", 16)) 428 - setup_additional_cpus(from+16); 429 - #endif 430 - 431 - next_char: 432 - c = *(from++); 433 - if (!c) 434 - break; 435 - if (COMMAND_LINE_SIZE <= ++len) 436 - break; 437 - *(to++) = c; 438 - } 439 - if (userdef) { 440 - printk(KERN_INFO "user-defined physical RAM map:\n"); 441 - e820_print_map("user"); 442 - } 443 - *to = '\0'; 444 - *cmdline_p = command_line; 280 + /* elfcorehdr= specifies the location of elf core header 281 + * stored by the crashed kernel. This option will be passed 282 + * by kexec loader to the capture kernel. 283 + */ 284 + static int __init setup_elfcorehdr(char *arg) 285 + { 286 + char *end; 287 + if (!arg) 288 + return -EINVAL; 289 + elfcorehdr_addr = memparse(arg, &end); 290 + return end > arg ? 0 : -EINVAL; 445 291 } 292 + early_param("elfcorehdr", setup_elfcorehdr); 293 + #endif 446 294 447 295 #ifndef CONFIG_NUMA 448 296 static void __init ··· 347 521 348 522 void __init setup_arch(char **cmdline_p) 349 523 { 524 + printk(KERN_INFO "Command line: %s\n", saved_command_line); 525 + 350 526 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); 351 527 screen_info = SCREEN_INFO; 352 528 edid_info = EDID_INFO; ··· 375 547 data_resource.start = virt_to_phys(&_etext); 376 548 data_resource.end = virt_to_phys(&_edata)-1; 377 549 378 - parse_cmdline_early(cmdline_p); 379 - 380 550 early_identify_cpu(&boot_cpu_data); 551 + 552 + strlcpy(command_line, saved_command_line, COMMAND_LINE_SIZE); 553 + *cmdline_p = command_line; 554 + 555 + parse_early_param(); 556 + 557 + finish_e820_parsing(); 381 558 382 559 /* 383 560 * partially used pages are not usable - thus 384 561 * we are rounding upwards: 385 562 */ 386 563 end_pfn = e820_end_of_ram(); 387 - num_physpages = end_pfn; /* for pfn_valid */ 564 + num_physpages = end_pfn; 388 565 389 566 check_efer(); 390 567 ··· 408 575 */ 409 576 acpi_boot_table_init(); 410 577 #endif 578 + 579 + /* How many end-of-memory variables you have, grandma! */ 580 + max_low_pfn = end_pfn; 581 + max_pfn = end_pfn; 582 + high_memory = (void *)__va(end_pfn * PAGE_SIZE - 1) + 1; 411 583 412 584 #ifdef CONFIG_ACPI_NUMA 413 585 /* ··· 463 625 */ 464 626 acpi_reserve_bootmem(); 465 627 #endif 466 - #ifdef CONFIG_X86_LOCAL_APIC 467 628 /* 468 629 * Find and reserve possible boot-time SMP configuration: 469 630 */ 470 631 find_smp_config(); 471 - #endif 472 632 #ifdef CONFIG_BLK_DEV_INITRD 473 633 if (LOADER_TYPE && INITRD_START) { 474 634 if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { ··· 493 657 494 658 paging_init(); 495 659 496 - check_ioapic(); 660 + #ifdef CONFIG_PCI 661 + early_quirks(); 662 + #endif 497 663 498 664 /* 499 665 * set this early, so we dont allocate cpu0 ··· 512 674 513 675 init_cpu_to_node(); 514 676 515 - #ifdef CONFIG_X86_LOCAL_APIC 516 677 /* 517 678 * get boot-time SMP configuration: 518 679 */ 519 680 if (smp_found_config) 520 681 get_smp_config(); 521 682 init_apic_mappings(); 522 - #endif 523 683 524 684 /* 525 685 * Request address space for all standard RAM and ROM resources ··· 675 839 #endif 676 840 } 677 841 678 - static void __init init_amd(struct cpuinfo_x86 *c) 842 + static void __cpuinit init_amd(struct cpuinfo_x86 *c) 679 843 { 680 844 unsigned level; 681 845 ··· 731 895 732 896 /* Fix cpuid4 emulation for more */ 733 897 num_cache_leaves = 3; 898 + 899 + /* When there is only one core no need to synchronize RDTSC */ 900 + if (num_possible_cpus() == 1) 901 + set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability); 902 + else 903 + clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability); 734 904 } 735 905 736 906 static void __cpuinit detect_ht(struct cpuinfo_x86 *c) ··· 818 976 node = first_node(node_online_map); 819 977 numa_set_node(cpu, node); 820 978 821 - if (acpi_numa > 0) 822 - printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node); 979 + printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node); 823 980 #endif 824 981 } 825 982 ··· 852 1011 if ((c->x86 == 0xf && c->x86_model >= 0x03) || 853 1012 (c->x86 == 0x6 && c->x86_model >= 0x0e)) 854 1013 set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability); 1014 + if (c->x86 == 6) 1015 + set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); 855 1016 set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability); 856 1017 c->x86_max_cores = intel_num_cpu_cores(c); 857 1018 ··· 1072 1229 1073 1230 /* Intel-defined (#2) */ 1074 1231 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", 1075 - "tm2", NULL, "cid", NULL, NULL, "cx16", "xtpr", NULL, 1076 - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1232 + "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, 1233 + NULL, NULL, "dca", NULL, NULL, NULL, NULL, NULL, 1077 1234 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1078 1235 1079 1236 /* VIA/Cyrix/Centaur-defined */
+20 -25
arch/x86_64/kernel/setup64.c
··· 24 24 #include <asm/proto.h> 25 25 #include <asm/sections.h> 26 26 27 - char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; 27 + char x86_boot_params[BOOT_PARAM_SIZE] __initdata; 28 28 29 29 cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; 30 30 ··· 46 46 on Enable(default) 47 47 off Disable 48 48 */ 49 - int __init nonx_setup(char *str) 49 + static int __init nonx_setup(char *str) 50 50 { 51 + if (!str) 52 + return -EINVAL; 51 53 if (!strncmp(str, "on", 2)) { 52 54 __supported_pte_mask |= _PAGE_NX; 53 55 do_not_nx = 0; ··· 57 55 do_not_nx = 1; 58 56 __supported_pte_mask &= ~_PAGE_NX; 59 57 } 60 - return 1; 58 + return 0; 61 59 } 62 - __setup("noexec=", nonx_setup); /* parsed early actually */ 60 + early_param("noexec", nonx_setup); 63 61 64 62 int force_personality32 = 0; 65 63 ··· 95 93 #endif 96 94 97 95 /* Copy section for each CPU (we discard the original) */ 98 - size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); 99 - #ifdef CONFIG_MODULES 100 - if (size < PERCPU_ENOUGH_ROOM) 101 - size = PERCPU_ENOUGH_ROOM; 102 - #endif 96 + size = PERCPU_ENOUGH_ROOM; 103 97 98 + printk(KERN_INFO "PERCPU: Allocating %lu bytes of per cpu data\n", size); 104 99 for_each_cpu_mask (i, cpu_possible_map) { 105 100 char *ptr; 106 101 ··· 121 122 122 123 /* Setup up data that may be needed in __get_free_pages early */ 123 124 asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); 125 + /* Memory clobbers used to order PDA accessed */ 126 + mb(); 124 127 wrmsrl(MSR_GS_BASE, pda); 128 + mb(); 125 129 126 130 pda->cpunumber = cpu; 127 131 pda->irqcount = -1; ··· 179 177 __supported_pte_mask &= ~_PAGE_NX; 180 178 } 181 179 } 180 + 181 + unsigned long kernel_eflags; 182 182 183 183 /* 184 184 * cpu_init() initializes state that is per-CPU. Some data is already ··· 239 235 * set up and load the per-CPU TSS 240 236 */ 241 237 for (v = 0; v < N_EXCEPTION_STACKS; v++) { 238 + static const unsigned int order[N_EXCEPTION_STACKS] = { 239 + [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, 240 + [DEBUG_STACK - 1] = DEBUG_STACK_ORDER 241 + }; 242 242 if (cpu) { 243 - static const unsigned int order[N_EXCEPTION_STACKS] = { 244 - [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, 245 - [DEBUG_STACK - 1] = DEBUG_STACK_ORDER 246 - }; 247 - 248 243 estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]); 249 244 if (!estacks) 250 245 panic("Cannot allocate exception stack %ld %d\n", 251 246 v, cpu); 252 247 } 253 - switch (v + 1) { 254 - #if DEBUG_STKSZ > EXCEPTION_STKSZ 255 - case DEBUG_STACK: 256 - cpu_pda(cpu)->debugstack = (unsigned long)estacks; 257 - estacks += DEBUG_STKSZ; 258 - break; 259 - #endif 260 - default: 261 - estacks += EXCEPTION_STKSZ; 262 - break; 263 - } 248 + estacks += PAGE_SIZE << order[v]; 264 249 orig_ist->ist[v] = t->ist[v] = (unsigned long)estacks; 265 250 } 266 251 ··· 283 290 set_debugreg(0UL, 7); 284 291 285 292 fpu_init(); 293 + 294 + raw_local_save_flags(kernel_eflags); 286 295 }
+35 -52
arch/x86_64/kernel/signal.c
··· 38 38 sigset_t *set, struct pt_regs * regs); 39 39 40 40 asmlinkage long 41 - sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, struct pt_regs *regs) 42 - { 43 - sigset_t saveset, newset; 44 - 45 - /* XXX: Don't preclude handling different sized sigset_t's. */ 46 - if (sigsetsize != sizeof(sigset_t)) 47 - return -EINVAL; 48 - 49 - if (copy_from_user(&newset, unewset, sizeof(newset))) 50 - return -EFAULT; 51 - sigdelsetmask(&newset, ~_BLOCKABLE); 52 - 53 - spin_lock_irq(&current->sighand->siglock); 54 - saveset = current->blocked; 55 - current->blocked = newset; 56 - recalc_sigpending(); 57 - spin_unlock_irq(&current->sighand->siglock); 58 - #ifdef DEBUG_SIG 59 - printk("rt_sigsuspend savset(%lx) newset(%lx) regs(%p) rip(%lx)\n", 60 - saveset, newset, regs, regs->rip); 61 - #endif 62 - regs->rax = -EINTR; 63 - while (1) { 64 - current->state = TASK_INTERRUPTIBLE; 65 - schedule(); 66 - if (do_signal(regs, &saveset)) 67 - return -EINTR; 68 - } 69 - } 70 - 71 - asmlinkage long 72 41 sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, 73 42 struct pt_regs *regs) 74 43 { ··· 277 308 #endif 278 309 279 310 /* Set up registers for signal handler */ 280 - { 281 - struct exec_domain *ed = current_thread_info()->exec_domain; 282 - if (unlikely(ed && ed->signal_invmap && sig < 32)) 283 - sig = ed->signal_invmap[sig]; 284 - } 285 311 regs->rdi = sig; 286 312 /* In case the signal handler was declared without prototypes */ 287 313 regs->rax = 0; ··· 305 341 current->comm, current->pid, frame, regs->rip, frame->pretcode); 306 342 #endif 307 343 308 - return 1; 344 + return 0; 309 345 310 346 give_sigsegv: 311 347 force_sigsegv(sig, current); 312 - return 0; 348 + return -EFAULT; 313 349 } 314 350 315 351 /* ··· 372 408 #endif 373 409 ret = setup_rt_frame(sig, ka, info, oldset, regs); 374 410 375 - if (ret) { 411 + if (ret == 0) { 376 412 spin_lock_irq(&current->sighand->siglock); 377 413 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 378 414 if (!(ka->sa.sa_flags & SA_NODEFER)) ··· 389 425 * want to handle. Thus you cannot kill init even with a SIGKILL even by 390 426 * mistake. 391 427 */ 392 - int do_signal(struct pt_regs *regs, sigset_t *oldset) 428 + static void do_signal(struct pt_regs *regs) 393 429 { 394 430 struct k_sigaction ka; 395 431 siginfo_t info; 396 432 int signr; 433 + sigset_t *oldset; 397 434 398 435 /* 399 436 * We want the common case to go fast, which ··· 403 438 * if so. 404 439 */ 405 440 if (!user_mode(regs)) 406 - return 1; 441 + return; 407 442 408 - if (!oldset) 443 + if (test_thread_flag(TIF_RESTORE_SIGMASK)) 444 + oldset = &current->saved_sigmask; 445 + else 409 446 oldset = &current->blocked; 410 447 411 448 signr = get_signal_to_deliver(&info, &ka, regs, NULL); ··· 421 454 set_debugreg(current->thread.debugreg7, 7); 422 455 423 456 /* Whee! Actually deliver the signal. */ 424 - return handle_signal(signr, &info, &ka, oldset, regs); 457 + if (handle_signal(signr, &info, &ka, oldset, regs) == 0) { 458 + /* a signal was successfully delivered; the saved 459 + * sigmask will have been stored in the signal frame, 460 + * and will be restored by sigreturn, so we can simply 461 + * clear the TIF_RESTORE_SIGMASK flag */ 462 + clear_thread_flag(TIF_RESTORE_SIGMASK); 463 + } 464 + return; 425 465 } 426 466 427 467 /* Did we come from a system call? */ 428 468 if ((long)regs->orig_rax >= 0) { 429 469 /* Restart the system call - no handlers present */ 430 470 long res = regs->rax; 431 - if (res == -ERESTARTNOHAND || 432 - res == -ERESTARTSYS || 433 - res == -ERESTARTNOINTR) { 471 + switch (res) { 472 + case -ERESTARTNOHAND: 473 + case -ERESTARTSYS: 474 + case -ERESTARTNOINTR: 434 475 regs->rax = regs->orig_rax; 435 476 regs->rip -= 2; 436 - } 437 - if (regs->rax == (unsigned long)-ERESTART_RESTARTBLOCK) { 477 + break; 478 + case -ERESTART_RESTARTBLOCK: 438 479 regs->rax = test_thread_flag(TIF_IA32) ? 439 480 __NR_ia32_restart_syscall : 440 481 __NR_restart_syscall; 441 482 regs->rip -= 2; 483 + break; 442 484 } 443 485 } 444 - return 0; 486 + 487 + /* if there's no signal to deliver, we just put the saved sigmask 488 + back. */ 489 + if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 490 + clear_thread_flag(TIF_RESTORE_SIGMASK); 491 + sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 492 + } 445 493 } 446 494 447 - void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, __u32 thread_info_flags) 495 + void 496 + do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags) 448 497 { 449 498 #ifdef DEBUG_SIG 450 499 printk("do_notify_resume flags:%x rip:%lx rsp:%lx caller:%lx pending:%lx\n", ··· 474 491 } 475 492 476 493 /* deal with pending signal delivery */ 477 - if (thread_info_flags & _TIF_SIGPENDING) 478 - do_signal(regs,oldset); 494 + if (thread_info_flags & (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK)) 495 + do_signal(regs); 479 496 } 480 497 481 498 void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
-23
arch/x86_64/kernel/smp.c
··· 522 522 } 523 523 } 524 524 525 - int safe_smp_processor_id(void) 526 - { 527 - unsigned apicid, i; 528 - 529 - if (disable_apic) 530 - return 0; 531 - 532 - apicid = hard_smp_processor_id(); 533 - if (apicid < NR_CPUS && x86_cpu_to_apicid[apicid] == apicid) 534 - return apicid; 535 - 536 - for (i = 0; i < NR_CPUS; ++i) { 537 - if (x86_cpu_to_apicid[i] == apicid) 538 - return i; 539 - } 540 - 541 - /* No entries in x86_cpu_to_apicid? Either no MPS|ACPI, 542 - * or called too early. Either way, we must be CPU 0. */ 543 - if (x86_cpu_to_apicid[0] == BAD_APICID) 544 - return 0; 545 - 546 - return 0; /* Should not happen */ 547 - }
+6 -8
arch/x86_64/kernel/smpboot.c
··· 1091 1091 /* 1092 1092 * Switch from PIC to APIC mode. 1093 1093 */ 1094 - connect_bsp_APIC(); 1095 1094 setup_local_APIC(); 1096 1095 1097 1096 if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_id) { ··· 1175 1176 void __init smp_cpus_done(unsigned int max_cpus) 1176 1177 { 1177 1178 smp_cleanup_boot(); 1178 - 1179 - #ifdef CONFIG_X86_IO_APIC 1180 1179 setup_ioapic_dest(); 1181 - #endif 1182 - 1183 1180 check_nmi_watchdog(); 1181 + time_init_gtod(); 1184 1182 } 1185 1183 1186 1184 #ifdef CONFIG_HOTPLUG_CPU ··· 1230 1234 if (cpu == 0) 1231 1235 return -EBUSY; 1232 1236 1237 + if (nmi_watchdog == NMI_LOCAL_APIC) 1238 + stop_apic_nmi_watchdog(NULL); 1233 1239 clear_local_APIC(); 1234 1240 1235 1241 /* ··· 1271 1273 printk(KERN_ERR "CPU %u didn't die...\n", cpu); 1272 1274 } 1273 1275 1274 - __init int setup_additional_cpus(char *s) 1276 + static __init int setup_additional_cpus(char *s) 1275 1277 { 1276 - return get_option(&s, &additional_cpus); 1278 + return s && get_option(&s, &additional_cpus) ? 0 : -EINVAL; 1277 1279 } 1278 - __setup("additional_cpus=", setup_additional_cpus); 1280 + early_param("additional_cpus", setup_additional_cpus); 1279 1281 1280 1282 #else /* ... !CONFIG_HOTPLUG_CPU */ 1281 1283
+29 -195
arch/x86_64/kernel/stacktrace.c
··· 7 7 */ 8 8 #include <linux/sched.h> 9 9 #include <linux/stacktrace.h> 10 + #include <linux/module.h> 11 + #include <asm/stacktrace.h> 10 12 11 - #include <asm/smp.h> 12 - 13 - static inline int 14 - in_range(unsigned long start, unsigned long addr, unsigned long end) 13 + static void save_stack_warning(void *data, char *msg) 15 14 { 16 - return addr >= start && addr <= end; 17 15 } 18 16 19 - static unsigned long 20 - get_stack_end(struct task_struct *task, unsigned long stack) 17 + static void 18 + save_stack_warning_symbol(void *data, char *msg, unsigned long symbol) 21 19 { 22 - unsigned long stack_start, stack_end, flags; 23 - int i, cpu; 24 - 25 - /* 26 - * The most common case is that we are in the task stack: 27 - */ 28 - stack_start = (unsigned long)task->thread_info; 29 - stack_end = stack_start + THREAD_SIZE; 30 - 31 - if (in_range(stack_start, stack, stack_end)) 32 - return stack_end; 33 - 34 - /* 35 - * We are in an interrupt if irqstackptr is set: 36 - */ 37 - raw_local_irq_save(flags); 38 - cpu = safe_smp_processor_id(); 39 - stack_end = (unsigned long)cpu_pda(cpu)->irqstackptr; 40 - 41 - if (stack_end) { 42 - stack_start = stack_end & ~(IRQSTACKSIZE-1); 43 - if (in_range(stack_start, stack, stack_end)) 44 - goto out_restore; 45 - /* 46 - * We get here if we are in an IRQ context but we 47 - * are also in an exception stack. 48 - */ 49 - } 50 - 51 - /* 52 - * Iterate over all exception stacks, and figure out whether 53 - * 'stack' is in one of them: 54 - */ 55 - for (i = 0; i < N_EXCEPTION_STACKS; i++) { 56 - /* 57 - * set 'end' to the end of the exception stack. 58 - */ 59 - stack_end = per_cpu(init_tss, cpu).ist[i]; 60 - stack_start = stack_end - EXCEPTION_STKSZ; 61 - 62 - /* 63 - * Is 'stack' above this exception frame's end? 64 - * If yes then skip to the next frame. 65 - */ 66 - if (stack >= stack_end) 67 - continue; 68 - /* 69 - * Is 'stack' above this exception frame's start address? 70 - * If yes then we found the right frame. 71 - */ 72 - if (stack >= stack_start) 73 - goto out_restore; 74 - 75 - /* 76 - * If this is a debug stack, and if it has a larger size than 77 - * the usual exception stacks, then 'stack' might still 78 - * be within the lower portion of the debug stack: 79 - */ 80 - #if DEBUG_STKSZ > EXCEPTION_STKSZ 81 - if (i == DEBUG_STACK - 1 && stack >= stack_end - DEBUG_STKSZ) { 82 - /* 83 - * Black magic. A large debug stack is composed of 84 - * multiple exception stack entries, which we 85 - * iterate through now. Dont look: 86 - */ 87 - do { 88 - stack_end -= EXCEPTION_STKSZ; 89 - stack_start -= EXCEPTION_STKSZ; 90 - } while (stack < stack_start); 91 - 92 - goto out_restore; 93 - } 94 - #endif 95 - } 96 - /* 97 - * Ok, 'stack' is not pointing to any of the system stacks. 98 - */ 99 - stack_end = 0; 100 - 101 - out_restore: 102 - raw_local_irq_restore(flags); 103 - 104 - return stack_end; 105 20 } 106 21 107 - 108 - /* 109 - * Save stack-backtrace addresses into a stack_trace buffer: 110 - */ 111 - static inline unsigned long 112 - save_context_stack(struct stack_trace *trace, unsigned int skip, 113 - unsigned long stack, unsigned long stack_end) 22 + static int save_stack_stack(void *data, char *name) 114 23 { 115 - unsigned long addr; 116 - 117 - #ifdef CONFIG_FRAME_POINTER 118 - unsigned long prev_stack = 0; 119 - 120 - while (in_range(prev_stack, stack, stack_end)) { 121 - pr_debug("stack: %p\n", (void *)stack); 122 - addr = (unsigned long)(((unsigned long *)stack)[1]); 123 - pr_debug("addr: %p\n", (void *)addr); 124 - if (!skip) 125 - trace->entries[trace->nr_entries++] = addr-1; 126 - else 127 - skip--; 128 - if (trace->nr_entries >= trace->max_entries) 129 - break; 130 - if (!addr) 131 - return 0; 132 - /* 133 - * Stack frames must go forwards (otherwise a loop could 134 - * happen if the stackframe is corrupted), so we move 135 - * prev_stack forwards: 136 - */ 137 - prev_stack = stack; 138 - stack = (unsigned long)(((unsigned long *)stack)[0]); 139 - } 140 - pr_debug("invalid: %p\n", (void *)stack); 141 - #else 142 - while (stack < stack_end) { 143 - addr = ((unsigned long *)stack)[0]; 144 - stack += sizeof(long); 145 - if (__kernel_text_address(addr)) { 146 - if (!skip) 147 - trace->entries[trace->nr_entries++] = addr-1; 148 - else 149 - skip--; 150 - if (trace->nr_entries >= trace->max_entries) 151 - break; 152 - } 153 - } 154 - #endif 155 - return stack; 24 + struct stack_trace *trace = (struct stack_trace *)data; 25 + return trace->all_contexts ? 0 : -1; 156 26 } 157 27 158 - #define MAX_STACKS 10 28 + static void save_stack_address(void *data, unsigned long addr) 29 + { 30 + struct stack_trace *trace = (struct stack_trace *)data; 31 + if (trace->skip > 0) { 32 + trace->skip--; 33 + return; 34 + } 35 + if (trace->nr_entries < trace->max_entries - 1) 36 + trace->entries[trace->nr_entries++] = addr; 37 + } 38 + 39 + static struct stacktrace_ops save_stack_ops = { 40 + .warning = save_stack_warning, 41 + .warning_symbol = save_stack_warning_symbol, 42 + .stack = save_stack_stack, 43 + .address = save_stack_address, 44 + }; 159 45 160 46 /* 161 47 * Save stack-backtrace addresses into a stack_trace buffer. 162 - * If all_contexts is set, all contexts (hardirq, softirq and process) 163 - * are saved. If not set then only the current context is saved. 164 48 */ 165 - void save_stack_trace(struct stack_trace *trace, 166 - struct task_struct *task, int all_contexts, 167 - unsigned int skip) 49 + void save_stack_trace(struct stack_trace *trace, struct task_struct *task) 168 50 { 169 - unsigned long stack = (unsigned long)&stack; 170 - int i, nr_stacks = 0, stacks_done[MAX_STACKS]; 171 - 172 - WARN_ON(trace->nr_entries || !trace->max_entries); 173 - 174 - if (!task) 175 - task = current; 176 - 177 - pr_debug("task: %p, ti: %p\n", task, task->thread_info); 178 - 179 - if (!task || task == current) { 180 - /* Grab rbp right from our regs: */ 181 - asm ("mov %%rbp, %0" : "=r" (stack)); 182 - pr_debug("rbp: %p\n", (void *)stack); 183 - } else { 184 - /* rbp is the last reg pushed by switch_to(): */ 185 - stack = task->thread.rsp; 186 - pr_debug("other task rsp: %p\n", (void *)stack); 187 - stack = (unsigned long)(((unsigned long *)stack)[0]); 188 - pr_debug("other task rbp: %p\n", (void *)stack); 189 - } 190 - 191 - while (1) { 192 - unsigned long stack_end = get_stack_end(task, stack); 193 - 194 - pr_debug("stack: %p\n", (void *)stack); 195 - pr_debug("stack end: %p\n", (void *)stack_end); 196 - 197 - /* 198 - * Invalid stack addres? 199 - */ 200 - if (!stack_end) 201 - return; 202 - /* 203 - * Were we in this stack already? (recursion) 204 - */ 205 - for (i = 0; i < nr_stacks; i++) 206 - if (stacks_done[i] == stack_end) 207 - return; 208 - stacks_done[nr_stacks] = stack_end; 209 - 210 - stack = save_context_stack(trace, skip, stack, stack_end); 211 - if (!all_contexts || !stack || 212 - trace->nr_entries >= trace->max_entries) 213 - return; 214 - trace->entries[trace->nr_entries++] = ULONG_MAX; 215 - if (trace->nr_entries >= trace->max_entries) 216 - return; 217 - if (++nr_stacks >= MAX_STACKS) 218 - return; 219 - } 51 + dump_trace(task, NULL, NULL, &save_stack_ops, trace); 52 + trace->entries[trace->nr_entries++] = ULONG_MAX; 220 53 } 54 + EXPORT_SYMBOL(save_stack_trace); 221 55
+2 -10
arch/x86_64/kernel/tce.c
··· 1 1 /* 2 + * This file manages the translation entries for the IBM Calgary IOMMU. 3 + * 2 4 * Derived from arch/powerpc/platforms/pseries/iommu.c 3 5 * 4 6 * Copyright (C) IBM Corporation, 2006 ··· 106 104 /* set the tce table size - measured in entries */ 107 105 tbl->it_size = table_size_to_number_of_entries(specified_table_size); 108 106 109 - tbl->it_base = (unsigned long)tce_table_kva[dev->bus->number]; 110 - if (!tbl->it_base) { 111 - printk(KERN_ERR "Calgary: iommu_table_setparms: " 112 - "no table allocated?!\n"); 113 - ret = -ENOMEM; 114 - goto done; 115 - } 116 - 117 107 /* 118 108 * number of bytes needed for the bitmap size in number of 119 109 * entries; we need one bit per entry ··· 153 159 ret = tce_table_setparms(dev, tbl); 154 160 if (ret) 155 161 goto free_tbl; 156 - 157 - tce_free(tbl, 0, tbl->it_size); 158 162 159 163 tbl->bbar = bbar; 160 164
+56 -40
arch/x86_64/kernel/time.c
··· 24 24 #include <linux/device.h> 25 25 #include <linux/sysdev.h> 26 26 #include <linux/bcd.h> 27 + #include <linux/notifier.h> 28 + #include <linux/cpu.h> 27 29 #include <linux/kallsyms.h> 28 30 #include <linux/acpi.h> 29 31 #ifdef CONFIG_ACPI ··· 41 39 #include <asm/sections.h> 42 40 #include <linux/cpufreq.h> 43 41 #include <linux/hpet.h> 44 - #ifdef CONFIG_X86_LOCAL_APIC 45 42 #include <asm/apic.h> 46 - #endif 47 43 48 44 #ifdef CONFIG_CPU_FREQ 49 45 static void cpufreq_delayed_get(void); ··· 49 49 extern void i8254_timer_resume(void); 50 50 extern int using_apic_timer; 51 51 52 - static char *time_init_gtod(void); 52 + static char *timename = NULL; 53 53 54 54 DEFINE_SPINLOCK(rtc_lock); 55 55 EXPORT_SYMBOL(rtc_lock); ··· 187 187 { 188 188 unsigned long pc = instruction_pointer(regs); 189 189 190 - /* Assume the lock function has either no stack frame or only a single 191 - word. This checks if the address on the stack looks like a kernel 192 - text address. 193 - There is a small window for false hits, but in that case the tick 194 - is just accounted to the spinlock function. 195 - Better would be to write these functions in assembler again 196 - and check exactly. */ 190 + /* Assume the lock function has either no stack frame or a copy 191 + of eflags from PUSHF 192 + Eflags always has bits 22 and up cleared unlike kernel addresses. */ 197 193 if (!user_mode(regs) && in_lock_functions(pc)) { 198 - char *v = *(char **)regs->rsp; 199 - if ((v >= _stext && v <= _etext) || 200 - (v >= _sinittext && v <= _einittext) || 201 - (v >= (char *)MODULES_VADDR && v <= (char *)MODULES_END)) 202 - return (unsigned long)v; 203 - return ((unsigned long *)regs->rsp)[1]; 194 + unsigned long *sp = (unsigned long *)regs->rsp; 195 + if (sp[0] >> 22) 196 + return sp[0]; 197 + if (sp[1] >> 22) 198 + return sp[1]; 204 199 } 205 200 return pc; 206 201 } ··· 276 281 * Note: This function is required to return accurate 277 282 * time even in the absence of multiple timer ticks. 278 283 */ 284 + static inline unsigned long long cycles_2_ns(unsigned long long cyc); 279 285 unsigned long long monotonic_clock(void) 280 286 { 281 287 unsigned long seq; ··· 301 305 base = monotonic_base; 302 306 } while (read_seqretry(&xtime_lock, seq)); 303 307 this_offset = get_cycles_sync(); 304 - /* FIXME: 1000 or 1000000? */ 305 - offset = (this_offset - last_offset)*1000 / cpu_khz; 308 + offset = cycles_2_ns(this_offset - last_offset); 306 309 } 307 310 return base + offset; 308 311 } ··· 405 410 offset %= USEC_PER_TICK; 406 411 } 407 412 408 - /* FIXME: 1000 or 1000000? */ 409 - monotonic_base += (tsc - vxtime.last_tsc) * 1000000 / cpu_khz; 413 + monotonic_base += cycles_2_ns(tsc - vxtime.last_tsc); 410 414 411 415 vxtime.last_tsc = tsc - vxtime.quot * delay / vxtime.tsc_quot; 412 416 ··· 435 441 * have to call the local interrupt handler. 436 442 */ 437 443 438 - #ifndef CONFIG_X86_LOCAL_APIC 439 - profile_tick(CPU_PROFILING, regs); 440 - #else 441 444 if (!using_apic_timer) 442 445 smp_local_timer_interrupt(regs); 443 - #endif 444 446 445 447 /* 446 448 * If we have an externally synchronized Linux clock, then update CMOS clock ··· 460 470 if (apic_runs_main_timer > 1) 461 471 return IRQ_HANDLED; 462 472 main_timer_handler(regs); 463 - #ifdef CONFIG_X86_LOCAL_APIC 464 473 if (using_apic_timer) 465 474 smp_send_timer_broadcast_ipi(); 466 - #endif 467 475 return IRQ_HANDLED; 468 476 } 469 477 ··· 881 893 timer_interrupt, IRQF_DISABLED, CPU_MASK_NONE, "timer", NULL, NULL 882 894 }; 883 895 896 + static int __cpuinit 897 + time_cpu_notifier(struct notifier_block *nb, unsigned long action, void *hcpu) 898 + { 899 + unsigned cpu = (unsigned long) hcpu; 900 + if (action == CPU_ONLINE) 901 + vsyscall_set_cpu(cpu); 902 + return NOTIFY_DONE; 903 + } 904 + 884 905 void __init time_init(void) 885 906 { 886 - char *timename; 887 - char *gtod; 888 - 889 907 if (nohpet) 890 908 vxtime.hpet_address = 0; 891 909 ··· 925 931 } 926 932 927 933 vxtime.mode = VXTIME_TSC; 928 - gtod = time_init_gtod(); 929 - 930 - printk(KERN_INFO "time.c: Using %ld.%06ld MHz WALL %s GTOD %s timer.\n", 931 - vxtime_hz / 1000000, vxtime_hz % 1000000, timename, gtod); 932 - printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n", 933 - cpu_khz / 1000, cpu_khz % 1000); 934 934 vxtime.quot = (USEC_PER_SEC << US_SCALE) / vxtime_hz; 935 935 vxtime.tsc_quot = (USEC_PER_MSEC << US_SCALE) / cpu_khz; 936 936 vxtime.last_tsc = get_cycles_sync(); 937 - setup_irq(0, &irq0); 938 - 939 937 set_cyc2ns_scale(cpu_khz); 938 + setup_irq(0, &irq0); 939 + hotcpu_notifier(time_cpu_notifier, 0); 940 + time_cpu_notifier(NULL, CPU_ONLINE, (void *)(long)smp_processor_id()); 941 + 942 + #ifndef CONFIG_SMP 943 + time_init_gtod(); 944 + #endif 940 945 } 941 946 942 947 /* ··· 966 973 /* 967 974 * Decide what mode gettimeofday should use. 968 975 */ 969 - __init static char *time_init_gtod(void) 976 + void time_init_gtod(void) 970 977 { 971 978 char *timetype; 972 979 973 980 if (unsynchronized_tsc()) 974 981 notsc = 1; 982 + 983 + if (cpu_has(&boot_cpu_data, X86_FEATURE_RDTSCP)) 984 + vgetcpu_mode = VGETCPU_RDTSCP; 985 + else 986 + vgetcpu_mode = VGETCPU_LSL; 987 + 975 988 if (vxtime.hpet_address && notsc) { 976 989 timetype = hpet_use_timer ? "HPET" : "PIT/HPET"; 977 990 if (hpet_use_timer) ··· 1000 1001 timetype = hpet_use_timer ? "HPET/TSC" : "PIT/TSC"; 1001 1002 vxtime.mode = VXTIME_TSC; 1002 1003 } 1003 - return timetype; 1004 + 1005 + printk(KERN_INFO "time.c: Using %ld.%06ld MHz WALL %s GTOD %s timer.\n", 1006 + vxtime_hz / 1000000, vxtime_hz % 1000000, timename, timetype); 1007 + printk(KERN_INFO "time.c: Detected %d.%03d MHz processor.\n", 1008 + cpu_khz / 1000, cpu_khz % 1000); 1009 + vxtime.quot = (USEC_PER_SEC << US_SCALE) / vxtime_hz; 1010 + vxtime.tsc_quot = (USEC_PER_MSEC << US_SCALE) / cpu_khz; 1011 + vxtime.last_tsc = get_cycles_sync(); 1012 + 1013 + set_cyc2ns_scale(cpu_khz); 1004 1014 } 1005 1015 1006 1016 __setup("report_lost_ticks", time_setup); ··· 1039 1031 unsigned long flags; 1040 1032 unsigned long sec; 1041 1033 unsigned long ctime = get_cmos_time(); 1042 - unsigned long sleep_length = (ctime - sleep_start) * HZ; 1034 + long sleep_length = (ctime - sleep_start) * HZ; 1043 1035 1036 + if (sleep_length < 0) { 1037 + printk(KERN_WARNING "Time skew detected in timer resume!\n"); 1038 + /* The time after the resume must not be earlier than the time 1039 + * before the suspend or some nasty things will happen 1040 + */ 1041 + sleep_length = 0; 1042 + ctime = sleep_start; 1043 + } 1044 1044 if (vxtime.hpet_address) 1045 1045 hpet_reenable(); 1046 1046 else
+1 -1
arch/x86_64/kernel/trampoline.S
··· 64 64 .word 0, 0 # idt base = 0L 65 65 66 66 gdt_48: 67 - .short __KERNEL32_CS + 7 # gdt limit 67 + .short GDT_ENTRIES*8 - 1 # gdt limit 68 68 .long cpu_gdt_table-__START_KERNEL_map 69 69 70 70 .globl trampoline_end
+131 -73
arch/x86_64/kernel/traps.c
··· 45 45 #include <asm/pda.h> 46 46 #include <asm/proto.h> 47 47 #include <asm/nmi.h> 48 + #include <asm/stacktrace.h> 48 49 49 50 asmlinkage void divide_error(void); 50 51 asmlinkage void debug(void); ··· 143 142 #endif 144 143 145 144 static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, 146 - unsigned *usedp, const char **idp) 145 + unsigned *usedp, char **idp) 147 146 { 148 147 static char ids[][8] = { 149 148 [DEBUG_STACK - 1] = "#DB", ··· 162 161 * 'stack' is in one of them: 163 162 */ 164 163 for (k = 0; k < N_EXCEPTION_STACKS; k++) { 165 - unsigned long end; 166 - 167 - /* 168 - * set 'end' to the end of the exception stack. 169 - */ 170 - switch (k + 1) { 171 - /* 172 - * TODO: this block is not needed i think, because 173 - * setup64.c:cpu_init() sets up t->ist[DEBUG_STACK] 174 - * properly too. 175 - */ 176 - #if DEBUG_STKSZ > EXCEPTION_STKSZ 177 - case DEBUG_STACK: 178 - end = cpu_pda(cpu)->debugstack + DEBUG_STKSZ; 179 - break; 180 - #endif 181 - default: 182 - end = per_cpu(orig_ist, cpu).ist[k]; 183 - break; 184 - } 164 + unsigned long end = per_cpu(orig_ist, cpu).ist[k]; 185 165 /* 186 166 * Is 'stack' above this exception frame's end? 187 167 * If yes then skip to the next frame. ··· 216 234 return NULL; 217 235 } 218 236 219 - static int show_trace_unwind(struct unwind_frame_info *info, void *context) 237 + struct ops_and_data { 238 + struct stacktrace_ops *ops; 239 + void *data; 240 + }; 241 + 242 + static int dump_trace_unwind(struct unwind_frame_info *info, void *context) 220 243 { 244 + struct ops_and_data *oad = (struct ops_and_data *)context; 221 245 int n = 0; 222 246 223 247 while (unwind(info) == 0 && UNW_PC(info)) { 224 248 n++; 225 - printk_address(UNW_PC(info)); 249 + oad->ops->address(oad->data, UNW_PC(info)); 226 250 if (arch_unw_user_mode(info)) 227 251 break; 228 252 } ··· 242 254 * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack 243 255 */ 244 256 245 - void show_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long * stack) 257 + void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long * stack, 258 + struct stacktrace_ops *ops, void *data) 246 259 { 247 - const unsigned cpu = safe_smp_processor_id(); 260 + const unsigned cpu = smp_processor_id(); 248 261 unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr; 249 262 unsigned used = 0; 250 - 251 - printk("\nCall Trace:\n"); 252 263 253 264 if (!tsk) 254 265 tsk = current; ··· 255 268 if (call_trace >= 0) { 256 269 int unw_ret = 0; 257 270 struct unwind_frame_info info; 271 + struct ops_and_data oad = { .ops = ops, .data = data }; 258 272 259 273 if (regs) { 260 274 if (unwind_init_frame_info(&info, tsk, regs) == 0) 261 - unw_ret = show_trace_unwind(&info, NULL); 275 + unw_ret = dump_trace_unwind(&info, &oad); 262 276 } else if (tsk == current) 263 - unw_ret = unwind_init_running(&info, show_trace_unwind, NULL); 277 + unw_ret = unwind_init_running(&info, dump_trace_unwind, &oad); 264 278 else { 265 279 if (unwind_init_blocked(&info, tsk) == 0) 266 - unw_ret = show_trace_unwind(&info, NULL); 280 + unw_ret = dump_trace_unwind(&info, &oad); 267 281 } 268 282 if (unw_ret > 0) { 269 283 if (call_trace == 1 && !arch_unw_user_mode(&info)) { 270 - print_symbol("DWARF2 unwinder stuck at %s\n", 284 + ops->warning_symbol(data, "DWARF2 unwinder stuck at %s\n", 271 285 UNW_PC(&info)); 272 286 if ((long)UNW_SP(&info) < 0) { 273 - printk("Leftover inexact backtrace:\n"); 287 + ops->warning(data, "Leftover inexact backtrace:\n"); 274 288 stack = (unsigned long *)UNW_SP(&info); 289 + if (!stack) 290 + return; 275 291 } else 276 - printk("Full inexact backtrace again:\n"); 292 + ops->warning(data, "Full inexact backtrace again:\n"); 277 293 } else if (call_trace >= 1) 278 294 return; 279 295 else 280 - printk("Full inexact backtrace again:\n"); 296 + ops->warning(data, "Full inexact backtrace again:\n"); 281 297 } else 282 - printk("Inexact backtrace:\n"); 298 + ops->warning(data, "Inexact backtrace:\n"); 299 + } 300 + if (!stack) { 301 + unsigned long dummy; 302 + stack = &dummy; 303 + if (tsk && tsk != current) 304 + stack = (unsigned long *)tsk->thread.rsp; 283 305 } 284 306 285 307 /* ··· 299 303 #define HANDLE_STACK(cond) \ 300 304 do while (cond) { \ 301 305 unsigned long addr = *stack++; \ 302 - if (kernel_text_address(addr)) { \ 306 + if (oops_in_progress ? \ 307 + __kernel_text_address(addr) : \ 308 + kernel_text_address(addr)) { \ 303 309 /* \ 304 310 * If the address is either in the text segment of the \ 305 311 * kernel, or in the region which contains vmalloc'ed \ ··· 310 312 * down the cause of the crash will be able to figure \ 311 313 * out the call path that was taken. \ 312 314 */ \ 313 - printk_address(addr); \ 315 + ops->address(data, addr); \ 314 316 } \ 315 317 } while (0) 316 318 ··· 319 321 * current stack address. If the stacks consist of nested 320 322 * exceptions 321 323 */ 322 - for ( ; ; ) { 323 - const char *id; 324 + for (;;) { 325 + char *id; 324 326 unsigned long *estack_end; 325 327 estack_end = in_exception_stack(cpu, (unsigned long)stack, 326 328 &used, &id); 327 329 328 330 if (estack_end) { 329 - printk(" <%s>", id); 331 + if (ops->stack(data, id) < 0) 332 + break; 330 333 HANDLE_STACK (stack < estack_end); 331 - printk(" <EOE>"); 334 + ops->stack(data, "<EOE>"); 332 335 /* 333 336 * We link to the next stack via the 334 337 * second-to-last pointer (index -2 to end) in the ··· 344 345 (IRQSTACKSIZE - 64) / sizeof(*irqstack); 345 346 346 347 if (stack >= irqstack && stack < irqstack_end) { 347 - printk(" <IRQ>"); 348 + if (ops->stack(data, "IRQ") < 0) 349 + break; 348 350 HANDLE_STACK (stack < irqstack_end); 349 351 /* 350 352 * We link to the next stack (which would be ··· 354 354 */ 355 355 stack = (unsigned long *) (irqstack_end[-1]); 356 356 irqstack_end = NULL; 357 - printk(" <EOI>"); 357 + ops->stack(data, "EOI"); 358 358 continue; 359 359 } 360 360 } ··· 362 362 } 363 363 364 364 /* 365 - * This prints the process stack: 365 + * This handles the process stack: 366 366 */ 367 367 HANDLE_STACK (((long) stack & (THREAD_SIZE-1)) != 0); 368 368 #undef HANDLE_STACK 369 + } 370 + EXPORT_SYMBOL(dump_trace); 369 371 372 + static void 373 + print_trace_warning_symbol(void *data, char *msg, unsigned long symbol) 374 + { 375 + print_symbol(msg, symbol); 370 376 printk("\n"); 371 377 } 372 378 373 - static void _show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long * rsp) 379 + static void print_trace_warning(void *data, char *msg) 380 + { 381 + printk("%s\n", msg); 382 + } 383 + 384 + static int print_trace_stack(void *data, char *name) 385 + { 386 + printk(" <%s> ", name); 387 + return 0; 388 + } 389 + 390 + static void print_trace_address(void *data, unsigned long addr) 391 + { 392 + printk_address(addr); 393 + } 394 + 395 + static struct stacktrace_ops print_trace_ops = { 396 + .warning = print_trace_warning, 397 + .warning_symbol = print_trace_warning_symbol, 398 + .stack = print_trace_stack, 399 + .address = print_trace_address, 400 + }; 401 + 402 + void 403 + show_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack) 404 + { 405 + printk("\nCall Trace:\n"); 406 + dump_trace(tsk, regs, stack, &print_trace_ops, NULL); 407 + printk("\n"); 408 + } 409 + 410 + static void 411 + _show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *rsp) 374 412 { 375 413 unsigned long *stack; 376 414 int i; 377 - const int cpu = safe_smp_processor_id(); 415 + const int cpu = smp_processor_id(); 378 416 unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr); 379 417 unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE); 380 418 ··· 466 428 int i; 467 429 int in_kernel = !user_mode(regs); 468 430 unsigned long rsp; 469 - const int cpu = safe_smp_processor_id(); 431 + const int cpu = smp_processor_id(); 470 432 struct task_struct *cur = cpu_pda(cpu)->pcurrent; 471 433 472 434 rsp = regs->rsp; ··· 541 503 542 504 unsigned __kprobes long oops_begin(void) 543 505 { 544 - int cpu = safe_smp_processor_id(); 506 + int cpu = smp_processor_id(); 545 507 unsigned long flags; 508 + 509 + oops_enter(); 546 510 547 511 /* racy, but better than risking deadlock. */ 548 512 local_irq_save(flags); ··· 574 534 spin_unlock_irqrestore(&die_lock, flags); 575 535 if (panic_on_oops) 576 536 panic("Fatal exception"); 537 + oops_exit(); 577 538 } 578 539 579 540 void __kprobes __die(const char * str, struct pt_regs * regs, long err) ··· 611 570 do_exit(SIGSEGV); 612 571 } 613 572 614 - void __kprobes die_nmi(char *str, struct pt_regs *regs) 573 + void __kprobes die_nmi(char *str, struct pt_regs *regs, int do_panic) 615 574 { 616 575 unsigned long flags = oops_begin(); 617 576 ··· 619 578 * We are in trouble anyway, lets at least try 620 579 * to get a message out. 621 580 */ 622 - printk(str, safe_smp_processor_id()); 581 + printk(str, smp_processor_id()); 623 582 show_registers(regs); 624 583 if (kexec_should_crash(current)) 625 584 crash_kexec(regs); 626 - if (panic_on_timeout || panic_on_oops) 627 - panic("nmi watchdog"); 628 - printk("console shuts up ...\n"); 585 + if (do_panic || panic_on_oops) 586 + panic("Non maskable interrupt"); 629 587 oops_end(flags); 630 588 nmi_exit(); 631 589 local_irq_enable(); ··· 770 730 static __kprobes void 771 731 mem_parity_error(unsigned char reason, struct pt_regs * regs) 772 732 { 773 - printk("Uhhuh. NMI received. Dazed and confused, but trying to continue\n"); 774 - printk("You probably have a hardware problem with your RAM chips\n"); 733 + printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x.\n", 734 + reason); 735 + printk(KERN_EMERG "You probably have a hardware problem with your " 736 + "RAM chips\n"); 737 + 738 + if (panic_on_unrecovered_nmi) 739 + panic("NMI: Not continuing"); 740 + 741 + printk(KERN_EMERG "Dazed and confused, but trying to continue\n"); 775 742 776 743 /* Clear and disable the memory parity error line. */ 777 744 reason = (reason & 0xf) | 4; ··· 801 754 802 755 static __kprobes void 803 756 unknown_nmi_error(unsigned char reason, struct pt_regs * regs) 804 - { printk("Uhhuh. NMI received for unknown reason %02x.\n", reason); 805 - printk("Dazed and confused, but trying to continue\n"); 806 - printk("Do you have a strange power saving mode enabled?\n"); 757 + { 758 + printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x.\n", 759 + reason); 760 + printk(KERN_EMERG "Do you have a strange power saving mode enabled?\n"); 761 + 762 + if (panic_on_unrecovered_nmi) 763 + panic("NMI: Not continuing"); 764 + 765 + printk(KERN_EMERG "Dazed and confused, but trying to continue\n"); 807 766 } 808 767 809 768 /* Runs on IST stack. This code must keep interrupts off all the time. ··· 829 776 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT) 830 777 == NOTIFY_STOP) 831 778 return; 832 - #ifdef CONFIG_X86_LOCAL_APIC 833 779 /* 834 780 * Ok, so this is none of the documented NMI sources, 835 781 * so it must be the NMI watchdog. 836 782 */ 837 - if (nmi_watchdog > 0) { 838 - nmi_watchdog_tick(regs,reason); 783 + if (nmi_watchdog_tick(regs,reason)) 839 784 return; 840 - } 841 - #endif 842 - unknown_nmi_error(reason, regs); 785 + if (!do_nmi_callback(regs,cpu)) 786 + unknown_nmi_error(reason, regs); 787 + 843 788 return; 844 789 } 845 790 if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP) ··· 1122 1071 init_fpu(me); 1123 1072 restore_fpu_checking(&me->thread.i387.fxsave); 1124 1073 task_thread_info(me)->status |= TS_USEDFPU; 1074 + me->fpu_counter++; 1125 1075 } 1126 1076 1127 1077 void __init trap_init(void) ··· 1161 1109 } 1162 1110 1163 1111 1164 - /* Actual parsing is done early in setup.c. */ 1165 - static int __init oops_dummy(char *s) 1112 + static int __init oops_setup(char *s) 1166 1113 { 1167 - panic_on_oops = 1; 1168 - return 1; 1114 + if (!s) 1115 + return -EINVAL; 1116 + if (!strcmp(s, "panic")) 1117 + panic_on_oops = 1; 1118 + return 0; 1169 1119 } 1170 - __setup("oops=", oops_dummy); 1120 + early_param("oops", oops_setup); 1171 1121 1172 1122 static int __init kstack_setup(char *s) 1173 1123 { 1124 + if (!s) 1125 + return -EINVAL; 1174 1126 kstack_depth_to_print = simple_strtoul(s,NULL,0); 1175 - return 1; 1127 + return 0; 1176 1128 } 1177 - __setup("kstack=", kstack_setup); 1129 + early_param("kstack", kstack_setup); 1178 1130 1179 1131 #ifdef CONFIG_STACK_UNWIND 1180 1132 static int __init call_trace_setup(char *s) 1181 1133 { 1134 + if (!s) 1135 + return -EINVAL; 1182 1136 if (strcmp(s, "old") == 0) 1183 1137 call_trace = -1; 1184 1138 else if (strcmp(s, "both") == 0) ··· 1193 1135 call_trace = 1; 1194 1136 else if (strcmp(s, "new") == 0) 1195 1137 call_trace = 2; 1196 - return 1; 1138 + return 0; 1197 1139 } 1198 - __setup("call_trace=", call_trace_setup); 1140 + early_param("call_trace", call_trace_setup); 1199 1141 #endif
+16 -9
arch/x86_64/kernel/vmlinux.lds.S
··· 13 13 OUTPUT_ARCH(i386:x86-64) 14 14 ENTRY(phys_startup_64) 15 15 jiffies_64 = jiffies; 16 + PHDRS { 17 + text PT_LOAD FLAGS(5); /* R_E */ 18 + data PT_LOAD FLAGS(7); /* RWE */ 19 + user PT_LOAD FLAGS(7); /* RWE */ 20 + note PT_NOTE FLAGS(4); /* R__ */ 21 + } 16 22 SECTIONS 17 23 { 18 24 . = __START_KERNEL; ··· 37 31 KPROBES_TEXT 38 32 *(.fixup) 39 33 *(.gnu.warning) 40 - } = 0x9090 34 + } :text = 0x9090 41 35 /* out-of-line lock text */ 42 36 .text.lock : AT(ADDR(.text.lock) - LOAD_OFFSET) { *(.text.lock) } 43 37 ··· 63 57 .data : AT(ADDR(.data) - LOAD_OFFSET) { 64 58 *(.data) 65 59 CONSTRUCTORS 66 - } 60 + } :data 67 61 68 62 _edata = .; /* End of data section */ 69 63 ··· 95 89 #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET) 96 90 97 91 . = VSYSCALL_ADDR; 98 - .vsyscall_0 : AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) } 92 + .vsyscall_0 : AT(VSYSCALL_PHYS_ADDR) { *(.vsyscall_0) } :user 99 93 __vsyscall_0 = VSYSCALL_VIRT_ADDR; 100 94 101 95 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); ··· 104 98 105 99 .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) } 106 100 vxtime = VVIRT(.vxtime); 101 + 102 + .vgetcpu_mode : AT(VLOAD(.vgetcpu_mode)) { *(.vgetcpu_mode) } 103 + vgetcpu_mode = VVIRT(.vgetcpu_mode); 107 104 108 105 .wall_jiffies : AT(VLOAD(.wall_jiffies)) { *(.wall_jiffies) } 109 106 wall_jiffies = VVIRT(.wall_jiffies); ··· 141 132 . = ALIGN(8192); /* init_task */ 142 133 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { 143 134 *(.data.init_task) 144 - } 135 + } :data 145 136 146 137 . = ALIGN(4096); 147 138 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { ··· 216 207 __initramfs_start = .; 217 208 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) } 218 209 __initramfs_end = .; 219 - /* temporary here to work around NR_CPUS. If you see this comment in 2.6.17+ 220 - complain */ 221 - . = ALIGN(4096); 222 - __init_end = .; 223 - . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); 210 + . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); 224 211 __per_cpu_start = .; 225 212 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) } 226 213 __per_cpu_end = .; 214 + . = ALIGN(4096); 215 + __init_end = .; 227 216 228 217 . = ALIGN(4096); 229 218 __nosave_begin = .;
+3
arch/x86_64/kernel/vsmp.c
··· 20 20 void *address; 21 21 unsigned int cap, ctl; 22 22 23 + if (!early_pci_allowed()) 24 + return 0; 25 + 23 26 /* Check if we are running on a ScaleMP vSMP box */ 24 27 if ((read_pci_config_16(0, 0x1f, 0, PCI_VENDOR_ID) != PCI_VENDOR_ID_SCALEMP) || 25 28 (read_pci_config_16(0, 0x1f, 0, PCI_DEVICE_ID) != PCI_DEVICE_ID_SCALEMP_VSMP_CTL))
+90 -8
arch/x86_64/kernel/vsyscall.c
··· 26 26 #include <linux/seqlock.h> 27 27 #include <linux/jiffies.h> 28 28 #include <linux/sysctl.h> 29 + #include <linux/getcpu.h> 29 30 30 31 #include <asm/vsyscall.h> 31 32 #include <asm/pgtable.h> ··· 34 33 #include <asm/fixmap.h> 35 34 #include <asm/errno.h> 36 35 #include <asm/io.h> 36 + #include <asm/segment.h> 37 + #include <asm/desc.h> 38 + #include <asm/topology.h> 37 39 38 40 #define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr))) 39 41 40 42 int __sysctl_vsyscall __section_sysctl_vsyscall = 1; 41 43 seqlock_t __xtime_lock __section_xtime_lock = SEQLOCK_UNLOCKED; 44 + int __vgetcpu_mode __section_vgetcpu_mode; 42 45 43 46 #include <asm/unistd.h> 44 47 ··· 77 72 __vxtime.tsc_quot) >> 32; 78 73 /* See comment in x86_64 do_gettimeofday. */ 79 74 } else { 80 - usec += ((readl((void *)fix_to_virt(VSYSCALL_HPET) + 0xf0) - 75 + usec += ((readl((void __iomem *) 76 + fix_to_virt(VSYSCALL_HPET) + 0xf0) - 81 77 __vxtime.last) * __vxtime.quot) >> 32; 82 78 } 83 79 } while (read_seqretry(&__xtime_lock, sequence)); ··· 133 127 return __xtime.tv_sec; 134 128 } 135 129 136 - long __vsyscall(2) venosys_0(void) 130 + /* Fast way to get current CPU and node. 131 + This helps to do per node and per CPU caches in user space. 132 + The result is not guaranteed without CPU affinity, but usually 133 + works out because the scheduler tries to keep a thread on the same 134 + CPU. 135 + 136 + tcache must point to a two element sized long array. 137 + All arguments can be NULL. */ 138 + long __vsyscall(2) 139 + vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache) 137 140 { 138 - return -ENOSYS; 141 + unsigned int dummy, p; 142 + unsigned long j = 0; 143 + 144 + /* Fast cache - only recompute value once per jiffies and avoid 145 + relatively costly rdtscp/cpuid otherwise. 146 + This works because the scheduler usually keeps the process 147 + on the same CPU and this syscall doesn't guarantee its 148 + results anyways. 149 + We do this here because otherwise user space would do it on 150 + its own in a likely inferior way (no access to jiffies). 151 + If you don't like it pass NULL. */ 152 + if (tcache && tcache->t0 == (j = __jiffies)) { 153 + p = tcache->t1; 154 + } else if (__vgetcpu_mode == VGETCPU_RDTSCP) { 155 + /* Load per CPU data from RDTSCP */ 156 + rdtscp(dummy, dummy, p); 157 + } else { 158 + /* Load per CPU data from GDT */ 159 + asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG)); 160 + } 161 + if (tcache) { 162 + tcache->t0 = j; 163 + tcache->t1 = p; 164 + } 165 + if (cpu) 166 + *cpu = p & 0xfff; 167 + if (node) 168 + *node = p >> 12; 169 + return 0; 139 170 } 140 171 141 172 long __vsyscall(3) venosys_1(void) ··· 192 149 void __user *buffer, size_t *lenp, loff_t *ppos) 193 150 { 194 151 extern u16 vsysc1, vsysc2; 195 - u16 *map1, *map2; 152 + u16 __iomem *map1; 153 + u16 __iomem *map2; 196 154 int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); 197 155 if (!write) 198 156 return ret; ··· 208 164 goto out; 209 165 } 210 166 if (!sysctl_vsyscall) { 211 - *map1 = SYSCALL; 212 - *map2 = SYSCALL; 167 + writew(SYSCALL, map1); 168 + writew(SYSCALL, map2); 213 169 } else { 214 - *map1 = NOP2; 215 - *map2 = NOP2; 170 + writew(NOP2, map1); 171 + writew(NOP2, map2); 216 172 } 217 173 iounmap(map2); 218 174 out: ··· 244 200 245 201 #endif 246 202 203 + static void __cpuinit write_rdtscp_cb(void *info) 204 + { 205 + write_rdtscp_aux((unsigned long)info); 206 + } 207 + 208 + void __cpuinit vsyscall_set_cpu(int cpu) 209 + { 210 + unsigned long *d; 211 + unsigned long node = 0; 212 + #ifdef CONFIG_NUMA 213 + node = cpu_to_node[cpu]; 214 + #endif 215 + if (cpu_has(&cpu_data[cpu], X86_FEATURE_RDTSCP)) { 216 + void *info = (void *)((node << 12) | cpu); 217 + /* Can happen on preemptive kernel */ 218 + if (get_cpu() == cpu) 219 + write_rdtscp_cb(info); 220 + #ifdef CONFIG_SMP 221 + else { 222 + /* the notifier is unfortunately not executed on the 223 + target CPU */ 224 + smp_call_function_single(cpu,write_rdtscp_cb,info,0,1); 225 + } 226 + #endif 227 + put_cpu(); 228 + } 229 + 230 + /* Store cpu number in limit so that it can be loaded quickly 231 + in user space in vgetcpu. 232 + 12 bits for the CPU and 8 bits for the node. */ 233 + d = (unsigned long *)(cpu_gdt(cpu) + GDT_ENTRY_PER_CPU); 234 + *d = 0x0f40000000000ULL; 235 + *d |= cpu; 236 + *d |= (node & 0xf) << 12; 237 + *d |= (node >> 4) << 48; 238 + } 239 + 247 240 static void __init map_vsyscall(void) 248 241 { 249 242 extern char __vsyscall_0; ··· 295 214 VSYSCALL_ADDR(__NR_vgettimeofday))); 296 215 BUG_ON((unsigned long) &vtime != VSYSCALL_ADDR(__NR_vtime)); 297 216 BUG_ON((VSYSCALL_ADDR(0) != __fix_to_virt(VSYSCALL_FIRST_PAGE))); 217 + BUG_ON((unsigned long) &vgetcpu != VSYSCALL_ADDR(__NR_vgetcpu)); 298 218 map_vsyscall(); 299 219 #ifdef CONFIG_SYSCTL 300 220 register_sysctl_table(kernel_root_table2, 0);
+1
arch/x86_64/kernel/x8664_ksyms.c
··· 29 29 EXPORT_SYMBOL(copy_user_generic); 30 30 EXPORT_SYMBOL(copy_from_user); 31 31 EXPORT_SYMBOL(copy_to_user); 32 + EXPORT_SYMBOL(__copy_from_user_inatomic); 32 33 33 34 EXPORT_SYMBOL(copy_page); 34 35 EXPORT_SYMBOL(clear_page);
+1 -1
arch/x86_64/lib/Makefile
··· 9 9 lib-y := csum-partial.o csum-copy.o csum-wrappers.o delay.o \ 10 10 usercopy.o getuser.o putuser.o \ 11 11 thunk.o clear_page.o copy_page.o bitstr.o bitops.o 12 - lib-y += memcpy.o memmove.o memset.o copy_user.o 12 + lib-y += memcpy.o memmove.o memset.o copy_user.o rwlock.o
+28 -19
arch/x86_64/lib/clear_page.S
··· 1 + #include <linux/linkage.h> 2 + #include <asm/dwarf2.h> 3 + 1 4 /* 2 5 * Zero a page. 3 6 * rdi page 4 7 */ 5 - .globl clear_page 6 - .p2align 4 7 - clear_page: 8 + ALIGN 9 + clear_page_c: 10 + CFI_STARTPROC 11 + movl $4096/8,%ecx 12 + xorl %eax,%eax 13 + rep stosq 14 + ret 15 + CFI_ENDPROC 16 + ENDPROC(clear_page) 17 + 18 + ENTRY(clear_page) 19 + CFI_STARTPROC 8 20 xorl %eax,%eax 9 21 movl $4096/64,%ecx 10 22 .p2align 4 ··· 35 23 jnz .Lloop 36 24 nop 37 25 ret 38 - clear_page_end: 26 + CFI_ENDPROC 27 + .Lclear_page_end: 28 + ENDPROC(clear_page) 39 29 40 30 /* Some CPUs run faster using the string instructions. 41 31 It is also a lot simpler. Use this when possible */ 42 32 43 33 #include <asm/cpufeature.h> 44 34 35 + .section .altinstr_replacement,"ax" 36 + 1: .byte 0xeb /* jmp <disp8> */ 37 + .byte (clear_page_c - clear_page) - (2f - 1b) /* offset */ 38 + 2: 39 + .previous 45 40 .section .altinstructions,"a" 46 41 .align 8 47 - .quad clear_page 48 - .quad clear_page_c 49 - .byte X86_FEATURE_REP_GOOD 50 - .byte clear_page_end-clear_page 51 - .byte clear_page_c_end-clear_page_c 52 - .previous 53 - 54 - .section .altinstr_replacement,"ax" 55 - clear_page_c: 56 - movl $4096/8,%ecx 57 - xorl %eax,%eax 58 - rep 59 - stosq 60 - ret 61 - clear_page_c_end: 42 + .quad clear_page 43 + .quad 1b 44 + .byte X86_FEATURE_REP_GOOD 45 + .byte .Lclear_page_end - clear_page 46 + .byte 2b - 1b 62 47 .previous
+36 -17
arch/x86_64/lib/copy_page.S
··· 1 1 /* Written 2003 by Andi Kleen, based on a kernel by Evandro Menezes */ 2 2 3 + #include <linux/config.h> 4 + #include <linux/linkage.h> 5 + #include <asm/dwarf2.h> 6 + 7 + ALIGN 8 + copy_page_c: 9 + CFI_STARTPROC 10 + movl $4096/8,%ecx 11 + rep movsq 12 + ret 13 + CFI_ENDPROC 14 + ENDPROC(copy_page_c) 15 + 3 16 /* Don't use streaming store because it's better when the target 4 17 ends up in cache. */ 5 18 6 19 /* Could vary the prefetch distance based on SMP/UP */ 7 20 8 - .globl copy_page 9 - .p2align 4 10 - copy_page: 21 + ENTRY(copy_page) 22 + CFI_STARTPROC 11 23 subq $3*8,%rsp 24 + CFI_ADJUST_CFA_OFFSET 3*8 12 25 movq %rbx,(%rsp) 26 + CFI_REL_OFFSET rbx, 0 13 27 movq %r12,1*8(%rsp) 28 + CFI_REL_OFFSET r12, 1*8 14 29 movq %r13,2*8(%rsp) 30 + CFI_REL_OFFSET r13, 2*8 15 31 16 32 movl $(4096/64)-5,%ecx 17 33 .p2align 4 ··· 88 72 jnz .Loop2 89 73 90 74 movq (%rsp),%rbx 75 + CFI_RESTORE rbx 91 76 movq 1*8(%rsp),%r12 77 + CFI_RESTORE r12 92 78 movq 2*8(%rsp),%r13 79 + CFI_RESTORE r13 93 80 addq $3*8,%rsp 81 + CFI_ADJUST_CFA_OFFSET -3*8 94 82 ret 83 + .Lcopy_page_end: 84 + CFI_ENDPROC 85 + ENDPROC(copy_page) 95 86 96 87 /* Some CPUs run faster using the string copy instructions. 97 88 It is also a lot simpler. Use this when possible */ 98 89 99 90 #include <asm/cpufeature.h> 100 91 92 + .section .altinstr_replacement,"ax" 93 + 1: .byte 0xeb /* jmp <disp8> */ 94 + .byte (copy_page_c - copy_page) - (2f - 1b) /* offset */ 95 + 2: 96 + .previous 101 97 .section .altinstructions,"a" 102 98 .align 8 103 - .quad copy_page 104 - .quad copy_page_c 105 - .byte X86_FEATURE_REP_GOOD 106 - .byte copy_page_c_end-copy_page_c 107 - .byte copy_page_c_end-copy_page_c 108 - .previous 109 - 110 - .section .altinstr_replacement,"ax" 111 - copy_page_c: 112 - movl $4096/8,%ecx 113 - rep 114 - movsq 115 - ret 116 - copy_page_c_end: 99 + .quad copy_page 100 + .quad 1b 101 + .byte X86_FEATURE_REP_GOOD 102 + .byte .Lcopy_page_end - copy_page 103 + .byte 2b - 1b 117 104 .previous
+105 -52
arch/x86_64/lib/copy_user.S
··· 4 4 * Functions to copy from and to user space. 5 5 */ 6 6 7 + #include <linux/linkage.h> 8 + #include <asm/dwarf2.h> 9 + 7 10 #define FIX_ALIGNMENT 1 8 11 9 - #include <asm/current.h> 10 - #include <asm/asm-offsets.h> 11 - #include <asm/thread_info.h> 12 - #include <asm/cpufeature.h> 12 + #include <asm/current.h> 13 + #include <asm/asm-offsets.h> 14 + #include <asm/thread_info.h> 15 + #include <asm/cpufeature.h> 16 + 17 + .macro ALTERNATIVE_JUMP feature,orig,alt 18 + 0: 19 + .byte 0xe9 /* 32bit jump */ 20 + .long \orig-1f /* by default jump to orig */ 21 + 1: 22 + .section .altinstr_replacement,"ax" 23 + 2: .byte 0xe9 /* near jump with 32bit immediate */ 24 + .long \alt-1b /* offset */ /* or alternatively to alt */ 25 + .previous 26 + .section .altinstructions,"a" 27 + .align 8 28 + .quad 0b 29 + .quad 2b 30 + .byte \feature /* when feature is set */ 31 + .byte 5 32 + .byte 5 33 + .previous 34 + .endm 13 35 14 36 /* Standard copy_to_user with segment limit checking */ 15 - .globl copy_to_user 16 - .p2align 4 17 - copy_to_user: 37 + ENTRY(copy_to_user) 38 + CFI_STARTPROC 18 39 GET_THREAD_INFO(%rax) 19 40 movq %rdi,%rcx 20 41 addq %rdx,%rcx 21 42 jc bad_to_user 22 43 cmpq threadinfo_addr_limit(%rax),%rcx 23 44 jae bad_to_user 24 - 2: 25 - .byte 0xe9 /* 32bit jump */ 26 - .long .Lcug-1f 27 - 1: 45 + xorl %eax,%eax /* clear zero flag */ 46 + ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string 47 + CFI_ENDPROC 28 48 29 - .section .altinstr_replacement,"ax" 30 - 3: .byte 0xe9 /* replacement jmp with 8 bit immediate */ 31 - .long copy_user_generic_c-1b /* offset */ 32 - .previous 33 - .section .altinstructions,"a" 34 - .align 8 35 - .quad 2b 36 - .quad 3b 37 - .byte X86_FEATURE_REP_GOOD 38 - .byte 5 39 - .byte 5 40 - .previous 49 + ENTRY(copy_user_generic) 50 + CFI_STARTPROC 51 + movl $1,%ecx /* set zero flag */ 52 + ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string 53 + CFI_ENDPROC 54 + 55 + ENTRY(__copy_from_user_inatomic) 56 + CFI_STARTPROC 57 + xorl %ecx,%ecx /* clear zero flag */ 58 + ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string 59 + CFI_ENDPROC 41 60 42 61 /* Standard copy_from_user with segment limit checking */ 43 - .globl copy_from_user 44 - .p2align 4 45 - copy_from_user: 62 + ENTRY(copy_from_user) 63 + CFI_STARTPROC 46 64 GET_THREAD_INFO(%rax) 47 65 movq %rsi,%rcx 48 66 addq %rdx,%rcx 49 67 jc bad_from_user 50 68 cmpq threadinfo_addr_limit(%rax),%rcx 51 69 jae bad_from_user 52 - /* FALL THROUGH to copy_user_generic */ 70 + movl $1,%ecx /* set zero flag */ 71 + ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string 72 + CFI_ENDPROC 73 + ENDPROC(copy_from_user) 53 74 54 75 .section .fixup,"ax" 55 76 /* must zero dest */ 56 77 bad_from_user: 78 + CFI_STARTPROC 57 79 movl %edx,%ecx 58 80 xorl %eax,%eax 59 81 rep ··· 83 61 bad_to_user: 84 62 movl %edx,%eax 85 63 ret 64 + CFI_ENDPROC 65 + END(bad_from_user) 86 66 .previous 87 67 88 68 89 69 /* 90 - * copy_user_generic - memory copy with exception handling. 70 + * copy_user_generic_unrolled - memory copy with exception handling. 71 + * This version is for CPUs like P4 that don't have efficient micro code for rep movsq 91 72 * 92 73 * Input: 93 74 * rdi destination 94 75 * rsi source 95 76 * rdx count 77 + * ecx zero flag -- if true zero destination on error 96 78 * 97 79 * Output: 98 80 * eax uncopied bytes or 0 if successful. 99 81 */ 100 - .globl copy_user_generic 101 - .p2align 4 102 - copy_user_generic: 103 - .byte 0x66,0x66,0x90 /* 5 byte nop for replacement jump */ 104 - .byte 0x66,0x90 105 - 1: 106 - .section .altinstr_replacement,"ax" 107 - 2: .byte 0xe9 /* near jump with 32bit immediate */ 108 - .long copy_user_generic_c-1b /* offset */ 109 - .previous 110 - .section .altinstructions,"a" 111 - .align 8 112 - .quad copy_user_generic 113 - .quad 2b 114 - .byte X86_FEATURE_REP_GOOD 115 - .byte 5 116 - .byte 5 117 - .previous 118 - .Lcug: 82 + ENTRY(copy_user_generic_unrolled) 83 + CFI_STARTPROC 119 84 pushq %rbx 85 + CFI_ADJUST_CFA_OFFSET 8 86 + CFI_REL_OFFSET rbx, 0 87 + pushq %rcx 88 + CFI_ADJUST_CFA_OFFSET 8 89 + CFI_REL_OFFSET rcx, 0 120 90 xorl %eax,%eax /*zero for the exception handler */ 121 91 122 92 #ifdef FIX_ALIGNMENT ··· 182 168 decl %ecx 183 169 jnz .Lloop_1 184 170 171 + CFI_REMEMBER_STATE 185 172 .Lende: 173 + popq %rcx 174 + CFI_ADJUST_CFA_OFFSET -8 175 + CFI_RESTORE rcx 186 176 popq %rbx 177 + CFI_ADJUST_CFA_OFFSET -8 178 + CFI_RESTORE rbx 187 179 ret 180 + CFI_RESTORE_STATE 188 181 189 182 #ifdef FIX_ALIGNMENT 190 183 /* align destination */ ··· 273 252 addl %ecx,%edx 274 253 /* edx: bytes to zero, rdi: dest, eax:zero */ 275 254 .Lzero_rest: 255 + cmpl $0,(%rsp) 256 + jz .Le_zero 276 257 movq %rdx,%rcx 277 258 .Le_byte: 278 259 xorl %eax,%eax ··· 284 261 .Le_zero: 285 262 movq %rdx,%rax 286 263 jmp .Lende 264 + CFI_ENDPROC 265 + ENDPROC(copy_user_generic) 266 + 287 267 288 268 /* Some CPUs run faster using the string copy instructions. 289 269 This is also a lot simpler. Use them when possible. ··· 296 270 /* rdi destination 297 271 * rsi source 298 272 * rdx count 273 + * ecx zero flag 299 274 * 300 275 * Output: 301 276 * eax uncopied bytes or 0 if successfull. ··· 307 280 * And more would be dangerous because both Intel and AMD have 308 281 * errata with rep movsq > 4GB. If someone feels the need to fix 309 282 * this please consider this. 310 - */ 311 - copy_user_generic_c: 283 + */ 284 + ENTRY(copy_user_generic_string) 285 + CFI_STARTPROC 286 + movl %ecx,%r8d /* save zero flag */ 312 287 movl %edx,%ecx 313 288 shrl $3,%ecx 314 289 andl $7,%edx 290 + jz 10f 315 291 1: rep 316 292 movsq 317 293 movl %edx,%ecx 318 294 2: rep 319 295 movsb 320 - 4: movl %ecx,%eax 296 + 9: movl %ecx,%eax 321 297 ret 322 - 3: lea (%rdx,%rcx,8),%rax 298 + 299 + /* multiple of 8 byte */ 300 + 10: rep 301 + movsq 302 + xor %eax,%eax 323 303 ret 304 + 305 + /* exception handling */ 306 + 3: lea (%rdx,%rcx,8),%rax /* exception on quad loop */ 307 + jmp 6f 308 + 5: movl %ecx,%eax /* exception on byte loop */ 309 + /* eax: left over bytes */ 310 + 6: testl %r8d,%r8d /* zero flag set? */ 311 + jz 7f 312 + movl %eax,%ecx /* initialize x86 loop counter */ 313 + push %rax 314 + xorl %eax,%eax 315 + 8: rep 316 + stosb /* zero the rest */ 317 + 11: pop %rax 318 + 7: ret 319 + CFI_ENDPROC 320 + END(copy_user_generic_c) 324 321 325 322 .section __ex_table,"a" 326 323 .quad 1b,3b 327 - .quad 2b,4b 324 + .quad 2b,5b 325 + .quad 8b,11b 326 + .quad 10b,3b 328 327 .previous
+21 -5
arch/x86_64/lib/csum-copy.S
··· 5 5 * License. See the file COPYING in the main directory of this archive 6 6 * for more details. No warranty for anything given at all. 7 7 */ 8 - #include <linux/linkage.h> 9 - #include <asm/errno.h> 8 + #include <linux/linkage.h> 9 + #include <asm/dwarf2.h> 10 + #include <asm/errno.h> 10 11 11 12 /* 12 13 * Checksum copy with exception handling. ··· 54 53 .endm 55 54 56 55 57 - .globl csum_partial_copy_generic 58 - .p2align 4 59 - csum_partial_copy_generic: 56 + ENTRY(csum_partial_copy_generic) 57 + CFI_STARTPROC 60 58 cmpl $3*64,%edx 61 59 jle .Lignore 62 60 63 61 .Lignore: 64 62 subq $7*8,%rsp 63 + CFI_ADJUST_CFA_OFFSET 7*8 65 64 movq %rbx,2*8(%rsp) 65 + CFI_REL_OFFSET rbx, 2*8 66 66 movq %r12,3*8(%rsp) 67 + CFI_REL_OFFSET r12, 3*8 67 68 movq %r14,4*8(%rsp) 69 + CFI_REL_OFFSET r14, 4*8 68 70 movq %r13,5*8(%rsp) 71 + CFI_REL_OFFSET r13, 5*8 69 72 movq %rbp,6*8(%rsp) 73 + CFI_REL_OFFSET rbp, 6*8 70 74 71 75 movq %r8,(%rsp) 72 76 movq %r9,1*8(%rsp) ··· 214 208 addl %ebx,%eax 215 209 adcl %r9d,%eax /* carry */ 216 210 211 + CFI_REMEMBER_STATE 217 212 .Lende: 218 213 movq 2*8(%rsp),%rbx 214 + CFI_RESTORE rbx 219 215 movq 3*8(%rsp),%r12 216 + CFI_RESTORE r12 220 217 movq 4*8(%rsp),%r14 218 + CFI_RESTORE r14 221 219 movq 5*8(%rsp),%r13 220 + CFI_RESTORE r13 222 221 movq 6*8(%rsp),%rbp 222 + CFI_RESTORE rbp 223 223 addq $7*8,%rsp 224 + CFI_ADJUST_CFA_OFFSET -7*8 224 225 ret 226 + CFI_RESTORE_STATE 225 227 226 228 /* Exception handlers. Very simple, zeroing is done in the wrappers */ 227 229 .Lbad_source: ··· 245 231 jz .Lende 246 232 movl $-EFAULT,(%rax) 247 233 jmp .Lende 234 + CFI_ENDPROC 235 + ENDPROC(csum_partial_copy_generic)
+20 -12
arch/x86_64/lib/getuser.S
··· 27 27 */ 28 28 29 29 #include <linux/linkage.h> 30 + #include <asm/dwarf2.h> 30 31 #include <asm/page.h> 31 32 #include <asm/errno.h> 32 33 #include <asm/asm-offsets.h> 33 34 #include <asm/thread_info.h> 34 35 35 36 .text 36 - .p2align 4 37 - .globl __get_user_1 38 - __get_user_1: 37 + ENTRY(__get_user_1) 38 + CFI_STARTPROC 39 39 GET_THREAD_INFO(%r8) 40 40 cmpq threadinfo_addr_limit(%r8),%rcx 41 41 jae bad_get_user 42 42 1: movzb (%rcx),%edx 43 43 xorl %eax,%eax 44 44 ret 45 + CFI_ENDPROC 46 + ENDPROC(__get_user_1) 45 47 46 - .p2align 4 47 - .globl __get_user_2 48 - __get_user_2: 48 + ENTRY(__get_user_2) 49 + CFI_STARTPROC 49 50 GET_THREAD_INFO(%r8) 50 51 addq $1,%rcx 51 52 jc 20f ··· 58 57 ret 59 58 20: decq %rcx 60 59 jmp bad_get_user 60 + CFI_ENDPROC 61 + ENDPROC(__get_user_2) 61 62 62 - .p2align 4 63 - .globl __get_user_4 64 - __get_user_4: 63 + ENTRY(__get_user_4) 64 + CFI_STARTPROC 65 65 GET_THREAD_INFO(%r8) 66 66 addq $3,%rcx 67 67 jc 30f ··· 74 72 ret 75 73 30: subq $3,%rcx 76 74 jmp bad_get_user 75 + CFI_ENDPROC 76 + ENDPROC(__get_user_4) 77 77 78 - .p2align 4 79 - .globl __get_user_8 80 - __get_user_8: 78 + ENTRY(__get_user_8) 79 + CFI_STARTPROC 81 80 GET_THREAD_INFO(%r8) 82 81 addq $7,%rcx 83 82 jc 40f ··· 90 87 ret 91 88 40: subq $7,%rcx 92 89 jmp bad_get_user 90 + CFI_ENDPROC 91 + ENDPROC(__get_user_8) 93 92 94 93 bad_get_user: 94 + CFI_STARTPROC 95 95 xorl %edx,%edx 96 96 movq $(-EFAULT),%rax 97 97 ret 98 + CFI_ENDPROC 99 + END(bad_get_user) 98 100 99 101 .section __ex_table,"a" 100 102 .quad 1b,bad_get_user
+7 -3
arch/x86_64/lib/iomap_copy.S
··· 15 15 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 16 16 */ 17 17 18 + #include <linux/linkage.h> 19 + #include <asm/dwarf2.h> 20 + 18 21 /* 19 22 * override generic version in lib/iomap_copy.c 20 23 */ 21 - .globl __iowrite32_copy 22 - .p2align 4 23 - __iowrite32_copy: 24 + ENTRY(__iowrite32_copy) 25 + CFI_STARTPROC 24 26 movl %edx,%ecx 25 27 rep movsd 26 28 ret 29 + CFI_ENDPROC 30 + ENDPROC(__iowrite32_copy)
+39 -30
arch/x86_64/lib/memcpy.S
··· 1 1 /* Copyright 2002 Andi Kleen */ 2 2 3 - #include <asm/cpufeature.h> 3 + #include <linux/config.h> 4 + #include <linux/linkage.h> 5 + #include <asm/dwarf2.h> 6 + #include <asm/cpufeature.h> 7 + 4 8 /* 5 9 * memcpy - Copy a memory block. 6 10 * ··· 17 13 * rax original destination 18 14 */ 19 15 20 - .globl __memcpy 21 - .globl memcpy 22 - .p2align 4 23 - __memcpy: 24 - memcpy: 16 + ALIGN 17 + memcpy_c: 18 + CFI_STARTPROC 19 + movq %rdi,%rax 20 + movl %edx,%ecx 21 + shrl $3,%ecx 22 + andl $7,%edx 23 + rep movsq 24 + movl %edx,%ecx 25 + rep movsb 26 + ret 27 + CFI_ENDPROC 28 + ENDPROC(memcpy_c) 29 + 30 + ENTRY(__memcpy) 31 + ENTRY(memcpy) 32 + CFI_STARTPROC 25 33 pushq %rbx 34 + CFI_ADJUST_CFA_OFFSET 8 35 + CFI_REL_OFFSET rbx, 0 26 36 movq %rdi,%rax 27 37 28 38 movl %edx,%ecx ··· 104 86 105 87 .Lende: 106 88 popq %rbx 89 + CFI_ADJUST_CFA_OFFSET -8 90 + CFI_RESTORE rbx 107 91 ret 108 92 .Lfinal: 93 + CFI_ENDPROC 94 + ENDPROC(memcpy) 95 + ENDPROC(__memcpy) 109 96 110 97 /* Some CPUs run faster using the string copy instructions. 111 98 It is also a lot simpler. Use this when possible */ 112 99 100 + .section .altinstr_replacement,"ax" 101 + 1: .byte 0xeb /* jmp <disp8> */ 102 + .byte (memcpy_c - memcpy) - (2f - 1b) /* offset */ 103 + 2: 104 + .previous 113 105 .section .altinstructions,"a" 114 106 .align 8 115 - .quad memcpy 116 - .quad memcpy_c 117 - .byte X86_FEATURE_REP_GOOD 118 - .byte .Lfinal-memcpy 119 - .byte memcpy_c_end-memcpy_c 120 - .previous 121 - 122 - .section .altinstr_replacement,"ax" 123 - /* rdi destination 124 - * rsi source 125 - * rdx count 126 - */ 127 - memcpy_c: 128 - movq %rdi,%rax 129 - movl %edx,%ecx 130 - shrl $3,%ecx 131 - andl $7,%edx 132 - rep 133 - movsq 134 - movl %edx,%ecx 135 - rep 136 - movsb 137 - ret 138 - memcpy_c_end: 107 + .quad memcpy 108 + .quad 1b 109 + .byte X86_FEATURE_REP_GOOD 110 + .byte .Lfinal - memcpy 111 + .byte 2b - 1b 139 112 .previous
+44 -35
arch/x86_64/lib/memset.S
··· 1 1 /* Copyright 2002 Andi Kleen, SuSE Labs */ 2 + 3 + #include <linux/config.h> 4 + #include <linux/linkage.h> 5 + #include <asm/dwarf2.h> 6 + 2 7 /* 3 8 * ISO C memset - set a memory block to a byte value. 4 9 * ··· 13 8 * 14 9 * rax original destination 15 10 */ 16 - .globl __memset 17 - .globl memset 18 - .p2align 4 19 - memset: 20 - __memset: 11 + ALIGN 12 + memset_c: 13 + CFI_STARTPROC 14 + movq %rdi,%r9 15 + movl %edx,%r8d 16 + andl $7,%r8d 17 + movl %edx,%ecx 18 + shrl $3,%ecx 19 + /* expand byte value */ 20 + movzbl %sil,%esi 21 + movabs $0x0101010101010101,%rax 22 + mulq %rsi /* with rax, clobbers rdx */ 23 + rep stosq 24 + movl %r8d,%ecx 25 + rep stosb 26 + movq %r9,%rax 27 + ret 28 + CFI_ENDPROC 29 + ENDPROC(memset_c) 30 + 31 + ENTRY(memset) 32 + ENTRY(__memset) 33 + CFI_STARTPROC 21 34 movq %rdi,%r10 22 35 movq %rdx,%r11 23 36 ··· 48 25 movl %edi,%r9d 49 26 andl $7,%r9d 50 27 jnz .Lbad_alignment 28 + CFI_REMEMBER_STATE 51 29 .Lafter_bad_alignment: 52 30 53 31 movl %r11d,%ecx ··· 99 75 movq %r10,%rax 100 76 ret 101 77 78 + CFI_RESTORE_STATE 102 79 .Lbad_alignment: 103 80 cmpq $7,%r11 104 81 jbe .Lhandle_7 ··· 109 84 addq %r8,%rdi 110 85 subq %r8,%r11 111 86 jmp .Lafter_bad_alignment 87 + .Lfinal: 88 + CFI_ENDPROC 89 + ENDPROC(memset) 90 + ENDPROC(__memset) 112 91 113 92 /* Some CPUs run faster using the string instructions. 114 93 It is also a lot simpler. Use this when possible */ 115 94 116 95 #include <asm/cpufeature.h> 117 96 97 + .section .altinstr_replacement,"ax" 98 + 1: .byte 0xeb /* jmp <disp8> */ 99 + .byte (memset_c - memset) - (2f - 1b) /* offset */ 100 + 2: 101 + .previous 118 102 .section .altinstructions,"a" 119 103 .align 8 120 - .quad memset 121 - .quad memset_c 122 - .byte X86_FEATURE_REP_GOOD 123 - .byte memset_c_end-memset_c 124 - .byte memset_c_end-memset_c 125 - .previous 126 - 127 - .section .altinstr_replacement,"ax" 128 - /* rdi destination 129 - * rsi value 130 - * rdx count 131 - */ 132 - memset_c: 133 - movq %rdi,%r9 134 - movl %edx,%r8d 135 - andl $7,%r8d 136 - movl %edx,%ecx 137 - shrl $3,%ecx 138 - /* expand byte value */ 139 - movzbl %sil,%esi 140 - movabs $0x0101010101010101,%rax 141 - mulq %rsi /* with rax, clobbers rdx */ 142 - rep 143 - stosq 144 - movl %r8d,%ecx 145 - rep 146 - stosb 147 - movq %r9,%rax 148 - ret 149 - memset_c_end: 104 + .quad memset 105 + .quad 1b 106 + .byte X86_FEATURE_REP_GOOD 107 + .byte .Lfinal - memset 108 + .byte 2b - 1b 150 109 .previous
+20 -12
arch/x86_64/lib/putuser.S
··· 25 25 */ 26 26 27 27 #include <linux/linkage.h> 28 + #include <asm/dwarf2.h> 28 29 #include <asm/page.h> 29 30 #include <asm/errno.h> 30 31 #include <asm/asm-offsets.h> 31 32 #include <asm/thread_info.h> 32 33 33 34 .text 34 - .p2align 4 35 - .globl __put_user_1 36 - __put_user_1: 35 + ENTRY(__put_user_1) 36 + CFI_STARTPROC 37 37 GET_THREAD_INFO(%r8) 38 38 cmpq threadinfo_addr_limit(%r8),%rcx 39 39 jae bad_put_user 40 40 1: movb %dl,(%rcx) 41 41 xorl %eax,%eax 42 42 ret 43 + CFI_ENDPROC 44 + ENDPROC(__put_user_1) 43 45 44 - .p2align 4 45 - .globl __put_user_2 46 - __put_user_2: 46 + ENTRY(__put_user_2) 47 + CFI_STARTPROC 47 48 GET_THREAD_INFO(%r8) 48 49 addq $1,%rcx 49 50 jc 20f ··· 56 55 ret 57 56 20: decq %rcx 58 57 jmp bad_put_user 58 + CFI_ENDPROC 59 + ENDPROC(__put_user_2) 59 60 60 - .p2align 4 61 - .globl __put_user_4 62 - __put_user_4: 61 + ENTRY(__put_user_4) 62 + CFI_STARTPROC 63 63 GET_THREAD_INFO(%r8) 64 64 addq $3,%rcx 65 65 jc 30f ··· 72 70 ret 73 71 30: subq $3,%rcx 74 72 jmp bad_put_user 73 + CFI_ENDPROC 74 + ENDPROC(__put_user_4) 75 75 76 - .p2align 4 77 - .globl __put_user_8 78 - __put_user_8: 76 + ENTRY(__put_user_8) 77 + CFI_STARTPROC 79 78 GET_THREAD_INFO(%r8) 80 79 addq $7,%rcx 81 80 jc 40f ··· 88 85 ret 89 86 40: subq $7,%rcx 90 87 jmp bad_put_user 88 + CFI_ENDPROC 89 + ENDPROC(__put_user_8) 91 90 92 91 bad_put_user: 92 + CFI_STARTPROC 93 93 movq $(-EFAULT),%rax 94 94 ret 95 + CFI_ENDPROC 96 + END(bad_put_user) 95 97 96 98 .section __ex_table,"a" 97 99 .quad 1b,bad_put_user
+38
arch/x86_64/lib/rwlock.S
··· 1 + /* Slow paths of read/write spinlocks. */ 2 + 3 + #include <linux/linkage.h> 4 + #include <asm/rwlock.h> 5 + #include <asm/alternative-asm.i> 6 + #include <asm/dwarf2.h> 7 + 8 + /* rdi: pointer to rwlock_t */ 9 + ENTRY(__write_lock_failed) 10 + CFI_STARTPROC 11 + LOCK_PREFIX 12 + addl $RW_LOCK_BIAS,(%rdi) 13 + 1: rep 14 + nop 15 + cmpl $RW_LOCK_BIAS,(%rdi) 16 + jne 1b 17 + LOCK_PREFIX 18 + subl $RW_LOCK_BIAS,(%rdi) 19 + jnz __write_lock_failed 20 + ret 21 + CFI_ENDPROC 22 + END(__write_lock_failed) 23 + 24 + /* rdi: pointer to rwlock_t */ 25 + ENTRY(__read_lock_failed) 26 + CFI_STARTPROC 27 + LOCK_PREFIX 28 + incl (%rdi) 29 + 1: rep 30 + nop 31 + cmpl $1,(%rdi) 32 + js 1b 33 + LOCK_PREFIX 34 + decl (%rdi) 35 + js __read_lock_failed 36 + ret 37 + CFI_ENDPROC 38 + END(__read_lock_failed)
+6 -37
arch/x86_64/lib/thunk.S
··· 1 - /* 2 - * Save registers before calling assembly functions. This avoids 3 - * disturbance of register allocation in some inline assembly constructs. 4 - * Copyright 2001,2002 by Andi Kleen, SuSE Labs. 5 - * Subject to the GNU public license, v.2. No warranty of any kind. 6 - * $Id: thunk.S,v 1.2 2002/03/13 20:06:58 ak Exp $ 7 - */ 1 + /* 2 + * Save registers before calling assembly functions. This avoids 3 + * disturbance of register allocation in some inline assembly constructs. 4 + * Copyright 2001,2002 by Andi Kleen, SuSE Labs. 5 + * Subject to the GNU public license, v.2. No warranty of any kind. 6 + */ 8 7 9 8 #include <linux/config.h> 10 9 #include <linux/linkage.h> ··· 66 67 RESTORE_ARGS 1 67 68 ret 68 69 CFI_ENDPROC 69 - 70 - #ifdef CONFIG_SMP 71 - /* Support for read/write spinlocks. */ 72 - .text 73 - /* rax: pointer to rwlock_t */ 74 - ENTRY(__write_lock_failed) 75 - lock 76 - addl $RW_LOCK_BIAS,(%rax) 77 - 1: rep 78 - nop 79 - cmpl $RW_LOCK_BIAS,(%rax) 80 - jne 1b 81 - lock 82 - subl $RW_LOCK_BIAS,(%rax) 83 - jnz __write_lock_failed 84 - ret 85 - 86 - /* rax: pointer to rwlock_t */ 87 - ENTRY(__read_lock_failed) 88 - lock 89 - incl (%rax) 90 - 1: rep 91 - nop 92 - cmpl $1,(%rax) 93 - js 1b 94 - lock 95 - decl (%rax) 96 - js __read_lock_failed 97 - ret 98 - #endif
+8 -14
arch/x86_64/mm/fault.c
··· 40 40 #define PF_RSVD (1<<3) 41 41 #define PF_INSTR (1<<4) 42 42 43 - #ifdef CONFIG_KPROBES 44 - ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); 43 + static ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain); 45 44 46 45 /* Hook to register for page fault notifications */ 47 46 int register_page_fault_notifier(struct notifier_block *nb) ··· 48 49 vmalloc_sync_all(); 49 50 return atomic_notifier_chain_register(&notify_page_fault_chain, nb); 50 51 } 52 + EXPORT_SYMBOL_GPL(register_page_fault_notifier); 51 53 52 54 int unregister_page_fault_notifier(struct notifier_block *nb) 53 55 { 54 56 return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb); 55 57 } 58 + EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); 56 59 57 60 static inline int notify_page_fault(enum die_val val, const char *str, 58 61 struct pt_regs *regs, long err, int trap, int sig) ··· 68 67 }; 69 68 return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args); 70 69 } 71 - #else 72 - static inline int notify_page_fault(enum die_val val, const char *str, 73 - struct pt_regs *regs, long err, int trap, int sig) 74 - { 75 - return NOTIFY_DONE; 76 - } 77 - #endif 78 70 79 71 void bust_spinlocks(int yes) 80 72 { ··· 96 102 static noinline int is_prefetch(struct pt_regs *regs, unsigned long addr, 97 103 unsigned long error_code) 98 104 { 99 - unsigned char *instr; 105 + unsigned char __user *instr; 100 106 int scan_more = 1; 101 107 int prefetch = 0; 102 108 unsigned char *max_instr; ··· 105 111 if (error_code & PF_INSTR) 106 112 return 0; 107 113 108 - instr = (unsigned char *)convert_rip_to_linear(current, regs); 114 + instr = (unsigned char __user *)convert_rip_to_linear(current, regs); 109 115 max_instr = instr + 15; 110 116 111 117 if (user_mode(regs) && instr >= (unsigned char *)TASK_SIZE) ··· 116 122 unsigned char instr_hi; 117 123 unsigned char instr_lo; 118 124 119 - if (__get_user(opcode, instr)) 125 + if (__get_user(opcode, (char __user *)instr)) 120 126 break; 121 127 122 128 instr_hi = opcode & 0xf0; ··· 154 160 case 0x00: 155 161 /* Prefetch instruction is 0x0F0D or 0x0F18 */ 156 162 scan_more = 0; 157 - if (__get_user(opcode, instr)) 163 + if (__get_user(opcode, (char __user *)instr)) 158 164 break; 159 165 prefetch = (instr_lo == 0xF) && 160 166 (opcode == 0x0D || opcode == 0x18); ··· 170 176 static int bad_address(void *p) 171 177 { 172 178 unsigned long dummy; 173 - return __get_user(dummy, (unsigned long *)p); 179 + return __get_user(dummy, (unsigned long __user *)p); 174 180 } 175 181 176 182 void dump_pagetable(unsigned long address)
+26 -32
arch/x86_64/mm/init.c
··· 229 229 230 230 /* actually usually some more */ 231 231 if (size >= LARGE_PAGE_SIZE) { 232 - printk("SMBIOS area too long %lu\n", size); 233 232 return NULL; 234 233 } 235 234 set_pmd(temp_mappings[0].pmd, __pmd(map | _KERNPG_TABLE | _PAGE_PSE)); ··· 249 250 } 250 251 251 252 static void __meminit 252 - phys_pmd_init(pmd_t *pmd, unsigned long address, unsigned long end) 253 + phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end) 253 254 { 254 - int i; 255 + int i = pmd_index(address); 255 256 256 - for (i = 0; i < PTRS_PER_PMD; pmd++, i++, address += PMD_SIZE) { 257 + for (; i < PTRS_PER_PMD; i++, address += PMD_SIZE) { 257 258 unsigned long entry; 259 + pmd_t *pmd = pmd_page + pmd_index(address); 258 260 259 261 if (address >= end) { 260 262 if (!after_bootmem) ··· 263 263 set_pmd(pmd, __pmd(0)); 264 264 break; 265 265 } 266 + 267 + if (pmd_val(*pmd)) 268 + continue; 269 + 266 270 entry = _PAGE_NX|_PAGE_PSE|_KERNPG_TABLE|_PAGE_GLOBAL|address; 267 271 entry &= __supported_pte_mask; 268 272 set_pmd(pmd, __pmd(entry)); ··· 276 272 static void __meminit 277 273 phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end) 278 274 { 279 - pmd_t *pmd = pmd_offset(pud, (unsigned long)__va(address)); 280 - 281 - if (pmd_none(*pmd)) { 282 - spin_lock(&init_mm.page_table_lock); 283 - phys_pmd_init(pmd, address, end); 284 - spin_unlock(&init_mm.page_table_lock); 285 - __flush_tlb_all(); 286 - } 275 + pmd_t *pmd = pmd_offset(pud,0); 276 + spin_lock(&init_mm.page_table_lock); 277 + phys_pmd_init(pmd, address, end); 278 + spin_unlock(&init_mm.page_table_lock); 279 + __flush_tlb_all(); 287 280 } 288 281 289 - static void __meminit phys_pud_init(pud_t *pud, unsigned long address, unsigned long end) 282 + static void __meminit phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end) 290 283 { 291 - long i = pud_index(address); 284 + int i = pud_index(addr); 292 285 293 - pud = pud + i; 294 286 295 - if (after_bootmem && pud_val(*pud)) { 296 - phys_pmd_update(pud, address, end); 297 - return; 298 - } 299 - 300 - for (; i < PTRS_PER_PUD; pud++, i++) { 287 + for (; i < PTRS_PER_PUD; i++, addr = (addr & PUD_MASK) + PUD_SIZE ) { 301 288 int map; 302 - unsigned long paddr, pmd_phys; 289 + unsigned long pmd_phys; 290 + pud_t *pud = pud_page + pud_index(addr); 303 291 pmd_t *pmd; 304 292 305 - paddr = (address & PGDIR_MASK) + i*PUD_SIZE; 306 - if (paddr >= end) 293 + if (addr >= end) 307 294 break; 308 295 309 - if (!after_bootmem && !e820_any_mapped(paddr, paddr+PUD_SIZE, 0)) { 296 + if (!after_bootmem && !e820_any_mapped(addr,addr+PUD_SIZE,0)) { 310 297 set_pud(pud, __pud(0)); 311 298 continue; 312 299 } 313 300 301 + if (pud_val(*pud)) { 302 + phys_pmd_update(pud, addr, end); 303 + continue; 304 + } 305 + 314 306 pmd = alloc_low_page(&map, &pmd_phys); 315 307 spin_lock(&init_mm.page_table_lock); 316 308 set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE)); 317 - phys_pmd_init(pmd, paddr, end); 309 + phys_pmd_init(pmd, addr, end); 318 310 spin_unlock(&init_mm.page_table_lock); 319 311 unmap_low_page(map); 320 312 } ··· 596 596 long codesize, reservedpages, datasize, initsize; 597 597 598 598 pci_iommu_alloc(); 599 - 600 - /* How many end-of-memory variables you have, grandma! */ 601 - max_low_pfn = end_pfn; 602 - max_pfn = end_pfn; 603 - num_physpages = end_pfn; 604 - high_memory = (void *) __va(end_pfn * PAGE_SIZE); 605 599 606 600 /* clear the zero-page */ 607 601 memset(empty_zero_page, 0, PAGE_SIZE);
+3
arch/x86_64/mm/k8topology.c
··· 54 54 55 55 nodes_clear(nodes_parsed); 56 56 57 + if (!early_pci_allowed()) 58 + return -1; 59 + 57 60 nb = find_northbridge(); 58 61 if (nb < 0) 59 62 return nb;
+7 -4
arch/x86_64/mm/numa.c
··· 225 225 int numa_fake __initdata = 0; 226 226 227 227 /* Numa emulation */ 228 - static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn) 228 + static int __init numa_emulation(unsigned long start_pfn, unsigned long end_pfn) 229 229 { 230 230 int i; 231 231 struct bootnode nodes[MAX_NUMNODES]; ··· 348 348 } 349 349 } 350 350 351 - /* [numa=off] */ 352 - __init int numa_setup(char *opt) 351 + static __init int numa_setup(char *opt) 353 352 { 353 + if (!opt) 354 + return -EINVAL; 354 355 if (!strncmp(opt,"off",3)) 355 356 numa_off = 1; 356 357 #ifdef CONFIG_NUMA_EMU ··· 367 366 if (!strncmp(opt,"hotadd=", 7)) 368 367 hotadd_percent = simple_strtoul(opt+7, NULL, 10); 369 368 #endif 370 - return 1; 369 + return 0; 371 370 } 371 + 372 + early_param("numa", numa_setup); 372 373 373 374 /* 374 375 * Setup early cpu_to_node.
+11 -13
arch/x86_64/mm/pageattr.c
··· 108 108 BUG_ON(pud_none(*pud)); 109 109 pmd = pmd_offset(pud, address); 110 110 BUG_ON(pmd_val(*pmd) & _PAGE_PSE); 111 - pgprot_val(ref_prot) |= _PAGE_PSE; 112 111 large_pte = mk_pte_phys(__pa(address) & LARGE_PAGE_MASK, ref_prot); 112 + large_pte = pte_mkhuge(large_pte); 113 113 set_pte((pte_t *)pmd, large_pte); 114 114 } 115 115 ··· 119 119 { 120 120 pte_t *kpte; 121 121 struct page *kpte_page; 122 - unsigned kpte_flags; 123 122 pgprot_t ref_prot2; 124 123 kpte = lookup_address(address); 125 124 if (!kpte) return 0; 126 125 kpte_page = virt_to_page(((unsigned long)kpte) & PAGE_MASK); 127 - kpte_flags = pte_val(*kpte); 128 126 if (pgprot_val(prot) != pgprot_val(ref_prot)) { 129 - if ((kpte_flags & _PAGE_PSE) == 0) { 127 + if (!pte_huge(*kpte)) { 130 128 set_pte(kpte, pfn_pte(pfn, prot)); 131 129 } else { 132 130 /* 133 131 * split_large_page will take the reference for this 134 132 * change_page_attr on the split page. 135 133 */ 136 - 137 134 struct page *split; 138 - ref_prot2 = __pgprot(pgprot_val(pte_pgprot(*lookup_address(address))) & ~(1<<_PAGE_BIT_PSE)); 139 - 135 + ref_prot2 = pte_pgprot(pte_clrhuge(*kpte)); 140 136 split = split_large_page(address, prot, ref_prot2); 141 137 if (!split) 142 138 return -ENOMEM; 143 - set_pte(kpte,mk_pte(split, ref_prot2)); 139 + set_pte(kpte, mk_pte(split, ref_prot2)); 144 140 kpte_page = split; 145 - } 141 + } 146 142 page_private(kpte_page)++; 147 - } else if ((kpte_flags & _PAGE_PSE) == 0) { 143 + } else if (!pte_huge(*kpte)) { 148 144 set_pte(kpte, pfn_pte(pfn, ref_prot)); 149 145 BUG_ON(page_private(kpte_page) == 0); 150 146 page_private(kpte_page)--; ··· 186 190 * lowmem */ 187 191 if (__pa(address) < KERNEL_TEXT_SIZE) { 188 192 unsigned long addr2; 189 - pgprot_t prot2 = prot; 193 + pgprot_t prot2; 190 194 addr2 = __START_KERNEL_map + __pa(address); 191 - pgprot_val(prot2) &= ~_PAGE_NX; 192 - err = __change_page_attr(addr2, pfn, prot2, PAGE_KERNEL_EXEC); 195 + /* Make sure the kernel mappings stay executable */ 196 + prot2 = pte_pgprot(pte_mkexec(pfn_pte(0, prot))); 197 + err = __change_page_attr(addr2, pfn, prot2, 198 + PAGE_KERNEL_EXEC); 193 199 } 194 200 } 195 201 up_write(&init_mm.mmap_sem);
+2
arch/x86_64/mm/srat.c
··· 21 21 #include <asm/numa.h> 22 22 #include <asm/e820.h> 23 23 24 + int acpi_numa __initdata; 25 + 24 26 #if (defined(CONFIG_ACPI_HOTPLUG_MEMORY) || \ 25 27 defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)) \ 26 28 && !defined(CONFIG_MEMORY_HOTPLUG)
+2 -1
arch/x86_64/pci/Makefile
··· 9 9 obj-$(CONFIG_PCI_DIRECT)+= direct.o 10 10 obj-y += fixup.o init.o 11 11 obj-$(CONFIG_ACPI) += acpi.o 12 - obj-y += legacy.o irq.o common.o 12 + obj-y += legacy.o irq.o common.o early.o 13 13 # mmconfig has a 64bit special 14 14 obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o direct.o 15 15 ··· 23 23 fixup-y += ../../i386/pci/fixup.o 24 24 i386-y += ../../i386/pci/i386.o 25 25 init-y += ../../i386/pci/init.o 26 + early-y += ../../i386/pci/early.o
+38 -6
arch/x86_64/pci/mmconfig.c
··· 156 156 addr = pci_dev_base(0, k, PCI_DEVFN(i, 0)); 157 157 if (addr == NULL|| readl(addr) != val1) { 158 158 set_bit(i + 32*k, fallback_slots); 159 - printk(KERN_NOTICE 160 - "PCI: No mmconfig possible on device %x:%x\n", 161 - k, i); 159 + printk(KERN_NOTICE "PCI: No mmconfig possible" 160 + " on device %02x:%02x\n", k, i); 162 161 } 163 162 } 164 163 } 165 164 } 166 165 167 - void __init pci_mmcfg_init(void) 166 + static __init void pci_mmcfg_insert_resources(void) 167 + { 168 + #define PCI_MMCFG_RESOURCE_NAME_LEN 19 169 + int i; 170 + struct resource *res; 171 + char *names; 172 + unsigned num_buses; 173 + 174 + res = kcalloc(PCI_MMCFG_RESOURCE_NAME_LEN + sizeof(*res), 175 + pci_mmcfg_config_num, GFP_KERNEL); 176 + 177 + if (!res) { 178 + printk(KERN_ERR "PCI: Unable to allocate MMCONFIG resources\n"); 179 + return; 180 + } 181 + 182 + names = (void *)&res[pci_mmcfg_config_num]; 183 + for (i = 0; i < pci_mmcfg_config_num; i++, res++) { 184 + num_buses = pci_mmcfg_config[i].end_bus_number - 185 + pci_mmcfg_config[i].start_bus_number + 1; 186 + res->name = names; 187 + snprintf(names, PCI_MMCFG_RESOURCE_NAME_LEN, "PCI MMCONFIG %u", 188 + pci_mmcfg_config[i].pci_segment_group_number); 189 + res->start = pci_mmcfg_config[i].base_address; 190 + res->end = res->start + (num_buses << 20) - 1; 191 + res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; 192 + insert_resource(&iomem_resource, res); 193 + names += PCI_MMCFG_RESOURCE_NAME_LEN; 194 + } 195 + } 196 + 197 + void __init pci_mmcfg_init(int type) 168 198 { 169 199 int i; 170 200 ··· 207 177 (pci_mmcfg_config[0].base_address == 0)) 208 178 return; 209 179 210 - if (!e820_all_mapped(pci_mmcfg_config[0].base_address, 180 + /* Only do this check when type 1 works. If it doesn't work 181 + assume we run on a Mac and always use MCFG */ 182 + if (type == 1 && !e820_all_mapped(pci_mmcfg_config[0].base_address, 211 183 pci_mmcfg_config[0].base_address + MMCONFIG_APER_MIN, 212 184 E820_RESERVED)) { 213 185 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %x is not E820-reserved\n", ··· 218 186 return; 219 187 } 220 188 221 - /* RED-PEN i386 doesn't do _nocache right now */ 222 189 pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL); 223 190 if (pci_mmcfg_virt == NULL) { 224 191 printk("PCI: Can not allocate memory for mmconfig structures\n"); ··· 236 205 } 237 206 238 207 unreachable_devices(); 208 + pci_mmcfg_insert_resources(); 239 209 240 210 raw_pci_ops = &pci_mmcfg; 241 211 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF;
+2 -2
drivers/char/hpet.c
··· 868 868 do_div(temp, period); 869 869 hpetp->hp_tick_freq = temp; /* ticks per second */ 870 870 871 - printk(KERN_INFO "hpet%d: at MMIO 0x%lx (virtual 0x%p), IRQ%s", 872 - hpetp->hp_which, hdp->hd_phys_address, hdp->hd_address, 871 + printk(KERN_INFO "hpet%d: at MMIO 0x%lx, IRQ%s", 872 + hpetp->hp_which, hdp->hd_phys_address, 873 873 hpetp->hp_ntimer > 1 ? "s" : ""); 874 874 for (i = 0; i < hpetp->hp_ntimer; i++) 875 875 printk("%s %d", i > 0 ? "," : "", hdp->hd_irq[i]);
+2 -3
drivers/pci/pci.c
··· 955 955 } 956 956 str = k; 957 957 } 958 - return 1; 958 + return 0; 959 959 } 960 + early_param("pci", pci_setup); 960 961 961 962 device_initcall(pci_init); 962 - 963 - __setup("pci=", pci_setup); 964 963 965 964 #if defined(CONFIG_ISA) || defined(CONFIG_EISA) 966 965 /* FIXME: Some boxes have multiple ISA bridges! */
+2 -1
fs/binfmt_elf.c
··· 515 515 { 516 516 unsigned int random_variable = 0; 517 517 518 - if (current->flags & PF_RANDOMIZE) { 518 + if ((current->flags & PF_RANDOMIZE) && 519 + !(current->personality & ADDR_NO_RANDOMIZE)) { 519 520 random_variable = get_random_int() & STACK_RND_MASK; 520 521 random_variable <<= PAGE_SHIFT; 521 522 }
+3 -2
fs/compat.c
··· 1855 1855 1856 1856 } while (!ret && !timeout && tsp && (ts.tv_sec || ts.tv_nsec)); 1857 1857 1858 - if (tsp && !(current->personality & STICKY_TIMEOUTS)) { 1858 + if (ret == 0 && tsp && !(current->personality & STICKY_TIMEOUTS)) { 1859 1859 struct compat_timespec rts; 1860 1860 1861 1861 rts.tv_sec = timeout / HZ; ··· 1866 1866 } 1867 1867 if (compat_timespec_compare(&rts, &ts) >= 0) 1868 1868 rts = ts; 1869 - copy_to_user(tsp, &rts, sizeof(rts)); 1869 + if (copy_to_user(tsp, &rts, sizeof(rts))) 1870 + ret = -EFAULT; 1870 1871 } 1871 1872 1872 1873 if (ret == -ERESTARTNOHAND) {
-14
include/asm-i386/acpi.h
··· 131 131 extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq); 132 132 133 133 #ifdef CONFIG_X86_IO_APIC 134 - extern int skip_ioapic_setup; 135 134 extern int acpi_skip_timer_override; 136 - 137 - static inline void disable_ioapic_setup(void) 138 - { 139 - skip_ioapic_setup = 1; 140 - } 141 - 142 - static inline int ioapic_setup_disabled(void) 143 - { 144 - return skip_ioapic_setup; 145 - } 146 - 147 - #else 148 - static inline void disable_ioapic_setup(void) { } 149 135 #endif 150 136 151 137 static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
+14
include/asm-i386/alternative-asm.i
··· 1 + #include <linux/config.h> 2 + 3 + #ifdef CONFIG_SMP 4 + .macro LOCK_PREFIX 5 + 1: lock 6 + .section .smp_locks,"a" 7 + .align 4 8 + .long 1b 9 + .previous 10 + .endm 11 + #else 12 + .macro LOCK_PREFIX 13 + .endm 14 + #endif
+2 -14
include/asm-i386/apic.h
··· 16 16 #define APIC_VERBOSE 1 17 17 #define APIC_DEBUG 2 18 18 19 - extern int enable_local_apic; 20 19 extern int apic_verbosity; 21 - 22 - static inline void lapic_disable(void) 23 - { 24 - enable_local_apic = -1; 25 - clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability); 26 - } 27 - 28 - static inline void lapic_enable(void) 29 - { 30 - enable_local_apic = 1; 31 - } 32 20 33 21 /* 34 22 * Define the default level of output to be very little ··· 29 41 printk(s, ##a); \ 30 42 } while (0) 31 43 44 + 45 + extern void generic_apic_probe(void); 32 46 33 47 #ifdef CONFIG_X86_LOCAL_APIC 34 48 ··· 106 116 extern void enable_APIC_timer(void); 107 117 108 118 extern void enable_NMI_through_LVT0 (void * dummy); 109 - 110 - extern int disable_timer_pin_1; 111 119 112 120 void smp_send_timer_broadcast_ipi(struct pt_regs *regs); 113 121 void switch_APIC_timer_to_ipi(void *cpumask);
+81 -50
include/asm-i386/desc.h
··· 33 33 return (struct desc_struct *)per_cpu(cpu_gdt_descr, cpu).address; 34 34 } 35 35 36 - #define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) 37 - #define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8)) 38 - 39 - #define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr)) 40 - #define load_idt(dtr) __asm__ __volatile("lidt %0"::"m" (*dtr)) 41 - #define load_tr(tr) __asm__ __volatile("ltr %0"::"mr" (tr)) 42 - #define load_ldt(ldt) __asm__ __volatile("lldt %0"::"mr" (ldt)) 43 - 44 - #define store_gdt(dtr) __asm__ ("sgdt %0":"=m" (*dtr)) 45 - #define store_idt(dtr) __asm__ ("sidt %0":"=m" (*dtr)) 46 - #define store_tr(tr) __asm__ ("str %0":"=mr" (tr)) 47 - #define store_ldt(ldt) __asm__ ("sldt %0":"=mr" (ldt)) 48 - 49 36 /* 50 37 * This is the ldt that every process will get unless we need 51 38 * something other than this. 52 39 */ 53 40 extern struct desc_struct default_ldt[]; 41 + extern struct desc_struct idt_table[]; 54 42 extern void set_intr_gate(unsigned int irq, void * addr); 55 43 56 - #define _set_tssldt_desc(n,addr,limit,type) \ 57 - __asm__ __volatile__ ("movw %w3,0(%2)\n\t" \ 58 - "movw %w1,2(%2)\n\t" \ 59 - "rorl $16,%1\n\t" \ 60 - "movb %b1,4(%2)\n\t" \ 61 - "movb %4,5(%2)\n\t" \ 62 - "movb $0,6(%2)\n\t" \ 63 - "movb %h1,7(%2)\n\t" \ 64 - "rorl $16,%1" \ 65 - : "=m"(*(n)) : "q" (addr), "r"(n), "ir"(limit), "i"(type)) 66 - 67 - static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void *addr) 44 + static inline void pack_descriptor(__u32 *a, __u32 *b, 45 + unsigned long base, unsigned long limit, unsigned char type, unsigned char flags) 68 46 { 69 - _set_tssldt_desc(&get_cpu_gdt_table(cpu)[entry], (int)addr, 70 - offsetof(struct tss_struct, __cacheline_filler) - 1, 0x89); 47 + *a = ((base & 0xffff) << 16) | (limit & 0xffff); 48 + *b = (base & 0xff000000) | ((base & 0xff0000) >> 16) | 49 + (limit & 0x000f0000) | ((type & 0xff) << 8) | ((flags & 0xf) << 20); 50 + } 51 + 52 + static inline void pack_gate(__u32 *a, __u32 *b, 53 + unsigned long base, unsigned short seg, unsigned char type, unsigned char flags) 54 + { 55 + *a = (seg << 16) | (base & 0xffff); 56 + *b = (base & 0xffff0000) | ((type & 0xff) << 8) | (flags & 0xff); 57 + } 58 + 59 + #define DESCTYPE_LDT 0x82 /* present, system, DPL-0, LDT */ 60 + #define DESCTYPE_TSS 0x89 /* present, system, DPL-0, 32-bit TSS */ 61 + #define DESCTYPE_TASK 0x85 /* present, system, DPL-0, task gate */ 62 + #define DESCTYPE_INT 0x8e /* present, system, DPL-0, interrupt gate */ 63 + #define DESCTYPE_TRAP 0x8f /* present, system, DPL-0, trap gate */ 64 + #define DESCTYPE_DPL3 0x60 /* DPL-3 */ 65 + #define DESCTYPE_S 0x10 /* !system */ 66 + 67 + #define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8)) 68 + #define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8)) 69 + 70 + #define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr)) 71 + #define load_idt(dtr) __asm__ __volatile("lidt %0"::"m" (*dtr)) 72 + #define load_tr(tr) __asm__ __volatile("ltr %0"::"m" (tr)) 73 + #define load_ldt(ldt) __asm__ __volatile("lldt %0"::"m" (ldt)) 74 + 75 + #define store_gdt(dtr) __asm__ ("sgdt %0":"=m" (*dtr)) 76 + #define store_idt(dtr) __asm__ ("sidt %0":"=m" (*dtr)) 77 + #define store_tr(tr) __asm__ ("str %0":"=m" (tr)) 78 + #define store_ldt(ldt) __asm__ ("sldt %0":"=m" (ldt)) 79 + 80 + #if TLS_SIZE != 24 81 + # error update this code. 82 + #endif 83 + 84 + static inline void load_TLS(struct thread_struct *t, unsigned int cpu) 85 + { 86 + #define C(i) get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i] 87 + C(0); C(1); C(2); 88 + #undef C 89 + } 90 + 91 + static inline void write_dt_entry(void *dt, int entry, __u32 entry_a, __u32 entry_b) 92 + { 93 + __u32 *lp = (__u32 *)((char *)dt + entry*8); 94 + *lp = entry_a; 95 + *(lp+1) = entry_b; 96 + } 97 + 98 + #define write_ldt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) 99 + #define write_gdt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) 100 + #define write_idt_entry(dt, entry, a, b) write_dt_entry(dt, entry, a, b) 101 + 102 + static inline void _set_gate(int gate, unsigned int type, void *addr, unsigned short seg) 103 + { 104 + __u32 a, b; 105 + pack_gate(&a, &b, (unsigned long)addr, seg, type, 0); 106 + write_idt_entry(idt_table, gate, a, b); 107 + } 108 + 109 + static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, const void *addr) 110 + { 111 + __u32 a, b; 112 + pack_descriptor(&a, &b, (unsigned long)addr, 113 + offsetof(struct tss_struct, __cacheline_filler) - 1, 114 + DESCTYPE_TSS, 0); 115 + write_gdt_entry(get_cpu_gdt_table(cpu), entry, a, b); 116 + } 117 + 118 + static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int entries) 119 + { 120 + __u32 a, b; 121 + pack_descriptor(&a, &b, (unsigned long)addr, 122 + entries * sizeof(struct desc_struct) - 1, 123 + DESCTYPE_LDT, 0); 124 + write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT, a, b); 71 125 } 72 126 73 127 #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr) 74 - 75 - static inline void set_ldt_desc(unsigned int cpu, void *addr, unsigned int size) 76 - { 77 - _set_tssldt_desc(&get_cpu_gdt_table(cpu)[GDT_ENTRY_LDT], (int)addr, ((size << 3)-1), 0x82); 78 - } 79 128 80 129 #define LDT_entry_a(info) \ 81 130 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) ··· 150 101 (info)->limit_in_pages == 0 && \ 151 102 (info)->seg_not_present == 1 && \ 152 103 (info)->useable == 0 ) 153 - 154 - static inline void write_ldt_entry(void *ldt, int entry, __u32 entry_a, __u32 entry_b) 155 - { 156 - __u32 *lp = (__u32 *)((char *)ldt + entry*8); 157 - *lp = entry_a; 158 - *(lp+1) = entry_b; 159 - } 160 - 161 - #if TLS_SIZE != 24 162 - # error update this code. 163 - #endif 164 - 165 - static inline void load_TLS(struct thread_struct *t, unsigned int cpu) 166 - { 167 - #define C(i) get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i] 168 - C(0); C(1); C(2); 169 - #undef C 170 - } 171 104 172 105 static inline void clear_LDT(void) 173 106 {
+9 -2
include/asm-i386/dwarf2.h
··· 1 1 #ifndef _DWARF2_H 2 2 #define _DWARF2_H 3 3 4 - #include <linux/config.h> 5 - 6 4 #ifndef __ASSEMBLY__ 7 5 #warning "asm/dwarf2.h should be only included in pure assembly files" 8 6 #endif ··· 26 28 #define CFI_RESTORE .cfi_restore 27 29 #define CFI_REMEMBER_STATE .cfi_remember_state 28 30 #define CFI_RESTORE_STATE .cfi_restore_state 31 + #define CFI_UNDEFINED .cfi_undefined 32 + 33 + #ifdef CONFIG_AS_CFI_SIGNAL_FRAME 34 + #define CFI_SIGNAL_FRAME .cfi_signal_frame 35 + #else 36 + #define CFI_SIGNAL_FRAME 37 + #endif 29 38 30 39 #else 31 40 ··· 53 48 #define CFI_RESTORE ignore 54 49 #define CFI_REMEMBER_STATE ignore 55 50 #define CFI_RESTORE_STATE ignore 51 + #define CFI_UNDEFINED ignore 52 + #define CFI_SIGNAL_FRAME ignore 56 53 57 54 #endif 58 55
+1 -1
include/asm-i386/e820.h
··· 18 18 19 19 #define E820_RAM 1 20 20 #define E820_RESERVED 2 21 - #define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ 21 + #define E820_ACPI 3 22 22 #define E820_NVS 4 23 23 24 24 #define HIGH_MEMORY (1024*1024)
+24
include/asm-i386/frame.i
··· 1 + #include <linux/config.h> 2 + #include <asm/dwarf2.h> 3 + 4 + /* The annotation hides the frame from the unwinder and makes it look 5 + like a ordinary ebp save/restore. This avoids some special cases for 6 + frame pointer later */ 7 + #ifdef CONFIG_FRAME_POINTER 8 + .macro FRAME 9 + pushl %ebp 10 + CFI_ADJUST_CFA_OFFSET 4 11 + CFI_REL_OFFSET ebp,0 12 + movl %esp,%ebp 13 + .endm 14 + .macro ENDFRAME 15 + popl %ebp 16 + CFI_ADJUST_CFA_OFFSET -4 17 + CFI_RESTORE ebp 18 + .endm 19 + #else 20 + .macro FRAME 21 + .endm 22 + .macro ENDFRAME 23 + .endm 24 + #endif
+41 -28
include/asm-i386/genapic.h
··· 1 1 #ifndef _ASM_GENAPIC_H 2 2 #define _ASM_GENAPIC_H 1 3 3 4 + #include <asm/mpspec.h> 5 + 4 6 /* 5 7 * Generic APIC driver interface. 6 8 * ··· 65 63 unsigned (*get_apic_id)(unsigned long x); 66 64 unsigned long apic_id_mask; 67 65 unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask); 68 - 66 + 67 + #ifdef CONFIG_SMP 69 68 /* ipi */ 70 69 void (*send_IPI_mask)(cpumask_t mask, int vector); 71 70 void (*send_IPI_allbutself)(int vector); 72 71 void (*send_IPI_all)(int vector); 72 + #endif 73 73 }; 74 74 75 - #define APICFUNC(x) .x = x 75 + #define APICFUNC(x) .x = x, 76 + 77 + /* More functions could be probably marked IPIFUNC and save some space 78 + in UP GENERICARCH kernels, but I don't have the nerve right now 79 + to untangle this mess. -AK */ 80 + #ifdef CONFIG_SMP 81 + #define IPIFUNC(x) APICFUNC(x) 82 + #else 83 + #define IPIFUNC(x) 84 + #endif 76 85 77 86 #define APIC_INIT(aname, aprobe) { \ 78 87 .name = aname, \ ··· 93 80 .no_balance_irq = NO_BALANCE_IRQ, \ 94 81 .ESR_DISABLE = esr_disable, \ 95 82 .apic_destination_logical = APIC_DEST_LOGICAL, \ 96 - APICFUNC(apic_id_registered), \ 97 - APICFUNC(target_cpus), \ 98 - APICFUNC(check_apicid_used), \ 99 - APICFUNC(check_apicid_present), \ 100 - APICFUNC(init_apic_ldr), \ 101 - APICFUNC(ioapic_phys_id_map), \ 102 - APICFUNC(clustered_apic_check), \ 103 - APICFUNC(multi_timer_check), \ 104 - APICFUNC(apicid_to_node), \ 105 - APICFUNC(cpu_to_logical_apicid), \ 106 - APICFUNC(cpu_present_to_apicid), \ 107 - APICFUNC(apicid_to_cpu_present), \ 108 - APICFUNC(mpc_apic_id), \ 109 - APICFUNC(setup_portio_remap), \ 110 - APICFUNC(check_phys_apicid_present), \ 111 - APICFUNC(mpc_oem_bus_info), \ 112 - APICFUNC(mpc_oem_pci_bus), \ 113 - APICFUNC(mps_oem_check), \ 114 - APICFUNC(get_apic_id), \ 83 + APICFUNC(apic_id_registered) \ 84 + APICFUNC(target_cpus) \ 85 + APICFUNC(check_apicid_used) \ 86 + APICFUNC(check_apicid_present) \ 87 + APICFUNC(init_apic_ldr) \ 88 + APICFUNC(ioapic_phys_id_map) \ 89 + APICFUNC(clustered_apic_check) \ 90 + APICFUNC(multi_timer_check) \ 91 + APICFUNC(apicid_to_node) \ 92 + APICFUNC(cpu_to_logical_apicid) \ 93 + APICFUNC(cpu_present_to_apicid) \ 94 + APICFUNC(apicid_to_cpu_present) \ 95 + APICFUNC(mpc_apic_id) \ 96 + APICFUNC(setup_portio_remap) \ 97 + APICFUNC(check_phys_apicid_present) \ 98 + APICFUNC(mpc_oem_bus_info) \ 99 + APICFUNC(mpc_oem_pci_bus) \ 100 + APICFUNC(mps_oem_check) \ 101 + APICFUNC(get_apic_id) \ 115 102 .apic_id_mask = APIC_ID_MASK, \ 116 - APICFUNC(cpu_mask_to_apicid), \ 117 - APICFUNC(acpi_madt_oem_check), \ 118 - APICFUNC(send_IPI_mask), \ 119 - APICFUNC(send_IPI_allbutself), \ 120 - APICFUNC(send_IPI_all), \ 121 - APICFUNC(enable_apic_mode), \ 122 - APICFUNC(phys_pkg_id), \ 103 + APICFUNC(cpu_mask_to_apicid) \ 104 + APICFUNC(acpi_madt_oem_check) \ 105 + IPIFUNC(send_IPI_mask) \ 106 + IPIFUNC(send_IPI_allbutself) \ 107 + IPIFUNC(send_IPI_all) \ 108 + APICFUNC(enable_apic_mode) \ 109 + APICFUNC(phys_pkg_id) \ 123 110 } 124 111 125 112 extern struct genapic *genapic;
+13 -1
include/asm-i386/intel_arch_perfmon.h
··· 14 14 15 15 #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c) 16 16 #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) 17 - #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT (1 << 0) 17 + #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX (0) 18 + #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \ 19 + (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX)) 20 + 21 + union cpuid10_eax { 22 + struct { 23 + unsigned int version_id:8; 24 + unsigned int num_counters:8; 25 + unsigned int bit_width:8; 26 + unsigned int mask_length:8; 27 + } split; 28 + unsigned int full; 29 + }; 18 30 19 31 #endif /* X86_INTEL_ARCH_PERFMON_H */
+11
include/asm-i386/io_apic.h
··· 188 188 /* 1 if "noapic" boot option passed */ 189 189 extern int skip_ioapic_setup; 190 190 191 + static inline void disable_ioapic_setup(void) 192 + { 193 + skip_ioapic_setup = 1; 194 + } 195 + 196 + static inline int ioapic_setup_disabled(void) 197 + { 198 + return skip_ioapic_setup; 199 + } 200 + 191 201 /* 192 202 * If we use the IO-APIC for IRQ routing, disable automatic 193 203 * assignment of PCI IRQ's. ··· 216 206 217 207 #else /* !CONFIG_X86_IO_APIC */ 218 208 #define io_apic_assign_pci_irqs 0 209 + static inline void disable_ioapic_setup(void) { } 219 210 #endif 220 211 221 212 extern int assign_irq_vector(int irq);
+27
include/asm-i386/kexec.h
··· 1 1 #ifndef _I386_KEXEC_H 2 2 #define _I386_KEXEC_H 3 3 4 + #define PA_CONTROL_PAGE 0 5 + #define VA_CONTROL_PAGE 1 6 + #define PA_PGD 2 7 + #define VA_PGD 3 8 + #define PA_PTE_0 4 9 + #define VA_PTE_0 5 10 + #define PA_PTE_1 6 11 + #define VA_PTE_1 7 12 + #ifdef CONFIG_X86_PAE 13 + #define PA_PMD_0 8 14 + #define VA_PMD_0 9 15 + #define PA_PMD_1 10 16 + #define VA_PMD_1 11 17 + #define PAGES_NR 12 18 + #else 19 + #define PAGES_NR 8 20 + #endif 21 + 22 + #ifndef __ASSEMBLY__ 23 + 4 24 #include <asm/fixmap.h> 5 25 #include <asm/ptrace.h> 6 26 #include <asm/string.h> ··· 92 72 newregs->eip = (unsigned long)current_text_addr(); 93 73 } 94 74 } 75 + asmlinkage NORET_TYPE void 76 + relocate_kernel(unsigned long indirection_page, 77 + unsigned long control_page, 78 + unsigned long start_address, 79 + unsigned int has_pae) ATTRIB_NORET; 80 + 81 + #endif /* __ASSEMBLY__ */ 95 82 96 83 #endif /* _I386_KEXEC_H */
+4
include/asm-i386/mach-es7000/mach_apic.h
··· 123 123 /* Mapping from cpu number to logical apicid */ 124 124 static inline int cpu_to_logical_apicid(int cpu) 125 125 { 126 + #ifdef CONFIG_SMP 126 127 if (cpu >= NR_CPUS) 127 128 return BAD_APICID; 128 129 return (int)cpu_2_logical_apicid[cpu]; 130 + #else 131 + return logical_smp_processor_id(); 132 + #endif 129 133 } 130 134 131 135 static inline int mpc_apic_id(struct mpc_config_processor *m, struct mpc_config_translation *unused)
+9 -2
include/asm-i386/mach-summit/mach_apic.h
··· 46 46 static inline void init_apic_ldr(void) 47 47 { 48 48 unsigned long val, id; 49 - int i, count; 50 - u8 lid; 49 + int count = 0; 51 50 u8 my_id = (u8)hard_smp_processor_id(); 52 51 u8 my_cluster = (u8)apicid_cluster(my_id); 52 + #ifdef CONFIG_SMP 53 + u8 lid; 54 + int i; 53 55 54 56 /* Create logical APIC IDs by counting CPUs already in cluster. */ 55 57 for (count = 0, i = NR_CPUS; --i >= 0; ) { ··· 59 57 if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster) 60 58 ++count; 61 59 } 60 + #endif 62 61 /* We only have a 4 wide bitmap in cluster mode. If a deranged 63 62 * BIOS puts 5 CPUs in one APIC cluster, we're hosed. */ 64 63 BUG_ON(count >= XAPIC_DEST_CPUS_SHIFT); ··· 94 91 /* Mapping from cpu number to logical apicid */ 95 92 static inline int cpu_to_logical_apicid(int cpu) 96 93 { 94 + #ifdef CONFIG_SMP 97 95 if (cpu >= NR_CPUS) 98 96 return BAD_APICID; 99 97 return (int)cpu_2_logical_apicid[cpu]; 98 + #else 99 + return logical_smp_processor_id(); 100 + #endif 100 101 } 101 102 102 103 static inline int cpu_present_to_apicid(int mps_cpu)
+4 -12
include/asm-i386/mutex.h
··· 30 30 \ 31 31 __asm__ __volatile__( \ 32 32 LOCK_PREFIX " decl (%%eax) \n" \ 33 - " js 2f \n" \ 33 + " jns 1f \n" \ 34 + " call "#fail_fn" \n" \ 34 35 "1: \n" \ 35 - \ 36 - LOCK_SECTION_START("") \ 37 - "2: call "#fail_fn" \n" \ 38 - " jmp 1b \n" \ 39 - LOCK_SECTION_END \ 40 36 \ 41 37 :"=a" (dummy) \ 42 38 : "a" (count) \ ··· 82 86 \ 83 87 __asm__ __volatile__( \ 84 88 LOCK_PREFIX " incl (%%eax) \n" \ 85 - " jle 2f \n" \ 89 + " jg 1f \n" \ 90 + " call "#fail_fn" \n" \ 86 91 "1: \n" \ 87 - \ 88 - LOCK_SECTION_START("") \ 89 - "2: call "#fail_fn" \n" \ 90 - " jmp 1b \n" \ 91 - LOCK_SECTION_END \ 92 92 \ 93 93 :"=a" (dummy) \ 94 94 : "a" (count) \
+15 -18
include/asm-i386/nmi.h
··· 6 6 7 7 #include <linux/pm.h> 8 8 9 - struct pt_regs; 10 - 11 - typedef int (*nmi_callback_t)(struct pt_regs * regs, int cpu); 12 - 13 9 /** 14 - * set_nmi_callback 10 + * do_nmi_callback 15 11 * 16 - * Set a handler for an NMI. Only one handler may be 17 - * set. Return 1 if the NMI was handled. 12 + * Check to see if a callback exists and execute it. Return 1 13 + * if the handler exists and was handled successfully. 18 14 */ 19 - void set_nmi_callback(nmi_callback_t callback); 15 + int do_nmi_callback(struct pt_regs *regs, int cpu); 20 16 21 - /** 22 - * unset_nmi_callback 23 - * 24 - * Remove the handler previously set. 25 - */ 26 - void unset_nmi_callback(void); 17 + extern int nmi_watchdog_enabled; 18 + extern int avail_to_resrv_perfctr_nmi_bit(unsigned int); 19 + extern int avail_to_resrv_perfctr_nmi(unsigned int); 20 + extern int reserve_perfctr_nmi(unsigned int); 21 + extern void release_perfctr_nmi(unsigned int); 22 + extern int reserve_evntsel_nmi(unsigned int); 23 + extern void release_evntsel_nmi(unsigned int); 27 24 28 - extern void setup_apic_nmi_watchdog (void); 29 - extern int reserve_lapic_nmi(void); 30 - extern void release_lapic_nmi(void); 25 + extern void setup_apic_nmi_watchdog (void *); 26 + extern void stop_apic_nmi_watchdog (void *); 31 27 extern void disable_timer_nmi_watchdog(void); 32 28 extern void enable_timer_nmi_watchdog(void); 33 - extern void nmi_watchdog_tick (struct pt_regs * regs); 29 + extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); 34 30 31 + extern atomic_t nmi_active; 35 32 extern unsigned int nmi_watchdog; 36 33 #define NMI_DEFAULT -1 37 34 #define NMI_NONE 0
-2
include/asm-i386/pgtable.h
··· 411 411 static inline int set_kernel_exec(unsigned long vaddr, int enable) { return 0;} 412 412 #endif 413 413 414 - extern void noexec_setup(const char *str); 415 - 416 414 #if defined(CONFIG_HIGHPTE) 417 415 #define pte_offset_map(dir, address) \ 418 416 ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address))
+3 -6
include/asm-i386/ptrace.h
··· 27 27 #ifdef __KERNEL__ 28 28 29 29 #include <asm/vm86.h> 30 + #include <asm/segment.h> 30 31 31 32 struct task_struct; 32 33 extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); ··· 41 40 */ 42 41 static inline int user_mode(struct pt_regs *regs) 43 42 { 44 - return (regs->xcs & 3) != 0; 43 + return (regs->xcs & SEGMENT_RPL_MASK) == USER_RPL; 45 44 } 46 45 static inline int user_mode_vm(struct pt_regs *regs) 47 46 { 48 - return ((regs->xcs & 3) | (regs->eflags & VM_MASK)) != 0; 47 + return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL; 49 48 } 50 49 #define instruction_pointer(regs) ((regs)->eip) 51 - #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER) 52 50 extern unsigned long profile_pc(struct pt_regs *regs); 53 - #else 54 - #define profile_pc(regs) instruction_pointer(regs) 55 - #endif 56 51 #endif /* __KERNEL__ */ 57 52 58 53 #endif
+1 -47
include/asm-i386/rwlock.h
··· 20 20 #define RW_LOCK_BIAS 0x01000000 21 21 #define RW_LOCK_BIAS_STR "0x01000000" 22 22 23 - #define __build_read_lock_ptr(rw, helper) \ 24 - asm volatile(LOCK_PREFIX " subl $1,(%0)\n\t" \ 25 - "jns 1f\n" \ 26 - "call " helper "\n\t" \ 27 - "1:\n" \ 28 - ::"a" (rw) : "memory") 29 - 30 - #define __build_read_lock_const(rw, helper) \ 31 - asm volatile(LOCK_PREFIX " subl $1,%0\n\t" \ 32 - "jns 1f\n" \ 33 - "pushl %%eax\n\t" \ 34 - "leal %0,%%eax\n\t" \ 35 - "call " helper "\n\t" \ 36 - "popl %%eax\n\t" \ 37 - "1:\n" \ 38 - :"+m" (*(volatile int *)rw) : : "memory") 39 - 40 - #define __build_read_lock(rw, helper) do { \ 41 - if (__builtin_constant_p(rw)) \ 42 - __build_read_lock_const(rw, helper); \ 43 - else \ 44 - __build_read_lock_ptr(rw, helper); \ 45 - } while (0) 46 - 47 - #define __build_write_lock_ptr(rw, helper) \ 48 - asm volatile(LOCK_PREFIX " subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \ 49 - "jz 1f\n" \ 50 - "call " helper "\n\t" \ 51 - "1:\n" \ 52 - ::"a" (rw) : "memory") 53 - 54 - #define __build_write_lock_const(rw, helper) \ 55 - asm volatile(LOCK_PREFIX " subl $" RW_LOCK_BIAS_STR ",%0\n\t" \ 56 - "jz 1f\n" \ 57 - "pushl %%eax\n\t" \ 58 - "leal %0,%%eax\n\t" \ 59 - "call " helper "\n\t" \ 60 - "popl %%eax\n\t" \ 61 - "1:\n" \ 62 - :"+m" (*(volatile int *)rw) : : "memory") 63 - 64 - #define __build_write_lock(rw, helper) do { \ 65 - if (__builtin_constant_p(rw)) \ 66 - __build_write_lock_const(rw, helper); \ 67 - else \ 68 - __build_write_lock_ptr(rw, helper); \ 69 - } while (0) 23 + /* Code is in asm-i386/spinlock.h */ 70 24 71 25 #endif
+12 -50
include/asm-i386/rwsem.h
··· 99 99 __asm__ __volatile__( 100 100 "# beginning down_read\n\t" 101 101 LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value */ 102 - " js 2f\n\t" /* jump if we weren't granted the lock */ 102 + " jns 1f\n" 103 + " call call_rwsem_down_read_failed\n" 103 104 "1:\n\t" 104 - LOCK_SECTION_START("") 105 - "2:\n\t" 106 - " pushl %%ecx\n\t" 107 - " pushl %%edx\n\t" 108 - " call rwsem_down_read_failed\n\t" 109 - " popl %%edx\n\t" 110 - " popl %%ecx\n\t" 111 - " jmp 1b\n" 112 - LOCK_SECTION_END 113 105 "# ending down_read\n\t" 114 106 : "+m" (sem->count) 115 107 : "a" (sem) ··· 143 151 "# beginning down_write\n\t" 144 152 LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */ 145 153 " testl %%edx,%%edx\n\t" /* was the count 0 before? */ 146 - " jnz 2f\n\t" /* jump if we weren't granted the lock */ 147 - "1:\n\t" 148 - LOCK_SECTION_START("") 149 - "2:\n\t" 150 - " pushl %%ecx\n\t" 151 - " call rwsem_down_write_failed\n\t" 152 - " popl %%ecx\n\t" 153 - " jmp 1b\n" 154 - LOCK_SECTION_END 154 + " jz 1f\n" 155 + " call call_rwsem_down_write_failed\n" 156 + "1:\n" 155 157 "# ending down_write" 156 158 : "+m" (sem->count), "=d" (tmp) 157 159 : "a" (sem), "1" (tmp) ··· 179 193 __asm__ __volatile__( 180 194 "# beginning __up_read\n\t" 181 195 LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */ 182 - " js 2f\n\t" /* jump if the lock is being waited upon */ 183 - "1:\n\t" 184 - LOCK_SECTION_START("") 185 - "2:\n\t" 186 - " decw %%dx\n\t" /* do nothing if still outstanding active readers */ 187 - " jnz 1b\n\t" 188 - " pushl %%ecx\n\t" 189 - " call rwsem_wake\n\t" 190 - " popl %%ecx\n\t" 191 - " jmp 1b\n" 192 - LOCK_SECTION_END 196 + " jns 1f\n\t" 197 + " call call_rwsem_wake\n" 198 + "1:\n" 193 199 "# ending __up_read\n" 194 200 : "+m" (sem->count), "=d" (tmp) 195 201 : "a" (sem), "1" (tmp) ··· 197 219 "# beginning __up_write\n\t" 198 220 " movl %2,%%edx\n\t" 199 221 LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */ 200 - " jnz 2f\n\t" /* jump if the lock is being waited upon */ 222 + " jz 1f\n" 223 + " call call_rwsem_wake\n" 201 224 "1:\n\t" 202 - LOCK_SECTION_START("") 203 - "2:\n\t" 204 - " decw %%dx\n\t" /* did the active count reduce to 0? */ 205 - " jnz 1b\n\t" /* jump back if not */ 206 - " pushl %%ecx\n\t" 207 - " call rwsem_wake\n\t" 208 - " popl %%ecx\n\t" 209 - " jmp 1b\n" 210 - LOCK_SECTION_END 211 225 "# ending __up_write\n" 212 226 : "+m" (sem->count) 213 227 : "a" (sem), "i" (-RWSEM_ACTIVE_WRITE_BIAS) ··· 214 244 __asm__ __volatile__( 215 245 "# beginning __downgrade_write\n\t" 216 246 LOCK_PREFIX " addl %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */ 217 - " js 2f\n\t" /* jump if the lock is being waited upon */ 247 + " jns 1f\n\t" 248 + " call call_rwsem_downgrade_wake\n" 218 249 "1:\n\t" 219 - LOCK_SECTION_START("") 220 - "2:\n\t" 221 - " pushl %%ecx\n\t" 222 - " pushl %%edx\n\t" 223 - " call rwsem_downgrade_wake\n\t" 224 - " popl %%edx\n\t" 225 - " popl %%ecx\n\t" 226 - " jmp 1b\n" 227 - LOCK_SECTION_END 228 250 "# ending __downgrade_write\n" 229 251 : "+m" (sem->count) 230 252 : "a" (sem), "i" (-RWSEM_WAITING_BIAS)
+17
include/asm-i386/segment.h
··· 83 83 84 84 #define GDT_SIZE (GDT_ENTRIES * 8) 85 85 86 + /* Matches __KERNEL_CS and __USER_CS (they must be 2 entries apart) */ 87 + #define SEGMENT_IS_FLAT_CODE(x) (((x) & 0xec) == GDT_ENTRY_KERNEL_CS * 8) 88 + /* Matches PNP_CS32 and PNP_CS16 (they must be consecutive) */ 89 + #define SEGMENT_IS_PNP_CODE(x) (((x) & 0xf4) == GDT_ENTRY_PNPBIOS_BASE * 8) 90 + 86 91 /* Simple and small GDT entries for booting only */ 87 92 88 93 #define GDT_ENTRY_BOOT_CS 2 ··· 117 112 */ 118 113 #define IDT_ENTRIES 256 119 114 115 + /* Bottom two bits of selector give the ring privilege level */ 116 + #define SEGMENT_RPL_MASK 0x3 117 + /* Bit 2 is table indicator (LDT/GDT) */ 118 + #define SEGMENT_TI_MASK 0x4 119 + 120 + /* User mode is privilege level 3 */ 121 + #define USER_RPL 0x3 122 + /* LDT segment has TI set, GDT has it cleared */ 123 + #define SEGMENT_LDT 0x4 124 + #define SEGMENT_GDT 0x0 125 + 126 + #define get_kernel_rpl() 0 120 127 #endif
+17 -32
include/asm-i386/semaphore.h
··· 100 100 __asm__ __volatile__( 101 101 "# atomic down operation\n\t" 102 102 LOCK_PREFIX "decl %0\n\t" /* --sem->count */ 103 - "js 2f\n" 104 - "1:\n" 105 - LOCK_SECTION_START("") 106 - "2:\tlea %0,%%eax\n\t" 107 - "call __down_failed\n\t" 108 - "jmp 1b\n" 109 - LOCK_SECTION_END 103 + "jns 2f\n" 104 + "\tlea %0,%%eax\n\t" 105 + "call __down_failed\n" 106 + "2:" 110 107 :"+m" (sem->count) 111 108 : 112 109 :"memory","ax"); ··· 120 123 might_sleep(); 121 124 __asm__ __volatile__( 122 125 "# atomic interruptible down operation\n\t" 126 + "xorl %0,%0\n\t" 123 127 LOCK_PREFIX "decl %1\n\t" /* --sem->count */ 124 - "js 2f\n\t" 125 - "xorl %0,%0\n" 126 - "1:\n" 127 - LOCK_SECTION_START("") 128 - "2:\tlea %1,%%eax\n\t" 129 - "call __down_failed_interruptible\n\t" 130 - "jmp 1b\n" 131 - LOCK_SECTION_END 128 + "jns 2f\n\t" 129 + "lea %1,%%eax\n\t" 130 + "call __down_failed_interruptible\n" 131 + "2:" 132 132 :"=a" (result), "+m" (sem->count) 133 133 : 134 134 :"memory"); ··· 142 148 143 149 __asm__ __volatile__( 144 150 "# atomic interruptible down operation\n\t" 151 + "xorl %0,%0\n\t" 145 152 LOCK_PREFIX "decl %1\n\t" /* --sem->count */ 146 - "js 2f\n\t" 147 - "xorl %0,%0\n" 148 - "1:\n" 149 - LOCK_SECTION_START("") 150 - "2:\tlea %1,%%eax\n\t" 153 + "jns 2f\n\t" 154 + "lea %1,%%eax\n\t" 151 155 "call __down_failed_trylock\n\t" 152 - "jmp 1b\n" 153 - LOCK_SECTION_END 156 + "2:\n" 154 157 :"=a" (result), "+m" (sem->count) 155 158 : 156 159 :"memory"); ··· 157 166 /* 158 167 * Note! This is subtle. We jump to wake people up only if 159 168 * the semaphore was negative (== somebody was waiting on it). 160 - * The default case (no contention) will result in NO 161 - * jumps for both down() and up(). 162 169 */ 163 170 static inline void up(struct semaphore * sem) 164 171 { 165 172 __asm__ __volatile__( 166 173 "# atomic up operation\n\t" 167 174 LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ 168 - "jle 2f\n" 169 - "1:\n" 170 - LOCK_SECTION_START("") 171 - "2:\tlea %0,%%eax\n\t" 172 - "call __up_wakeup\n\t" 173 - "jmp 1b\n" 174 - LOCK_SECTION_END 175 - ".subsection 0\n" 175 + "jg 1f\n\t" 176 + "lea %0,%%eax\n\t" 177 + "call __up_wakeup\n" 178 + "1:" 176 179 :"+m" (sem->count) 177 180 : 178 181 :"memory","ax");
+13 -7
include/asm-i386/smp.h
··· 80 80 return GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID)); 81 81 } 82 82 #endif 83 - 84 - static __inline int logical_smp_processor_id(void) 85 - { 86 - /* we don't want to mark this access volatile - bad code generation */ 87 - return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); 88 - } 89 - 90 83 #endif 91 84 92 85 extern int __cpu_disable(void); 93 86 extern void __cpu_die(unsigned int cpu); 87 + extern unsigned int num_processors; 88 + 94 89 #endif /* !__ASSEMBLY__ */ 95 90 96 91 #else /* CONFIG_SMP */ ··· 95 100 #define NO_PROC_ID 0xFF /* No processor magic marker */ 96 101 97 102 #endif 103 + 104 + #ifndef __ASSEMBLY__ 105 + #ifdef CONFIG_X86_LOCAL_APIC 106 + static __inline int logical_smp_processor_id(void) 107 + { 108 + /* we don't want to mark this access volatile - bad code generation */ 109 + return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); 110 + } 111 + #endif 112 + #endif 113 + 98 114 #endif
+70 -64
include/asm-i386/spinlock.h
··· 4 4 #include <asm/atomic.h> 5 5 #include <asm/rwlock.h> 6 6 #include <asm/page.h> 7 + #include <asm/processor.h> 7 8 #include <linux/compiler.h> 9 + 10 + #define CLI_STRING "cli" 11 + #define STI_STRING "sti" 8 12 9 13 /* 10 14 * Your basic SMP spinlocks, allowing only a single CPU anywhere ··· 21 17 * (the type definitions are in asm/spinlock_types.h) 22 18 */ 23 19 24 - #define __raw_spin_is_locked(x) \ 25 - (*(volatile signed char *)(&(x)->slock) <= 0) 26 - 27 - #define __raw_spin_lock_string \ 28 - "\n1:\t" \ 29 - LOCK_PREFIX " ; decb %0\n\t" \ 30 - "jns 3f\n" \ 31 - "2:\t" \ 32 - "rep;nop\n\t" \ 33 - "cmpb $0,%0\n\t" \ 34 - "jle 2b\n\t" \ 35 - "jmp 1b\n" \ 36 - "3:\n\t" 37 - 38 - /* 39 - * NOTE: there's an irqs-on section here, which normally would have to be 40 - * irq-traced, but on CONFIG_TRACE_IRQFLAGS we never use 41 - * __raw_spin_lock_string_flags(). 42 - */ 43 - #define __raw_spin_lock_string_flags \ 44 - "\n1:\t" \ 45 - LOCK_PREFIX " ; decb %0\n\t" \ 46 - "jns 5f\n" \ 47 - "2:\t" \ 48 - "testl $0x200, %1\n\t" \ 49 - "jz 4f\n\t" \ 50 - "sti\n" \ 51 - "3:\t" \ 52 - "rep;nop\n\t" \ 53 - "cmpb $0, %0\n\t" \ 54 - "jle 3b\n\t" \ 55 - "cli\n\t" \ 56 - "jmp 1b\n" \ 57 - "4:\t" \ 58 - "rep;nop\n\t" \ 59 - "cmpb $0, %0\n\t" \ 60 - "jg 1b\n\t" \ 61 - "jmp 4b\n" \ 62 - "5:\n\t" 20 + static inline int __raw_spin_is_locked(raw_spinlock_t *x) 21 + { 22 + return *(volatile signed char *)(&(x)->slock) <= 0; 23 + } 63 24 64 25 static inline void __raw_spin_lock(raw_spinlock_t *lock) 65 26 { 66 - asm(__raw_spin_lock_string : "+m" (lock->slock) : : "memory"); 27 + asm volatile("\n1:\t" 28 + LOCK_PREFIX " ; decb %0\n\t" 29 + "jns 3f\n" 30 + "2:\t" 31 + "rep;nop\n\t" 32 + "cmpb $0,%0\n\t" 33 + "jle 2b\n\t" 34 + "jmp 1b\n" 35 + "3:\n\t" 36 + : "+m" (lock->slock) : : "memory"); 67 37 } 68 38 69 39 /* 70 40 * It is easier for the lock validator if interrupts are not re-enabled 71 41 * in the middle of a lock-acquire. This is a performance feature anyway 72 42 * so we turn it off: 43 + * 44 + * NOTE: there's an irqs-on section here, which normally would have to be 45 + * irq-traced, but on CONFIG_TRACE_IRQFLAGS we never use this variant. 73 46 */ 74 47 #ifndef CONFIG_PROVE_LOCKING 75 48 static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) 76 49 { 77 - asm(__raw_spin_lock_string_flags : "+m" (lock->slock) : "r" (flags) : "memory"); 50 + asm volatile( 51 + "\n1:\t" 52 + LOCK_PREFIX " ; decb %0\n\t" 53 + "jns 5f\n" 54 + "2:\t" 55 + "testl $0x200, %1\n\t" 56 + "jz 4f\n\t" 57 + STI_STRING "\n" 58 + "3:\t" 59 + "rep;nop\n\t" 60 + "cmpb $0, %0\n\t" 61 + "jle 3b\n\t" 62 + CLI_STRING "\n\t" 63 + "jmp 1b\n" 64 + "4:\t" 65 + "rep;nop\n\t" 66 + "cmpb $0, %0\n\t" 67 + "jg 1b\n\t" 68 + "jmp 4b\n" 69 + "5:\n\t" 70 + : "+m" (lock->slock) : "r" (flags) : "memory"); 78 71 } 79 72 #endif 80 73 81 74 static inline int __raw_spin_trylock(raw_spinlock_t *lock) 82 75 { 83 76 char oldval; 84 - __asm__ __volatile__( 77 + asm volatile( 85 78 "xchgb %b0,%1" 86 79 :"=q" (oldval), "+m" (lock->slock) 87 80 :"0" (0) : "memory"); ··· 94 93 95 94 #if !defined(CONFIG_X86_OOSTORE) && !defined(CONFIG_X86_PPRO_FENCE) 96 95 97 - #define __raw_spin_unlock_string \ 98 - "movb $1,%0" \ 99 - :"+m" (lock->slock) : : "memory" 100 - 101 - 102 96 static inline void __raw_spin_unlock(raw_spinlock_t *lock) 103 97 { 104 - __asm__ __volatile__( 105 - __raw_spin_unlock_string 106 - ); 98 + asm volatile("movb $1,%0" : "+m" (lock->slock) :: "memory"); 107 99 } 108 100 109 101 #else 110 - 111 - #define __raw_spin_unlock_string \ 112 - "xchgb %b0, %1" \ 113 - :"=q" (oldval), "+m" (lock->slock) \ 114 - :"0" (oldval) : "memory" 115 102 116 103 static inline void __raw_spin_unlock(raw_spinlock_t *lock) 117 104 { 118 105 char oldval = 1; 119 106 120 - __asm__ __volatile__( 121 - __raw_spin_unlock_string 122 - ); 107 + asm volatile("xchgb %b0, %1" 108 + : "=q" (oldval), "+m" (lock->slock) 109 + : "0" (oldval) : "memory"); 123 110 } 124 111 125 112 #endif 126 113 127 - #define __raw_spin_unlock_wait(lock) \ 128 - do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) 114 + static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) 115 + { 116 + while (__raw_spin_is_locked(lock)) 117 + cpu_relax(); 118 + } 129 119 130 120 /* 131 121 * Read-write spinlocks, allowing multiple readers ··· 143 151 * read_can_lock - would read_trylock() succeed? 144 152 * @lock: the rwlock in question. 145 153 */ 146 - #define __raw_read_can_lock(x) ((int)(x)->lock > 0) 154 + static inline int __raw_read_can_lock(raw_rwlock_t *x) 155 + { 156 + return (int)(x)->lock > 0; 157 + } 147 158 148 159 /** 149 160 * write_can_lock - would write_trylock() succeed? 150 161 * @lock: the rwlock in question. 151 162 */ 152 - #define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) 163 + static inline int __raw_write_can_lock(raw_rwlock_t *x) 164 + { 165 + return (x)->lock == RW_LOCK_BIAS; 166 + } 153 167 154 168 static inline void __raw_read_lock(raw_rwlock_t *rw) 155 169 { 156 - __build_read_lock(rw, "__read_lock_failed"); 170 + asm volatile(LOCK_PREFIX " subl $1,(%0)\n\t" 171 + "jns 1f\n" 172 + "call __read_lock_failed\n\t" 173 + "1:\n" 174 + ::"a" (rw) : "memory"); 157 175 } 158 176 159 177 static inline void __raw_write_lock(raw_rwlock_t *rw) 160 178 { 161 - __build_write_lock(rw, "__write_lock_failed"); 179 + asm volatile(LOCK_PREFIX " subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" 180 + "jz 1f\n" 181 + "call __write_lock_failed\n\t" 182 + "1:\n" 183 + ::"a" (rw) : "memory"); 162 184 } 163 185 164 186 static inline int __raw_read_trylock(raw_rwlock_t *lock)
+1
include/asm-i386/stacktrace.h
··· 1 + #include <asm-x86_64/stacktrace.h>
+9
include/asm-i386/therm_throt.h
··· 1 + #ifndef __ASM_I386_THERM_THROT_H__ 2 + #define __ASM_I386_THERM_THROT_H__ 1 3 + 4 + #include <asm/atomic.h> 5 + 6 + extern atomic_t therm_throt_en; 7 + int therm_throt_process(int curr); 8 + 9 + #endif /* __ASM_I386_THERM_THROT_H__ */
+1 -3
include/asm-i386/tlbflush.h
··· 36 36 : "memory"); \ 37 37 } while (0) 38 38 39 - extern unsigned long pgkern_mask; 40 - 41 39 # define __flush_tlb_all() \ 42 40 do { \ 43 41 if (cpu_has_pge) \ ··· 47 49 #define cpu_has_invlpg (boot_cpu_data.x86 > 3) 48 50 49 51 #define __flush_tlb_single(addr) \ 50 - __asm__ __volatile__("invlpg %0": :"m" (*(char *) addr)) 52 + __asm__ __volatile__("invlpg (%0)" ::"r" (addr) : "memory") 51 53 52 54 #ifdef CONFIG_X86_INVLPG 53 55 # define __flush_tlb_one(addr) __flush_tlb_single(addr)
-1
include/asm-i386/tsc.h
··· 6 6 #ifndef _ASM_i386_TSC_H 7 7 #define _ASM_i386_TSC_H 8 8 9 - #include <linux/config.h> 10 9 #include <asm/processor.h> 11 10 12 11 /*
+2 -1
include/asm-i386/unistd.h
··· 323 323 #define __NR_tee 315 324 324 #define __NR_vmsplice 316 325 325 #define __NR_move_pages 317 326 + #define __NR_getcpu 318 326 327 327 328 #ifdef __KERNEL__ 328 329 329 - #define NR_syscalls 318 330 + #define NR_syscalls 319 330 331 331 332 /* 332 333 * user-visible error numbers are in the range -1 - -128: see
+8
include/asm-i386/unwind.h
··· 18 18 { 19 19 struct pt_regs regs; 20 20 struct task_struct *task; 21 + unsigned call_frame:1; 21 22 }; 22 23 23 24 #define UNW_PC(frame) (frame)->regs.eip ··· 29 28 #define FRAME_LINK_OFFSET 0 30 29 #define STACK_BOTTOM(tsk) STACK_LIMIT((tsk)->thread.esp0) 31 30 #define STACK_TOP(tsk) ((tsk)->thread.esp0) 31 + #else 32 + #define UNW_FP(frame) ((void)(frame), 0) 32 33 #endif 33 34 #define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1)) 34 35 ··· 44 41 PTREGS_INFO(esi), \ 45 42 PTREGS_INFO(edi), \ 46 43 PTREGS_INFO(eip) 44 + 45 + #define UNW_DEFAULT_RA(raItem, dataAlign) \ 46 + ((raItem).where == Memory && \ 47 + !((raItem).value * (dataAlign) + 4)) 47 48 48 49 static inline void arch_unw_init_frame_info(struct unwind_frame_info *info, 49 50 /*const*/ struct pt_regs *regs) ··· 95 88 96 89 #define UNW_PC(frame) ((void)(frame), 0) 97 90 #define UNW_SP(frame) ((void)(frame), 0) 91 + #define UNW_FP(frame) ((void)(frame), 0) 98 92 99 93 static inline int arch_unw_user_mode(const void *info) 100 94 {
+2 -1
include/asm-ia64/module.h
··· 28 28 #define Elf_Ehdr Elf64_Ehdr 29 29 30 30 #define MODULE_PROC_FAMILY "ia64" 31 - #define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY 31 + #define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY \ 32 + "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__) 32 33 33 34 #define ARCH_SHF_SMALL SHF_IA_64_SHORT 34 35
+6
include/asm-um/alternative-asm.i
··· 1 + #ifndef __UM_ALTERNATIVE_ASM_I 2 + #define __UM_ALTERNATIVE_ASM_I 3 + 4 + #include "asm/arch/alternative-asm.i" 5 + 6 + #endif
+6
include/asm-um/frame.i
··· 1 + #ifndef __UM_FRAME_I 2 + #define __UM_FRAME_I 3 + 4 + #include "asm/arch/frame.i" 5 + 6 + #endif
-2
include/asm-x86_64/acpi.h
··· 155 155 156 156 #endif /*CONFIG_ACPI_SLEEP*/ 157 157 158 - #define boot_cpu_physical_apicid boot_cpu_id 159 - 160 158 extern int acpi_disabled; 161 159 extern int acpi_pci_disabled; 162 160
+14
include/asm-x86_64/alternative-asm.i
··· 1 + #include <linux/config.h> 2 + 3 + #ifdef CONFIG_SMP 4 + .macro LOCK_PREFIX 5 + 1: lock 6 + .section .smp_locks,"a" 7 + .align 8 8 + .quad 1b 9 + .previous 10 + .endm 11 + #else 12 + .macro LOCK_PREFIX 13 + .endm 14 + #endif
+2 -7
include/asm-x86_64/apic.h
··· 17 17 18 18 extern int apic_verbosity; 19 19 extern int apic_runs_main_timer; 20 + extern int ioapic_force; 21 + extern int apic_mapped; 20 22 21 23 /* 22 24 * Define the default level of output to be very little ··· 30 28 if ((v) <= apic_verbosity) \ 31 29 printk(s, ##a); \ 32 30 } while (0) 33 - 34 - #ifdef CONFIG_X86_LOCAL_APIC 35 31 36 32 struct pt_regs; 37 33 ··· 95 95 #define K8_APIC_EXT_INT_MSG_EXT 0x7 96 96 #define K8_APIC_EXT_LVT_ENTRY_THRESHOLD 0 97 97 98 - extern int disable_timer_pin_1; 99 - 100 - 101 98 void smp_send_timer_broadcast_ipi(void); 102 99 void switch_APIC_timer_to_ipi(void *cpumask); 103 100 void switch_ipi_to_APIC_timer(void *cpumask); 104 101 105 102 #define ARCH_APICTIMER_STOPS_ON_C3 1 106 - 107 - #endif /* CONFIG_X86_LOCAL_APIC */ 108 103 109 104 extern unsigned boot_cpu_id; 110 105
+2
include/asm-x86_64/bitops.h
··· 399 399 return r+1; 400 400 } 401 401 402 + #define ARCH_HAS_FAST_MULTIPLIER 1 403 + 402 404 #include <asm-generic/bitops/hweight.h> 403 405 404 406 #endif /* __KERNEL__ */
+3 -4
include/asm-x86_64/calgary.h
··· 24 24 #ifndef _ASM_X86_64_CALGARY_H 25 25 #define _ASM_X86_64_CALGARY_H 26 26 27 - #include <linux/config.h> 28 27 #include <linux/spinlock.h> 29 28 #include <linux/device.h> 30 29 #include <linux/dma-mapping.h> ··· 33 34 unsigned long it_base; /* mapped address of tce table */ 34 35 unsigned long it_hint; /* Hint for next alloc */ 35 36 unsigned long *it_map; /* A simple allocation bitmap for now */ 37 + void __iomem *bbar; /* Bridge BAR */ 38 + u64 tar_val; /* Table Address Register */ 39 + struct timer_list watchdog_timer; 36 40 spinlock_t it_lock; /* Protects it_map */ 37 41 unsigned int it_size; /* Size of iommu table in entries */ 38 42 unsigned char it_busno; /* Bus number this table belongs to */ 39 - void __iomem *bbar; 40 - u64 tar_val; 41 - struct timer_list watchdog_timer; 42 43 }; 43 44 44 45 #define TCE_TABLE_SIZE_UNSPECIFIED ~0
+7 -1
include/asm-x86_64/dwarf2.h
··· 13 13 away for older version. 14 14 */ 15 15 16 - #ifdef CONFIG_UNWIND_INFO 16 + #ifdef CONFIG_AS_CFI 17 17 18 18 #define CFI_STARTPROC .cfi_startproc 19 19 #define CFI_ENDPROC .cfi_endproc ··· 28 28 #define CFI_REMEMBER_STATE .cfi_remember_state 29 29 #define CFI_RESTORE_STATE .cfi_restore_state 30 30 #define CFI_UNDEFINED .cfi_undefined 31 + #ifdef CONFIG_AS_CFI_SIGNAL_FRAME 32 + #define CFI_SIGNAL_FRAME .cfi_signal_frame 33 + #else 34 + #define CFI_SIGNAL_FRAME 35 + #endif 31 36 32 37 #else 33 38 ··· 50 45 #define CFI_REMEMBER_STATE # 51 46 #define CFI_RESTORE_STATE # 52 47 #define CFI_UNDEFINED # 48 + #define CFI_SIGNAL_FRAME # 53 49 54 50 #endif 55 51
+2 -7
include/asm-x86_64/e820.h
··· 19 19 20 20 #define E820_RAM 1 21 21 #define E820_RESERVED 2 22 - #define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */ 22 + #define E820_ACPI 3 23 23 #define E820_NVS 4 24 - 25 - #define HIGH_MEMORY (1024*1024) 26 - 27 - #define LOWMEMSIZE() (0x9f000) 28 24 29 25 #ifndef __ASSEMBLY__ 30 26 struct e820entry { ··· 52 56 extern unsigned long e820_hole_size(unsigned long start_pfn, 53 57 unsigned long end_pfn); 54 58 55 - extern void __init parse_memopt(char *p, char **end); 56 - extern void __init parse_memmapopt(char *p, char **end); 59 + extern void finish_e820_parsing(void); 57 60 58 61 extern struct e820map e820; 59 62
-4
include/asm-x86_64/fixmap.h
··· 37 37 VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1, 38 38 VSYSCALL_HPET, 39 39 FIX_HPET_BASE, 40 - #ifdef CONFIG_X86_LOCAL_APIC 41 40 FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ 42 - #endif 43 - #ifdef CONFIG_X86_IO_APIC 44 41 FIX_IO_APIC_BASE_0, 45 42 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1, 46 - #endif 47 43 __end_of_fixed_addresses 48 44 }; 49 45
-1
include/asm-x86_64/genapic.h
··· 16 16 char *name; 17 17 u32 int_delivery_mode; 18 18 u32 int_dest_mode; 19 - u32 int_delivery_dest; /* for quick IPIs */ 20 19 int (*apic_id_registered)(void); 21 20 cpumask_t (*target_cpus)(void); 22 21 void (*init_apic_ldr)(void);
+6 -3
include/asm-x86_64/i387.h
··· 24 24 extern void mxcsr_feature_mask_init(void); 25 25 extern void init_fpu(struct task_struct *child); 26 26 extern int save_i387(struct _fpstate __user *buf); 27 + extern asmlinkage void math_state_restore(void); 27 28 28 29 /* 29 30 * FPU lazy state save handling... ··· 32 31 33 32 #define unlazy_fpu(tsk) do { \ 34 33 if (task_thread_info(tsk)->status & TS_USEDFPU) \ 35 - save_init_fpu(tsk); \ 34 + save_init_fpu(tsk); \ 35 + else \ 36 + tsk->fpu_counter = 0; \ 36 37 } while (0) 37 38 38 39 /* Ignore delayed exceptions from user space */ ··· 137 134 #else 138 135 : [fx] "cdaSDb" (fx), "0" (0)); 139 136 #endif 140 - if (unlikely(err)) 141 - __clear_user(fx, sizeof(struct i387_fxsave_struct)); 137 + if (unlikely(err) && __clear_user(fx, sizeof(struct i387_fxsave_struct))) 138 + err = -EFAULT; 142 139 /* No need to clear here because the caller clears USED_MATH */ 143 140 return err; 144 141 }
+13 -1
include/asm-x86_64/intel_arch_perfmon.h
··· 14 14 15 15 #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL (0x3c) 16 16 #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) 17 - #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT (1 << 0) 17 + #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX (0) 18 + #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \ 19 + (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX)) 20 + 21 + union cpuid10_eax { 22 + struct { 23 + unsigned int version_id:8; 24 + unsigned int num_counters:8; 25 + unsigned int bit_width:8; 26 + unsigned int mask_length:8; 27 + } split; 28 + unsigned int full; 29 + }; 18 30 19 31 #endif /* X86_64_INTEL_ARCH_PERFMON_H */
-6
include/asm-x86_64/io_apic.h
··· 10 10 * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar 11 11 */ 12 12 13 - #ifdef CONFIG_X86_IO_APIC 14 - 15 13 #ifdef CONFIG_PCI_MSI 16 14 static inline int use_pci_vector(void) {return 1;} 17 15 static inline void disable_edge_ioapic_vector(unsigned int vector) { } ··· 206 208 #endif 207 209 208 210 extern int sis_apic_bug; /* dummy */ 209 - 210 - #else /* !CONFIG_X86_IO_APIC */ 211 - #define io_apic_assign_pci_irqs 0 212 - #endif 213 211 214 212 extern int assign_irq_vector(int irq); 215 213
-2
include/asm-x86_64/irq.h
··· 44 44 return ((irq == 2) ? 9 : irq); 45 45 } 46 46 47 - #ifdef CONFIG_X86_LOCAL_APIC 48 47 #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ 49 - #endif 50 48 51 49 #ifdef CONFIG_HOTPLUG_CPU 52 50 #include <linux/cpumask.h>
+29
include/asm-x86_64/kexec.h
··· 1 1 #ifndef _X86_64_KEXEC_H 2 2 #define _X86_64_KEXEC_H 3 3 4 + #define PA_CONTROL_PAGE 0 5 + #define VA_CONTROL_PAGE 1 6 + #define PA_PGD 2 7 + #define VA_PGD 3 8 + #define PA_PUD_0 4 9 + #define VA_PUD_0 5 10 + #define PA_PMD_0 6 11 + #define VA_PMD_0 7 12 + #define PA_PTE_0 8 13 + #define VA_PTE_0 9 14 + #define PA_PUD_1 10 15 + #define VA_PUD_1 11 16 + #define PA_PMD_1 12 17 + #define VA_PMD_1 13 18 + #define PA_PTE_1 14 19 + #define VA_PTE_1 15 20 + #define PA_TABLE_PAGE 16 21 + #define PAGES_NR 17 22 + 23 + #ifndef __ASSEMBLY__ 24 + 4 25 #include <linux/string.h> 5 26 6 27 #include <asm/page.h> ··· 85 64 newregs->rip = (unsigned long)current_text_addr(); 86 65 } 87 66 } 67 + 68 + NORET_TYPE void 69 + relocate_kernel(unsigned long indirection_page, 70 + unsigned long page_list, 71 + unsigned long start_address) ATTRIB_NORET; 72 + 73 + #endif /* __ASSEMBLY__ */ 74 + 88 75 #endif /* _X86_64_KEXEC_H */
+1 -1
include/asm-x86_64/linkage.h
··· 1 1 #ifndef __ASM_LINKAGE_H 2 2 #define __ASM_LINKAGE_H 3 3 4 - /* Nothing to see here... */ 4 + #define __ALIGN .p2align 4,,15 5 5 6 6 #endif
-1
include/asm-x86_64/mach_apic.h
··· 16 16 17 17 #define INT_DELIVERY_MODE (genapic->int_delivery_mode) 18 18 #define INT_DEST_MODE (genapic->int_dest_mode) 19 - #define INT_DELIVERY_DEST (genapic->int_delivery_dest) 20 19 #define TARGET_CPUS (genapic->target_cpus()) 21 20 #define apic_id_registered (genapic->apic_id_registered) 22 21 #define init_apic_ldr (genapic->init_apic_ldr)
+2
include/asm-x86_64/mce.h
··· 99 99 } 100 100 #endif 101 101 102 + void mce_log_therm_throt_event(unsigned int cpu, __u64 status); 103 + 102 104 extern atomic_t mce_entry; 103 105 104 106 #endif
-14
include/asm-x86_64/mmx.h
··· 1 - #ifndef _ASM_MMX_H 2 - #define _ASM_MMX_H 3 - 4 - /* 5 - * MMX 3Dnow! helper operations 6 - */ 7 - 8 - #include <linux/types.h> 9 - 10 - extern void *_mmx_memcpy(void *to, const void *from, size_t size); 11 - extern void mmx_clear_page(void *page); 12 - extern void mmx_copy_page(void *to, void *from); 13 - 14 - #endif
+1 -10
include/asm-x86_64/mpspec.h
··· 159 159 #define MAX_MP_BUSSES 256 160 160 /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */ 161 161 #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4) 162 - enum mp_bustype { 163 - MP_BUS_ISA = 1, 164 - MP_BUS_EISA, 165 - MP_BUS_PCI, 166 - MP_BUS_MCA 167 - }; 168 - extern unsigned char mp_bus_id_to_type [MAX_MP_BUSSES]; 162 + extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); 169 163 extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; 170 164 171 165 extern unsigned int boot_cpu_physical_apicid; ··· 172 178 extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES]; 173 179 extern int mpc_default_type; 174 180 extern unsigned long mp_lapic_addr; 175 - extern int pic_mode; 176 181 177 182 #ifdef CONFIG_ACPI 178 183 extern void mp_register_lapic (u8 id, u8 enabled); 179 184 extern void mp_register_lapic_address (u64 address); 180 185 181 - #ifdef CONFIG_X86_IO_APIC 182 186 extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); 183 187 extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); 184 188 extern void mp_config_acpi_legacy_irqs (void); 185 189 extern int mp_register_gsi (u32 gsi, int triggering, int polarity); 186 - #endif /*CONFIG_X86_IO_APIC*/ 187 190 #endif 188 191 189 192 extern int using_apic_timer;
+11
include/asm-x86_64/msr.h
··· 66 66 #define rdtscl(low) \ 67 67 __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx") 68 68 69 + #define rdtscp(low,high,aux) \ 70 + asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux)) 71 + 69 72 #define rdtscll(val) do { \ 70 73 unsigned int __a,__d; \ 71 74 asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \ 72 75 (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ 73 76 } while(0) 74 77 78 + #define rdtscpll(val, aux) do { \ 79 + unsigned long __a, __d; \ 80 + asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); \ 81 + (val) = (__d << 32) | __a; \ 82 + } while (0) 83 + 75 84 #define write_tsc(val1,val2) wrmsr(0x10, val1, val2) 85 + 86 + #define write_rdtscp_aux(val) wrmsr(0xc0000103, val, 0) 76 87 77 88 #define rdpmc(counter,low,high) \ 78 89 __asm__ __volatile__("rdpmc" \
+6 -14
include/asm-x86_64/mutex.h
··· 25 25 \ 26 26 __asm__ __volatile__( \ 27 27 LOCK_PREFIX " decl (%%rdi) \n" \ 28 - " js 2f \n" \ 29 - "1: \n" \ 30 - \ 31 - LOCK_SECTION_START("") \ 32 - "2: call "#fail_fn" \n" \ 33 - " jmp 1b \n" \ 34 - LOCK_SECTION_END \ 28 + " jns 1f \n" \ 29 + " call "#fail_fn" \n" \ 30 + "1:" \ 35 31 \ 36 32 :"=D" (dummy) \ 37 33 : "D" (v) \ ··· 71 75 \ 72 76 __asm__ __volatile__( \ 73 77 LOCK_PREFIX " incl (%%rdi) \n" \ 74 - " jle 2f \n" \ 75 - "1: \n" \ 76 - \ 77 - LOCK_SECTION_START("") \ 78 - "2: call "#fail_fn" \n" \ 79 - " jmp 1b \n" \ 80 - LOCK_SECTION_END \ 78 + " jg 1f \n" \ 79 + " call "#fail_fn" \n" \ 80 + "1: " \ 81 81 \ 82 82 :"=D" (dummy) \ 83 83 : "D" (v) \
+17 -21
include/asm-x86_64/nmi.h
··· 7 7 #include <linux/pm.h> 8 8 #include <asm/io.h> 9 9 10 - struct pt_regs; 11 - 12 - typedef int (*nmi_callback_t)(struct pt_regs * regs, int cpu); 13 - 14 10 /** 15 - * set_nmi_callback 11 + * do_nmi_callback 16 12 * 17 - * Set a handler for an NMI. Only one handler may be 18 - * set. Return 1 if the NMI was handled. 13 + * Check to see if a callback exists and execute it. Return 1 14 + * if the handler exists and was handled successfully. 19 15 */ 20 - void set_nmi_callback(nmi_callback_t callback); 21 - 22 - /** 23 - * unset_nmi_callback 24 - * 25 - * Remove the handler previously set. 26 - */ 27 - void unset_nmi_callback(void); 16 + int do_nmi_callback(struct pt_regs *regs, int cpu); 28 17 29 18 #ifdef CONFIG_PM 30 19 ··· 37 48 #endif /* CONFIG_PM */ 38 49 39 50 extern void default_do_nmi(struct pt_regs *); 40 - extern void die_nmi(char *str, struct pt_regs *regs); 51 + extern void die_nmi(char *str, struct pt_regs *regs, int do_panic); 41 52 42 53 #define get_nmi_reason() inb(0x61) 43 54 44 55 extern int panic_on_timeout; 45 56 extern int unknown_nmi_panic; 57 + extern int nmi_watchdog_enabled; 46 58 47 59 extern int check_nmi_watchdog(void); 48 - 49 - extern void setup_apic_nmi_watchdog (void); 50 - extern int reserve_lapic_nmi(void); 51 - extern void release_lapic_nmi(void); 60 + extern int avail_to_resrv_perfctr_nmi_bit(unsigned int); 61 + extern int avail_to_resrv_perfctr_nmi(unsigned int); 62 + extern int reserve_perfctr_nmi(unsigned int); 63 + extern void release_perfctr_nmi(unsigned int); 64 + extern int reserve_evntsel_nmi(unsigned int); 65 + extern void release_evntsel_nmi(unsigned int); 66 + 67 + extern void setup_apic_nmi_watchdog (void *); 68 + extern void stop_apic_nmi_watchdog (void *); 52 69 extern void disable_timer_nmi_watchdog(void); 53 70 extern void enable_timer_nmi_watchdog(void); 54 - extern void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); 71 + extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); 55 72 56 73 extern void nmi_watchdog_default(void); 57 74 extern int setup_nmi_watchdog(char *); 58 75 76 + extern atomic_t nmi_active; 59 77 extern unsigned int nmi_watchdog; 60 78 #define NMI_DEFAULT -1 61 79 #define NMI_NONE 0
+5 -37
include/asm-x86_64/pci-direct.h
··· 2 2 #define ASM_PCI_DIRECT_H 1 3 3 4 4 #include <linux/types.h> 5 - #include <asm/io.h> 6 5 7 6 /* Direct PCI access. This is used for PCI accesses in early boot before 8 7 the PCI subsystem works. */ 9 8 10 - #define PDprintk(x...) 9 + extern u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset); 10 + extern u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset); 11 + extern u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset); 12 + extern void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, u32 val); 11 13 12 - static inline u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset) 13 - { 14 - u32 v; 15 - outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 16 - v = inl(0xcfc); 17 - if (v != 0xffffffff) 18 - PDprintk("%x reading 4 from %x: %x\n", slot, offset, v); 19 - return v; 20 - } 21 - 22 - static inline u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset) 23 - { 24 - u8 v; 25 - outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 26 - v = inb(0xcfc + (offset&3)); 27 - PDprintk("%x reading 1 from %x: %x\n", slot, offset, v); 28 - return v; 29 - } 30 - 31 - static inline u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset) 32 - { 33 - u16 v; 34 - outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 35 - v = inw(0xcfc + (offset&2)); 36 - PDprintk("%x reading 2 from %x: %x\n", slot, offset, v); 37 - return v; 38 - } 39 - 40 - static inline void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, 41 - u32 val) 42 - { 43 - PDprintk("%x writing to %x: %x\n", slot, offset, val); 44 - outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 45 - outl(val, 0xcfc); 46 - } 14 + extern int early_pci_allowed(void); 47 15 48 16 #endif
+69 -40
include/asm-x86_64/pda.h
··· 9 9 10 10 /* Per processor datastructure. %gs points to it while the kernel runs */ 11 11 struct x8664_pda { 12 - struct task_struct *pcurrent; /* Current process */ 13 - unsigned long data_offset; /* Per cpu data offset from linker address */ 14 - unsigned long kernelstack; /* top of kernel stack for current */ 15 - unsigned long oldrsp; /* user rsp for system call */ 16 - #if DEBUG_STKSZ > EXCEPTION_STKSZ 17 - unsigned long debugstack; /* #DB/#BP stack. */ 12 + struct task_struct *pcurrent; /* 0 Current process */ 13 + unsigned long data_offset; /* 8 Per cpu data offset from linker 14 + address */ 15 + unsigned long kernelstack; /* 16 top of kernel stack for current */ 16 + unsigned long oldrsp; /* 24 user rsp for system call */ 17 + int irqcount; /* 32 Irq nesting counter. Starts with -1 */ 18 + int cpunumber; /* 36 Logical CPU number */ 19 + #ifdef CONFIG_CC_STACKPROTECTOR 20 + unsigned long stack_canary; /* 40 stack canary value */ 21 + /* gcc-ABI: this canary MUST be at 22 + offset 40!!! */ 18 23 #endif 19 - int irqcount; /* Irq nesting counter. Starts with -1 */ 20 - int cpunumber; /* Logical CPU number */ 21 - char *irqstackptr; /* top of irqstack */ 24 + char *irqstackptr; 22 25 int nodenumber; /* number of current node */ 23 26 unsigned int __softirq_pending; 24 27 unsigned int __nmi_count; /* number of NMI on this CPUs */ 25 - int mmu_state; 28 + short mmu_state; 29 + short isidle; 26 30 struct mm_struct *active_mm; 27 31 unsigned apic_timer_irqs; 28 32 } ____cacheline_aligned_in_smp; ··· 40 36 * There is no fast way to get the base address of the PDA, all the accesses 41 37 * have to mention %fs/%gs. So it needs to be done this Torvaldian way. 42 38 */ 43 - #define sizeof_field(type,field) (sizeof(((type *)0)->field)) 44 - #define typeof_field(type,field) typeof(((type *)0)->field) 39 + extern void __bad_pda_field(void) __attribute__((noreturn)); 45 40 46 - extern void __bad_pda_field(void); 41 + /* 42 + * proxy_pda doesn't actually exist, but tell gcc it is accessed for 43 + * all PDA accesses so it gets read/write dependencies right. 44 + */ 45 + extern struct x8664_pda _proxy_pda; 47 46 48 47 #define pda_offset(field) offsetof(struct x8664_pda, field) 49 48 50 - #define pda_to_op(op,field,val) do { \ 51 - typedef typeof_field(struct x8664_pda, field) T__; \ 52 - switch (sizeof_field(struct x8664_pda, field)) { \ 53 - case 2: \ 54 - asm volatile(op "w %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ 55 - case 4: \ 56 - asm volatile(op "l %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ 57 - case 8: \ 58 - asm volatile(op "q %0,%%gs:%P1"::"ri" ((T__)val),"i"(pda_offset(field)):"memory"); break; \ 59 - default: __bad_pda_field(); \ 60 - } \ 49 + #define pda_to_op(op,field,val) do { \ 50 + typedef typeof(_proxy_pda.field) T__; \ 51 + if (0) { T__ tmp__; tmp__ = (val); } /* type checking */ \ 52 + switch (sizeof(_proxy_pda.field)) { \ 53 + case 2: \ 54 + asm(op "w %1,%%gs:%c2" : \ 55 + "+m" (_proxy_pda.field) : \ 56 + "ri" ((T__)val), \ 57 + "i"(pda_offset(field))); \ 58 + break; \ 59 + case 4: \ 60 + asm(op "l %1,%%gs:%c2" : \ 61 + "+m" (_proxy_pda.field) : \ 62 + "ri" ((T__)val), \ 63 + "i" (pda_offset(field))); \ 64 + break; \ 65 + case 8: \ 66 + asm(op "q %1,%%gs:%c2": \ 67 + "+m" (_proxy_pda.field) : \ 68 + "ri" ((T__)val), \ 69 + "i"(pda_offset(field))); \ 70 + break; \ 71 + default: \ 72 + __bad_pda_field(); \ 73 + } \ 61 74 } while (0) 62 75 63 - /* 64 - * AK: PDA read accesses should be neither volatile nor have an memory clobber. 65 - * Unfortunately removing them causes all hell to break lose currently. 66 - */ 67 - #define pda_from_op(op,field) ({ \ 68 - typeof_field(struct x8664_pda, field) ret__; \ 69 - switch (sizeof_field(struct x8664_pda, field)) { \ 70 - case 2: \ 71 - asm volatile(op "w %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ 72 - case 4: \ 73 - asm volatile(op "l %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ 74 - case 8: \ 75 - asm volatile(op "q %%gs:%P1,%0":"=r" (ret__):"i"(pda_offset(field)):"memory"); break;\ 76 - default: __bad_pda_field(); \ 77 - } \ 76 + #define pda_from_op(op,field) ({ \ 77 + typeof(_proxy_pda.field) ret__; \ 78 + switch (sizeof(_proxy_pda.field)) { \ 79 + case 2: \ 80 + asm(op "w %%gs:%c1,%0" : \ 81 + "=r" (ret__) : \ 82 + "i" (pda_offset(field)), \ 83 + "m" (_proxy_pda.field)); \ 84 + break; \ 85 + case 4: \ 86 + asm(op "l %%gs:%c1,%0": \ 87 + "=r" (ret__): \ 88 + "i" (pda_offset(field)), \ 89 + "m" (_proxy_pda.field)); \ 90 + break; \ 91 + case 8: \ 92 + asm(op "q %%gs:%c1,%0": \ 93 + "=r" (ret__) : \ 94 + "i" (pda_offset(field)), \ 95 + "m" (_proxy_pda.field)); \ 96 + break; \ 97 + default: \ 98 + __bad_pda_field(); \ 99 + } \ 78 100 ret__; }) 79 - 80 101 81 102 #define read_pda(field) pda_from_op("mov",field) 82 103 #define write_pda(field,val) pda_to_op("mov",field,val)
+10
include/asm-x86_64/percpu.h
··· 11 11 12 12 #include <asm/pda.h> 13 13 14 + #ifdef CONFIG_MODULES 15 + # define PERCPU_MODULE_RESERVE 8192 16 + #else 17 + # define PERCPU_MODULE_RESERVE 0 18 + #endif 19 + 20 + #define PERCPU_ENOUGH_ROOM \ 21 + (ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES) + \ 22 + PERCPU_MODULE_RESERVE) 23 + 14 24 #define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset) 15 25 #define __my_cpu_offset() read_pda(data_offset) 16 26
+3 -5
include/asm-x86_64/pgtable.h
··· 21 21 22 22 #define swapper_pg_dir init_level4_pgt 23 23 24 - extern int nonx_setup(char *str); 25 24 extern void paging_init(void); 26 25 extern void clear_kernel_mapping(unsigned long addr, unsigned long size); 27 - 28 - extern unsigned long pgkern_mask; 29 26 30 27 /* 31 28 * ZERO_PAGE is a global shared page that is always zero: used ··· 262 265 #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) 263 266 static inline int pte_user(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 264 267 static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 265 - static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; } 268 + static inline int pte_exec(pte_t pte) { return !(pte_val(pte) & _PAGE_NX); } 266 269 static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 267 270 static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 268 271 static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; } ··· 275 278 static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } 276 279 static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; } 277 280 static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } 278 - static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; } 281 + static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_NX)); return pte; } 279 282 static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 280 283 static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 281 284 static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } 282 285 static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_PSE)); return pte; } 286 + static inline pte_t pte_clrhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_PSE)); return pte; } 283 287 284 288 struct vm_area_struct; 285 289
+4 -11
include/asm-x86_64/proto.h
··· 51 51 extern int sysctl_vsyscall; 52 52 extern int nohpet; 53 53 extern unsigned long vxtime_hz; 54 + extern void time_init_gtod(void); 54 55 55 - extern int numa_setup(char *opt); 56 - 57 - extern int setup_early_printk(char *); 58 56 extern void early_printk(const char *fmt, ...) __attribute__((format(printf,1,2))); 59 57 60 58 extern void early_identify_cpu(struct cpuinfo_x86 *c); ··· 89 91 90 92 extern void setup_node_bootmem(int nodeid, unsigned long start, unsigned long end); 91 93 92 - extern void check_ioapic(void); 94 + extern void early_quirks(void); 93 95 extern void check_efer(void); 94 96 95 97 extern int unhandled_signal(struct task_struct *tsk, int sig); ··· 101 103 extern unsigned long table_start, table_end; 102 104 103 105 extern int exception_trace; 104 - extern int using_apic_timer; 105 - extern int disable_apic; 106 106 extern unsigned cpu_khz; 107 - extern int ioapic_force; 108 - extern int skip_ioapic_setup; 109 - extern int acpi_ht; 110 - extern int acpi_disabled; 111 107 112 108 extern void no_iommu_init(void); 113 109 extern int force_iommu, no_iommu; ··· 123 131 124 132 extern int reboot_force; 125 133 extern int notsc_setup(char *); 126 - extern int setup_additional_cpus(char *); 134 + 135 + extern int gsi_irq_sharing(int gsi); 127 136 128 137 extern void smp_local_timer_interrupt(struct pt_regs * regs); 129 138
+2 -62
include/asm-x86_64/rwlock.h
··· 18 18 #ifndef _ASM_X86_64_RWLOCK_H 19 19 #define _ASM_X86_64_RWLOCK_H 20 20 21 - #include <linux/stringify.h> 22 - 23 21 #define RW_LOCK_BIAS 0x01000000 24 - #define RW_LOCK_BIAS_STR "0x01000000" 22 + #define RW_LOCK_BIAS_STR "0x01000000" 25 23 26 - #define __build_read_lock_ptr(rw, helper) \ 27 - asm volatile(LOCK_PREFIX "subl $1,(%0)\n\t" \ 28 - "js 2f\n" \ 29 - "1:\n" \ 30 - LOCK_SECTION_START("") \ 31 - "2:\tcall " helper "\n\t" \ 32 - "jmp 1b\n" \ 33 - LOCK_SECTION_END \ 34 - ::"a" (rw) : "memory") 35 - 36 - #define __build_read_lock_const(rw, helper) \ 37 - asm volatile(LOCK_PREFIX "subl $1,%0\n\t" \ 38 - "js 2f\n" \ 39 - "1:\n" \ 40 - LOCK_SECTION_START("") \ 41 - "2:\tpushq %%rax\n\t" \ 42 - "leaq %0,%%rax\n\t" \ 43 - "call " helper "\n\t" \ 44 - "popq %%rax\n\t" \ 45 - "jmp 1b\n" \ 46 - LOCK_SECTION_END \ 47 - :"=m" (*((volatile int *)rw))::"memory") 48 - 49 - #define __build_read_lock(rw, helper) do { \ 50 - if (__builtin_constant_p(rw)) \ 51 - __build_read_lock_const(rw, helper); \ 52 - else \ 53 - __build_read_lock_ptr(rw, helper); \ 54 - } while (0) 55 - 56 - #define __build_write_lock_ptr(rw, helper) \ 57 - asm volatile(LOCK_PREFIX "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \ 58 - "jnz 2f\n" \ 59 - "1:\n" \ 60 - LOCK_SECTION_START("") \ 61 - "2:\tcall " helper "\n\t" \ 62 - "jmp 1b\n" \ 63 - LOCK_SECTION_END \ 64 - ::"a" (rw) : "memory") 65 - 66 - #define __build_write_lock_const(rw, helper) \ 67 - asm volatile(LOCK_PREFIX "subl $" RW_LOCK_BIAS_STR ",%0\n\t" \ 68 - "jnz 2f\n" \ 69 - "1:\n" \ 70 - LOCK_SECTION_START("") \ 71 - "2:\tpushq %%rax\n\t" \ 72 - "leaq %0,%%rax\n\t" \ 73 - "call " helper "\n\t" \ 74 - "popq %%rax\n\t" \ 75 - "jmp 1b\n" \ 76 - LOCK_SECTION_END \ 77 - :"=m" (*((volatile long *)rw))::"memory") 78 - 79 - #define __build_write_lock(rw, helper) do { \ 80 - if (__builtin_constant_p(rw)) \ 81 - __build_write_lock_const(rw, helper); \ 82 - else \ 83 - __build_write_lock_ptr(rw, helper); \ 84 - } while (0) 24 + /* Actual code is in asm/spinlock.h or in arch/x86_64/lib/rwlock.S */ 85 25 86 26 #endif
+3 -2
include/asm-x86_64/segment.h
··· 20 20 #define __USER_CS 0x33 /* 6*8+3 */ 21 21 #define __USER32_DS __USER_DS 22 22 23 - #define GDT_ENTRY_TLS 1 24 23 #define GDT_ENTRY_TSS 8 /* needs two entries */ 25 24 #define GDT_ENTRY_LDT 10 /* needs two entries */ 26 25 #define GDT_ENTRY_TLS_MIN 12 27 26 #define GDT_ENTRY_TLS_MAX 14 28 - /* 15 free */ 29 27 30 28 #define GDT_ENTRY_TLS_ENTRIES 3 29 + 30 + #define GDT_ENTRY_PER_CPU 15 /* Abused to load per CPU data from limit */ 31 + #define __PER_CPU_SEG (GDT_ENTRY_PER_CPU * 8 + 3) 31 32 32 33 /* TLS indexes for 64bit - hardcoded in arch_prctl */ 33 34 #define FS_TLS 0
+14 -26
include/asm-x86_64/semaphore.h
··· 107 107 __asm__ __volatile__( 108 108 "# atomic down operation\n\t" 109 109 LOCK_PREFIX "decl %0\n\t" /* --sem->count */ 110 - "js 2f\n" 111 - "1:\n" 112 - LOCK_SECTION_START("") 113 - "2:\tcall __down_failed\n\t" 114 - "jmp 1b\n" 115 - LOCK_SECTION_END 110 + "jns 1f\n\t" 111 + "call __down_failed\n" 112 + "1:" 116 113 :"=m" (sem->count) 117 114 :"D" (sem) 118 115 :"memory"); ··· 127 130 128 131 __asm__ __volatile__( 129 132 "# atomic interruptible down operation\n\t" 133 + "xorl %0,%0\n\t" 130 134 LOCK_PREFIX "decl %1\n\t" /* --sem->count */ 131 - "js 2f\n\t" 132 - "xorl %0,%0\n" 133 - "1:\n" 134 - LOCK_SECTION_START("") 135 - "2:\tcall __down_failed_interruptible\n\t" 136 - "jmp 1b\n" 137 - LOCK_SECTION_END 135 + "jns 2f\n\t" 136 + "call __down_failed_interruptible\n" 137 + "2:\n" 138 138 :"=a" (result), "=m" (sem->count) 139 139 :"D" (sem) 140 140 :"memory"); ··· 148 154 149 155 __asm__ __volatile__( 150 156 "# atomic interruptible down operation\n\t" 157 + "xorl %0,%0\n\t" 151 158 LOCK_PREFIX "decl %1\n\t" /* --sem->count */ 152 - "js 2f\n\t" 153 - "xorl %0,%0\n" 154 - "1:\n" 155 - LOCK_SECTION_START("") 156 - "2:\tcall __down_failed_trylock\n\t" 157 - "jmp 1b\n" 158 - LOCK_SECTION_END 159 + "jns 2f\n\t" 160 + "call __down_failed_trylock\n\t" 161 + "2:\n" 159 162 :"=a" (result), "=m" (sem->count) 160 163 :"D" (sem) 161 164 :"memory","cc"); ··· 170 179 __asm__ __volatile__( 171 180 "# atomic up operation\n\t" 172 181 LOCK_PREFIX "incl %0\n\t" /* ++sem->count */ 173 - "jle 2f\n" 174 - "1:\n" 175 - LOCK_SECTION_START("") 176 - "2:\tcall __up_wakeup\n\t" 177 - "jmp 1b\n" 178 - LOCK_SECTION_END 182 + "jg 1f\n\t" 183 + "call __up_wakeup\n" 184 + "1:" 179 185 :"=m" (sem->count) 180 186 :"D" (sem) 181 187 :"memory");
-4
include/asm-x86_64/signal.h
··· 24 24 } sigset_t; 25 25 26 26 27 - struct pt_regs; 28 - asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset); 29 - 30 - 31 27 #else 32 28 /* Here we must cater to libcs that poke about in kernel headers. */ 33 29
+8 -21
include/asm-x86_64/smp.h
··· 4 4 /* 5 5 * We need the APIC definitions automatically as part of 'smp.h' 6 6 */ 7 - #ifndef __ASSEMBLY__ 8 7 #include <linux/threads.h> 9 8 #include <linux/cpumask.h> 10 9 #include <linux/bitops.h> 11 10 extern int disable_apic; 12 - #endif 13 11 14 - #ifdef CONFIG_X86_LOCAL_APIC 15 - #ifndef __ASSEMBLY__ 16 12 #include <asm/fixmap.h> 17 13 #include <asm/mpspec.h> 18 - #ifdef CONFIG_X86_IO_APIC 19 14 #include <asm/io_apic.h> 20 - #endif 21 15 #include <asm/apic.h> 22 16 #include <asm/thread_info.h> 23 - #endif 24 - #endif 25 17 26 18 #ifdef CONFIG_SMP 27 - #ifndef ASSEMBLY 28 19 29 20 #include <asm/pda.h> 30 21 ··· 33 42 34 43 extern void smp_alloc_memory(void); 35 44 extern volatile unsigned long smp_invalidate_needed; 36 - extern int pic_mode; 37 45 extern void lock_ipi_call_lock(void); 38 46 extern void unlock_ipi_call_lock(void); 39 47 extern int smp_num_siblings; ··· 64 74 return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); 65 75 } 66 76 67 - extern int safe_smp_processor_id(void); 68 77 extern int __cpu_disable(void); 69 78 extern void __cpu_die(unsigned int cpu); 70 79 extern void prefill_possible_map(void); 71 80 extern unsigned num_processors; 72 81 extern unsigned disabled_cpus; 73 82 74 - #endif /* !ASSEMBLY */ 75 - 76 83 #define NO_PROC_ID 0xFF /* No processor magic marker */ 77 84 78 85 #endif 79 86 80 - #ifndef ASSEMBLY 81 87 /* 82 88 * Some lowlevel functions might want to know about 83 89 * the real APIC ID <-> CPU # mapping. ··· 95 109 return BAD_APICID; 96 110 } 97 111 98 - #endif /* !ASSEMBLY */ 99 - 100 112 #ifndef CONFIG_SMP 101 113 #define stack_smp_processor_id() 0 102 - #define safe_smp_processor_id() 0 103 114 #define cpu_logical_map(x) (x) 104 115 #else 105 116 #include <asm/thread_info.h> ··· 108 125 }) 109 126 #endif 110 127 111 - #ifndef __ASSEMBLY__ 112 128 static __inline int logical_smp_processor_id(void) 113 129 { 114 130 /* we don't want to mark this access volatile - bad code generation */ 115 131 return GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)); 116 132 } 117 - #endif 118 133 119 134 #ifdef CONFIG_SMP 120 135 #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] 121 136 #else 122 137 #define cpu_physical_id(cpu) boot_cpu_id 123 - #endif 124 - 138 + static inline int smp_call_function_single(int cpuid, void (*func) (void *info), 139 + void *info, int retry, int wait) 140 + { 141 + /* Disable interrupts here? */ 142 + func(info); 143 + return 0; 144 + } 145 + #endif /* !CONFIG_SMP */ 125 146 #endif 126 147
+40 -39
include/asm-x86_64/spinlock.h
··· 16 16 * (the type definitions are in asm/spinlock_types.h) 17 17 */ 18 18 19 - #define __raw_spin_is_locked(x) \ 20 - (*(volatile signed int *)(&(x)->slock) <= 0) 21 - 22 - #define __raw_spin_lock_string \ 23 - "\n1:\t" \ 24 - LOCK_PREFIX " ; decl %0\n\t" \ 25 - "js 2f\n" \ 26 - LOCK_SECTION_START("") \ 27 - "2:\t" \ 28 - "rep;nop\n\t" \ 29 - "cmpl $0,%0\n\t" \ 30 - "jle 2b\n\t" \ 31 - "jmp 1b\n" \ 32 - LOCK_SECTION_END 33 - 34 - #define __raw_spin_lock_string_up \ 35 - "\n\tdecl %0" 36 - 37 - #define __raw_spin_unlock_string \ 38 - "movl $1,%0" \ 39 - :"=m" (lock->slock) : : "memory" 19 + static inline int __raw_spin_is_locked(raw_spinlock_t *lock) 20 + { 21 + return *(volatile signed int *)(&(lock)->slock) <= 0; 22 + } 40 23 41 24 static inline void __raw_spin_lock(raw_spinlock_t *lock) 42 25 { 43 - asm volatile(__raw_spin_lock_string : "=m" (lock->slock) : : "memory"); 26 + asm volatile( 27 + "\n1:\t" 28 + LOCK_PREFIX " ; decl %0\n\t" 29 + "jns 2f\n" 30 + "3:\n" 31 + "rep;nop\n\t" 32 + "cmpl $0,%0\n\t" 33 + "jle 3b\n\t" 34 + "jmp 1b\n" 35 + "2:\t" : "=m" (lock->slock) : : "memory"); 44 36 } 45 37 46 38 #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) ··· 41 49 { 42 50 int oldval; 43 51 44 - __asm__ __volatile__( 52 + asm volatile( 45 53 "xchgl %0,%1" 46 54 :"=q" (oldval), "=m" (lock->slock) 47 55 :"0" (0) : "memory"); ··· 51 59 52 60 static inline void __raw_spin_unlock(raw_spinlock_t *lock) 53 61 { 54 - __asm__ __volatile__( 55 - __raw_spin_unlock_string 56 - ); 62 + asm volatile("movl $1,%0" :"=m" (lock->slock) :: "memory"); 57 63 } 58 64 59 - #define __raw_spin_unlock_wait(lock) \ 60 - do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) 65 + static inline void __raw_spin_unlock_wait(raw_spinlock_t *lock) 66 + { 67 + while (__raw_spin_is_locked(lock)) 68 + cpu_relax(); 69 + } 61 70 62 71 /* 63 72 * Read-write spinlocks, allowing multiple readers ··· 72 79 * 73 80 * On x86, we implement read-write locks as a 32-bit counter 74 81 * with the high bit (sign) being the "contended" bit. 75 - * 76 - * The inline assembly is non-obvious. Think about it. 77 - * 78 - * Changed to use the same technique as rw semaphores. See 79 - * semaphore.h for details. -ben 80 - * 81 - * the helpers are in arch/i386/kernel/semaphore.c 82 82 */ 83 83 84 - #define __raw_read_can_lock(x) ((int)(x)->lock > 0) 85 - #define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) 84 + static inline int __raw_read_can_lock(raw_rwlock_t *lock) 85 + { 86 + return (int)(lock)->lock > 0; 87 + } 88 + 89 + static inline int __raw_write_can_lock(raw_rwlock_t *lock) 90 + { 91 + return (lock)->lock == RW_LOCK_BIAS; 92 + } 86 93 87 94 static inline void __raw_read_lock(raw_rwlock_t *rw) 88 95 { 89 - __build_read_lock(rw, "__read_lock_failed"); 96 + asm volatile(LOCK_PREFIX "subl $1,(%0)\n\t" 97 + "jns 1f\n" 98 + "call __read_lock_failed\n" 99 + "1:\n" 100 + ::"D" (rw), "i" (RW_LOCK_BIAS) : "memory"); 90 101 } 91 102 92 103 static inline void __raw_write_lock(raw_rwlock_t *rw) 93 104 { 94 - __build_write_lock(rw, "__write_lock_failed"); 105 + asm volatile(LOCK_PREFIX "subl %1,(%0)\n\t" 106 + "jz 1f\n" 107 + "\tcall __write_lock_failed\n\t" 108 + "1:\n" 109 + ::"D" (rw), "i" (RW_LOCK_BIAS) : "memory"); 95 110 } 96 111 97 112 static inline int __raw_read_trylock(raw_rwlock_t *lock)
+18
include/asm-x86_64/stacktrace.h
··· 1 + #ifndef _ASM_STACKTRACE_H 2 + #define _ASM_STACKTRACE_H 1 3 + 4 + /* Generic stack tracer with callbacks */ 5 + 6 + struct stacktrace_ops { 7 + void (*warning)(void *data, char *msg); 8 + /* msg must contain %s for the symbol */ 9 + void (*warning_symbol)(void *data, char *msg, unsigned long symbol); 10 + void (*address)(void *data, unsigned long address); 11 + /* On negative return stop dumping */ 12 + int (*stack)(void *data, char *name); 13 + }; 14 + 15 + void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack, 16 + struct stacktrace_ops *ops, void *data); 17 + 18 + #endif
+3 -2
include/asm-x86_64/system.h
··· 14 14 #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" 15 15 16 16 /* frame pointer must be last for get_wchan */ 17 - #define SAVE_CONTEXT "pushq %%rbp ; movq %%rsi,%%rbp\n\t" 18 - #define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp\n\t" 17 + #define SAVE_CONTEXT "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t" 18 + #define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popf\t" 19 19 20 20 #define __EXTRA_CLOBBER \ 21 21 ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15" 22 22 23 + /* Save restore flags to clear handle leaking NT */ 23 24 #define switch_to(prev,next,last) \ 24 25 asm volatile(SAVE_CONTEXT \ 25 26 "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \
-1
include/asm-x86_64/tce.h
··· 24 24 #ifndef _ASM_X86_64_TCE_H 25 25 #define _ASM_X86_64_TCE_H 26 26 27 - extern void* tce_table_kva[]; 28 27 extern unsigned int specified_table_size; 29 28 struct iommu_table; 30 29
+1
include/asm-x86_64/therm_throt.h
··· 1 + #include <asm-i386/therm_throt.h>
+9
include/asm-x86_64/thread_info.h
··· 114 114 #define TIF_IRET 5 /* force IRET */ 115 115 #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ 116 116 #define TIF_SECCOMP 8 /* secure computing */ 117 + #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal */ 117 118 /* 16 free */ 118 119 #define TIF_IA32 17 /* 32bit process */ 119 120 #define TIF_FORK 18 /* ret_from_fork */ 120 121 #define TIF_ABI_PENDING 19 121 122 #define TIF_MEMDIE 20 123 + #define TIF_DEBUG 21 /* uses debug registers */ 124 + #define TIF_IO_BITMAP 22 /* uses I/O bitmap */ 122 125 123 126 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 124 127 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) ··· 131 128 #define _TIF_IRET (1<<TIF_IRET) 132 129 #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 133 130 #define _TIF_SECCOMP (1<<TIF_SECCOMP) 131 + #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 134 132 #define _TIF_IA32 (1<<TIF_IA32) 135 133 #define _TIF_FORK (1<<TIF_FORK) 136 134 #define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) 135 + #define _TIF_DEBUG (1<<TIF_DEBUG) 136 + #define _TIF_IO_BITMAP (1<<TIF_IO_BITMAP) 137 137 138 138 /* work to do on interrupt/exception return */ 139 139 #define _TIF_WORK_MASK \ 140 140 (0x0000FFFF & ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP|_TIF_SECCOMP)) 141 141 /* work to do on any return to user space */ 142 142 #define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) 143 + 144 + /* flags to check in __switch_to() */ 145 + #define _TIF_WORK_CTXSW (_TIF_DEBUG|_TIF_IO_BITMAP) 143 146 144 147 #define PREEMPT_ACTIVE 0x10000000 145 148
+33 -33
include/asm-x86_64/tlbflush.h
··· 4 4 #include <linux/mm.h> 5 5 #include <asm/processor.h> 6 6 7 - #define __flush_tlb() \ 8 - do { \ 9 - unsigned long tmpreg; \ 10 - \ 11 - __asm__ __volatile__( \ 12 - "movq %%cr3, %0; # flush TLB \n" \ 13 - "movq %0, %%cr3; \n" \ 14 - : "=r" (tmpreg) \ 15 - :: "memory"); \ 16 - } while (0) 7 + static inline unsigned long get_cr3(void) 8 + { 9 + unsigned long cr3; 10 + asm volatile("mov %%cr3,%0" : "=r" (cr3)); 11 + return cr3; 12 + } 17 13 18 - /* 19 - * Global pages have to be flushed a bit differently. Not a real 20 - * performance problem because this does not happen often. 21 - */ 22 - #define __flush_tlb_global() \ 23 - do { \ 24 - unsigned long tmpreg, cr4, cr4_orig; \ 25 - \ 26 - __asm__ __volatile__( \ 27 - "movq %%cr4, %2; # turn off PGE \n" \ 28 - "movq %2, %1; \n" \ 29 - "andq %3, %1; \n" \ 30 - "movq %1, %%cr4; \n" \ 31 - "movq %%cr3, %0; # flush TLB \n" \ 32 - "movq %0, %%cr3; \n" \ 33 - "movq %2, %%cr4; # turn PGE back on \n" \ 34 - : "=&r" (tmpreg), "=&r" (cr4), "=&r" (cr4_orig) \ 35 - : "i" (~X86_CR4_PGE) \ 36 - : "memory"); \ 37 - } while (0) 14 + static inline void set_cr3(unsigned long cr3) 15 + { 16 + asm volatile("mov %0,%%cr3" :: "r" (cr3) : "memory"); 17 + } 38 18 39 - extern unsigned long pgkern_mask; 19 + static inline void __flush_tlb(void) 20 + { 21 + set_cr3(get_cr3()); 22 + } 40 23 41 - #define __flush_tlb_all() __flush_tlb_global() 24 + static inline unsigned long get_cr4(void) 25 + { 26 + unsigned long cr4; 27 + asm volatile("mov %%cr4,%0" : "=r" (cr4)); 28 + return cr4; 29 + } 30 + 31 + static inline void set_cr4(unsigned long cr4) 32 + { 33 + asm volatile("mov %0,%%cr4" :: "r" (cr4) : "memory"); 34 + } 35 + 36 + static inline void __flush_tlb_all(void) 37 + { 38 + unsigned long cr4 = get_cr4(); 39 + set_cr4(cr4 & ~X86_CR4_PGE); /* clear PGE */ 40 + set_cr4(cr4); /* write old PGE again and flush TLBs */ 41 + } 42 42 43 43 #define __flush_tlb_one(addr) \ 44 - __asm__ __volatile__("invlpg %0": :"m" (*(char *) addr)) 44 + __asm__ __volatile__("invlpg (%0)" :: "r" (addr) : "memory") 45 45 46 46 47 47 /*
+35 -27
include/asm-x86_64/uaccess.h
··· 84 84 */ 85 85 86 86 #define __get_user_x(size,ret,x,ptr) \ 87 - __asm__ __volatile__("call __get_user_" #size \ 87 + asm volatile("call __get_user_" #size \ 88 88 :"=a" (ret),"=d" (x) \ 89 89 :"c" (ptr) \ 90 90 :"r8") ··· 101 101 case 8: __get_user_x(8,__ret_gu,__val_gu,ptr); break; \ 102 102 default: __get_user_bad(); break; \ 103 103 } \ 104 - (x) = (__typeof__(*(ptr)))__val_gu; \ 104 + (x) = (typeof(*(ptr)))__val_gu; \ 105 105 __ret_gu; \ 106 106 }) 107 107 ··· 112 112 extern void __put_user_bad(void); 113 113 114 114 #define __put_user_x(size,ret,x,ptr) \ 115 - __asm__ __volatile__("call __put_user_" #size \ 115 + asm volatile("call __put_user_" #size \ 116 116 :"=a" (ret) \ 117 117 :"c" (ptr),"d" (x) \ 118 118 :"r8") ··· 139 139 #define __put_user_check(x,ptr,size) \ 140 140 ({ \ 141 141 int __pu_err; \ 142 - __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ 142 + typeof(*(ptr)) __user *__pu_addr = (ptr); \ 143 143 switch (size) { \ 144 144 case 1: __put_user_x(1,__pu_err,x,__pu_addr); break; \ 145 145 case 2: __put_user_x(2,__pu_err,x,__pu_addr); break; \ ··· 173 173 * aliasing issues. 174 174 */ 175 175 #define __put_user_asm(x, addr, err, itype, rtype, ltype, errno) \ 176 - __asm__ __volatile__( \ 176 + asm volatile( \ 177 177 "1: mov"itype" %"rtype"1,%2\n" \ 178 178 "2:\n" \ 179 179 ".section .fixup,\"ax\"\n" \ ··· 193 193 int __gu_err; \ 194 194 unsigned long __gu_val; \ 195 195 __get_user_size(__gu_val,(ptr),(size),__gu_err); \ 196 - (x) = (__typeof__(*(ptr)))__gu_val; \ 196 + (x) = (typeof(*(ptr)))__gu_val; \ 197 197 __gu_err; \ 198 198 }) 199 199 ··· 217 217 } while (0) 218 218 219 219 #define __get_user_asm(x, addr, err, itype, rtype, ltype, errno) \ 220 - __asm__ __volatile__( \ 220 + asm volatile( \ 221 221 "1: mov"itype" %2,%"rtype"1\n" \ 222 222 "2:\n" \ 223 223 ".section .fixup,\"ax\"\n" \ ··· 237 237 */ 238 238 239 239 /* Handles exceptions in both to and from, but doesn't do access_ok */ 240 - extern unsigned long copy_user_generic(void *to, const void *from, unsigned len); 240 + __must_check unsigned long 241 + copy_user_generic(void *to, const void *from, unsigned len); 241 242 242 - extern unsigned long copy_to_user(void __user *to, const void *from, unsigned len); 243 - extern unsigned long copy_from_user(void *to, const void __user *from, unsigned len); 244 - extern unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len); 243 + __must_check unsigned long 244 + copy_to_user(void __user *to, const void *from, unsigned len); 245 + __must_check unsigned long 246 + copy_from_user(void *to, const void __user *from, unsigned len); 247 + __must_check unsigned long 248 + copy_in_user(void __user *to, const void __user *from, unsigned len); 245 249 246 - static __always_inline int __copy_from_user(void *dst, const void __user *src, unsigned size) 250 + static __always_inline __must_check 251 + int __copy_from_user(void *dst, const void __user *src, unsigned size) 247 252 { 248 - int ret = 0; 253 + int ret = 0; 249 254 if (!__builtin_constant_p(size)) 250 255 return copy_user_generic(dst,(__force void *)src,size); 251 256 switch (size) { ··· 277 272 } 278 273 } 279 274 280 - static __always_inline int __copy_to_user(void __user *dst, const void *src, unsigned size) 275 + static __always_inline __must_check 276 + int __copy_to_user(void __user *dst, const void *src, unsigned size) 281 277 { 282 - int ret = 0; 278 + int ret = 0; 283 279 if (!__builtin_constant_p(size)) 284 280 return copy_user_generic((__force void *)dst,src,size); 285 281 switch (size) { ··· 309 303 } 310 304 } 311 305 312 - 313 - static __always_inline int __copy_in_user(void __user *dst, const void __user *src, unsigned size) 306 + static __always_inline __must_check 307 + int __copy_in_user(void __user *dst, const void __user *src, unsigned size) 314 308 { 315 - int ret = 0; 309 + int ret = 0; 316 310 if (!__builtin_constant_p(size)) 317 311 return copy_user_generic((__force void *)dst,(__force void *)src,size); 318 312 switch (size) { ··· 350 344 } 351 345 } 352 346 353 - long strncpy_from_user(char *dst, const char __user *src, long count); 354 - long __strncpy_from_user(char *dst, const char __user *src, long count); 355 - long strnlen_user(const char __user *str, long n); 356 - long __strnlen_user(const char __user *str, long n); 357 - long strlen_user(const char __user *str); 358 - unsigned long clear_user(void __user *mem, unsigned long len); 359 - unsigned long __clear_user(void __user *mem, unsigned long len); 347 + __must_check long 348 + strncpy_from_user(char *dst, const char __user *src, long count); 349 + __must_check long 350 + __strncpy_from_user(char *dst, const char __user *src, long count); 351 + __must_check long strnlen_user(const char __user *str, long n); 352 + __must_check long __strnlen_user(const char __user *str, long n); 353 + __must_check long strlen_user(const char __user *str); 354 + __must_check unsigned long clear_user(void __user *mem, unsigned long len); 355 + __must_check unsigned long __clear_user(void __user *mem, unsigned long len); 360 356 361 - #define __copy_to_user_inatomic __copy_to_user 362 - #define __copy_from_user_inatomic __copy_from_user 357 + __must_check long __copy_from_user_inatomic(void *dst, const void __user *src, unsigned size); 358 + #define __copy_to_user_inatomic copy_user_generic 363 359 364 360 #endif /* __X86_64_UACCESS_H */
+3 -2
include/asm-x86_64/unistd.h
··· 600 600 #define __NR_faccessat 269 601 601 __SYSCALL(__NR_faccessat, sys_faccessat) 602 602 #define __NR_pselect6 270 603 - __SYSCALL(__NR_pselect6, sys_ni_syscall) /* for now */ 603 + __SYSCALL(__NR_pselect6, sys_pselect6) 604 604 #define __NR_ppoll 271 605 - __SYSCALL(__NR_ppoll, sys_ni_syscall) /* for now */ 605 + __SYSCALL(__NR_ppoll, sys_ppoll) 606 606 #define __NR_unshare 272 607 607 __SYSCALL(__NR_unshare, sys_unshare) 608 608 #define __NR_set_robust_list 273 ··· 658 658 #define __ARCH_WANT_SYS_SIGPENDING 659 659 #define __ARCH_WANT_SYS_SIGPROCMASK 660 660 #define __ARCH_WANT_SYS_RT_SIGACTION 661 + #define __ARCH_WANT_SYS_RT_SIGSUSPEND 661 662 #define __ARCH_WANT_SYS_TIME 662 663 #define __ARCH_WANT_COMPAT_SYS_TIME 663 664
+7 -2
include/asm-x86_64/unwind.h
··· 18 18 { 19 19 struct pt_regs regs; 20 20 struct task_struct *task; 21 + unsigned call_frame:1; 21 22 }; 22 23 23 24 #define UNW_PC(frame) (frame)->regs.rip ··· 58 57 PTREGS_INFO(r15), \ 59 58 PTREGS_INFO(rip) 60 59 60 + #define UNW_DEFAULT_RA(raItem, dataAlign) \ 61 + ((raItem).where == Memory && \ 62 + !((raItem).value * (dataAlign) + 8)) 63 + 61 64 static inline void arch_unw_init_frame_info(struct unwind_frame_info *info, 62 65 /*const*/ struct pt_regs *regs) 63 66 { ··· 99 94 100 95 #else 101 96 102 - #define UNW_PC(frame) ((void)(frame), 0) 103 - #define UNW_SP(frame) ((void)(frame), 0) 97 + #define UNW_PC(frame) ((void)(frame), 0UL) 98 + #define UNW_SP(frame) ((void)(frame), 0UL) 104 99 105 100 static inline int arch_unw_user_mode(const void *info) 106 101 {
+9
include/asm-x86_64/vsyscall.h
··· 4 4 enum vsyscall_num { 5 5 __NR_vgettimeofday, 6 6 __NR_vtime, 7 + __NR_vgetcpu, 7 8 }; 8 9 9 10 #define VSYSCALL_START (-10UL << 20) ··· 16 15 #include <linux/seqlock.h> 17 16 18 17 #define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16))) 18 + #define __section_vgetcpu_mode __attribute__ ((unused, __section__ (".vgetcpu_mode"), aligned(16))) 19 19 #define __section_wall_jiffies __attribute__ ((unused, __section__ (".wall_jiffies"), aligned(16))) 20 20 #define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16))) 21 21 #define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16))) ··· 27 25 #define VXTIME_TSC 1 28 26 #define VXTIME_HPET 2 29 27 #define VXTIME_PMTMR 3 28 + 29 + #define VGETCPU_RDTSCP 1 30 + #define VGETCPU_LSL 2 30 31 31 32 struct vxtime_data { 32 33 long hpet_address; /* HPET base address */ ··· 45 40 46 41 /* vsyscall space (readonly) */ 47 42 extern struct vxtime_data __vxtime; 43 + extern int __vgetcpu_mode; 48 44 extern struct timespec __xtime; 49 45 extern volatile unsigned long __jiffies; 50 46 extern unsigned long __wall_jiffies; ··· 54 48 55 49 /* kernel space (writeable) */ 56 50 extern struct vxtime_data vxtime; 51 + extern int vgetcpu_mode; 57 52 extern unsigned long wall_jiffies; 58 53 extern struct timezone sys_tz; 59 54 extern int sysctl_vsyscall; 60 55 extern seqlock_t xtime_lock; 61 56 62 57 extern int sysctl_vsyscall; 58 + 59 + extern void vsyscall_set_cpu(int cpu); 63 60 64 61 #define ARCH_HAVE_XTIME_LOCK 1 65 62
+1
include/linux/edd.h
··· 52 52 #define EDD_CL_EQUALS 0x3d646465 /* "edd=" */ 53 53 #define EDD_CL_OFF 0x666f /* "of" for off */ 54 54 #define EDD_CL_SKIP 0x6b73 /* "sk" for skipmbr */ 55 + #define EDD_CL_ON 0x6e6f /* "on" for on */ 55 56 56 57 #ifndef __ASSEMBLY__ 57 58
+16
include/linux/getcpu.h
··· 1 + #ifndef _LINUX_GETCPU_H 2 + #define _LINUX_GETCPU_H 1 3 + 4 + /* Cache for getcpu() to speed it up. Results might be upto a jiffie 5 + out of date, but will be faster. 6 + User programs should not refer to the contents of this structure. 7 + It is only a cache for vgetcpu(). It might change in future kernels. 8 + The user program must store this information per thread (__thread) 9 + If you want 100% accurate information pass NULL instead. */ 10 + struct getcpu_cache { 11 + unsigned long t0; 12 + unsigned long t1; 13 + unsigned long res[4]; 14 + }; 15 + 16 + #endif
+15
include/linux/jiffies.h
··· 115 115 ((long)(a) - (long)(b) >= 0)) 116 116 #define time_before_eq(a,b) time_after_eq(b,a) 117 117 118 + /* Same as above, but does so with platform independent 64bit types. 119 + * These must be used when utilizing jiffies_64 (i.e. return value of 120 + * get_jiffies_64() */ 121 + #define time_after64(a,b) \ 122 + (typecheck(__u64, a) && \ 123 + typecheck(__u64, b) && \ 124 + ((__s64)(b) - (__s64)(a) < 0)) 125 + #define time_before64(a,b) time_after64(b,a) 126 + 127 + #define time_after_eq64(a,b) \ 128 + (typecheck(__u64, a) && \ 129 + typecheck(__u64, b) && \ 130 + ((__s64)(a) - (__s64)(b) >= 0)) 131 + #define time_before_eq64(a,b) time_after_eq64(b,a) 132 + 118 133 /* 119 134 * Have the 32 bit jiffies value wrap 5 minutes after boot 120 135 * so jiffies wrap bugs show up earlier.
+1
include/linux/kernel.h
··· 187 187 extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ 188 188 extern int panic_timeout; 189 189 extern int panic_on_oops; 190 + extern int panic_on_unrecovered_nmi; 190 191 extern int tainted; 191 192 extern const char *print_tainted(void); 192 193 extern void add_taint(unsigned);
+5 -1
include/linux/linkage.h
··· 35 35 #endif 36 36 37 37 #define KPROBE_ENTRY(name) \ 38 - .section .kprobes.text, "ax"; \ 38 + .pushsection .kprobes.text, "ax"; \ 39 39 ENTRY(name) 40 + 41 + #define KPROBE_END(name) \ 42 + END(name); \ 43 + .popsection 40 44 41 45 #ifndef END 42 46 #define END(name) \
+14
include/linux/sched.h
··· 819 819 unsigned did_exec:1; 820 820 pid_t pid; 821 821 pid_t tgid; 822 + 823 + #ifdef CONFIG_CC_STACKPROTECTOR 824 + /* Canary value for the -fstack-protector gcc feature */ 825 + unsigned long stack_canary; 826 + #endif 822 827 /* 823 828 * pointers to (original) parent process, youngest child, younger sibling, 824 829 * older sibling, respectively. (p->father can be replaced with ··· 870 865 struct key *thread_keyring; /* keyring private to this thread */ 871 866 unsigned char jit_keyring; /* default keyring to attach requested keys to */ 872 867 #endif 868 + /* 869 + * fpu_counter contains the number of consecutive context switches 870 + * that the FPU is used. If this is over a threshold, the lazy fpu 871 + * saving becomes unlazy to save the trap. This is an unsigned char 872 + * so that after 256 times the counter wraps and the behavior turns 873 + * lazy again; this to deal with bursty apps that only use FPU for 874 + * a short time 875 + */ 876 + unsigned char fpu_counter; 873 877 int oomkilladj; /* OOM kill score adjustment (bit shift). */ 874 878 char comm[TASK_COMM_LEN]; /* executable name excluding path 875 879 - access with [gs]et_task_comm (which lock
+4 -3
include/linux/stacktrace.h
··· 5 5 struct stack_trace { 6 6 unsigned int nr_entries, max_entries; 7 7 unsigned long *entries; 8 + int skip; /* input argument: How many entries to skip */ 9 + int all_contexts; /* input argument: if true do than one stack */ 8 10 }; 9 11 10 12 extern void save_stack_trace(struct stack_trace *trace, 11 - struct task_struct *task, int all_contexts, 12 - unsigned int skip); 13 + struct task_struct *task); 13 14 14 15 extern void print_stack_trace(struct stack_trace *trace, int spaces); 15 16 #else 16 - # define save_stack_trace(trace, task, all, skip) do { } while (0) 17 + # define save_stack_trace(trace, task) do { } while (0) 17 18 # define print_stack_trace(trace) do { } while (0) 18 19 #endif 19 20
+2
include/linux/syscalls.h
··· 53 53 struct compat_stat; 54 54 struct compat_timeval; 55 55 struct robust_list_head; 56 + struct getcpu_cache; 56 57 57 58 #include <linux/types.h> 58 59 #include <linux/aio_abi.h> ··· 597 596 size_t __user *len_ptr); 598 597 asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, 599 598 size_t len); 599 + asmlinkage long sys_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *cache); 600 600 601 601 #endif
+2
include/linux/sysctl.h
··· 150 150 KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */ 151 151 KERN_COMPAT_LOG=73, /* int: print compat layer messages */ 152 152 KERN_MAX_LOCK_DEPTH=74, 153 + KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */ 154 + KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */ 153 155 }; 154 156 155 157
+2 -2
include/linux/vermagic.h
··· 24 24 #define VERMAGIC_STRING \ 25 25 UTS_RELEASE " " \ 26 26 MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ 27 - MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC \ 28 - "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__) 27 + MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC 28 +
+9 -5
init/main.c
··· 162 162 static int __init obsolete_checksetup(char *line) 163 163 { 164 164 struct obs_kernel_param *p; 165 + int had_early_param = 0; 165 166 166 167 p = __setup_start; 167 168 do { 168 169 int n = strlen(p->str); 169 170 if (!strncmp(line, p->str, n)) { 170 171 if (p->early) { 171 - /* Already done in parse_early_param? (Needs 172 - * exact match on param part) */ 172 + /* Already done in parse_early_param? 173 + * (Needs exact match on param part). 174 + * Keep iterating, as we can have early 175 + * params and __setups of same names 8( */ 173 176 if (line[n] == '\0' || line[n] == '=') 174 - return 1; 177 + had_early_param = 1; 175 178 } else if (!p->setup_func) { 176 179 printk(KERN_WARNING "Parameter %s is obsolete," 177 180 " ignored\n", p->str); ··· 184 181 } 185 182 p++; 186 183 } while (p < __setup_end); 187 - return 0; 184 + 185 + return had_early_param; 188 186 } 189 187 190 188 /* ··· 468 464 * Need to run as early as possible, to initialize the 469 465 * lockdep hash: 470 466 */ 467 + unwind_init(); 471 468 lockdep_init(); 472 469 473 470 local_irq_disable(); ··· 507 502 __stop___param - __start___param, 508 503 &unknown_bootoption); 509 504 sort_main_extable(); 510 - unwind_init(); 511 505 trap_init(); 512 506 rcu_init(); 513 507 init_IRQ();
+5
kernel/fork.c
··· 45 45 #include <linux/cn_proc.h> 46 46 #include <linux/delayacct.h> 47 47 #include <linux/taskstats_kern.h> 48 + #include <linux/random.h> 48 49 49 50 #include <asm/pgtable.h> 50 51 #include <asm/pgalloc.h> ··· 175 174 *tsk = *orig; 176 175 tsk->thread_info = ti; 177 176 setup_thread_stack(tsk, orig); 177 + 178 + #ifdef CONFIG_CC_STACKPROTECTOR 179 + tsk->stack_canary = get_random_int(); 180 + #endif 178 181 179 182 /* One for us, one for whoever does the "release_task()" (usually parent) */ 180 183 atomic_set(&tsk->usage,2);
+8 -1
kernel/lockdep.c
··· 224 224 trace->max_entries = MAX_STACK_TRACE_ENTRIES - nr_stack_trace_entries; 225 225 trace->entries = stack_trace + nr_stack_trace_entries; 226 226 227 - save_stack_trace(trace, NULL, 0, 3); 227 + trace->skip = 3; 228 + trace->all_contexts = 0; 229 + 230 + /* Make sure to not recurse in case the the unwinder needs to tak 231 + e locks. */ 232 + lockdep_off(); 233 + save_stack_trace(trace, NULL); 234 + lockdep_on(); 228 235 229 236 trace->max_entries = trace->nr_entries; 230 237
+13
kernel/panic.c
··· 21 21 #include <linux/debug_locks.h> 22 22 23 23 int panic_on_oops; 24 + int panic_on_unrecovered_nmi; 24 25 int tainted; 25 26 static int pause_on_oops; 26 27 static int pause_on_oops_flag; ··· 271 270 { 272 271 do_oops_enter_exit(); 273 272 } 273 + 274 + #ifdef CONFIG_CC_STACKPROTECTOR 275 + /* 276 + * Called when gcc's -fstack-protector feature is used, and 277 + * gcc detects corruption of the on-stack canary value 278 + */ 279 + void __stack_chk_fail(void) 280 + { 281 + panic("stack-protector: Kernel stack is corrupted"); 282 + } 283 + EXPORT_SYMBOL(__stack_chk_fail); 284 + #endif
+5
kernel/spinlock.c
··· 7 7 * 8 8 * This file contains the spinlock/rwlock implementations for the 9 9 * SMP and the DEBUG_SPINLOCK cases. (UP-nondebug inlines them) 10 + * 11 + * Note that some architectures have special knowledge about the 12 + * stack frames of these functions in their profile_pc. If you 13 + * change anything significant here that could change the stack 14 + * frame contact the architecture maintainers. 10 15 */ 11 16 12 17 #include <linux/linkage.h>
+31
kernel/sys.c
··· 28 28 #include <linux/tty.h> 29 29 #include <linux/signal.h> 30 30 #include <linux/cn_proc.h> 31 + #include <linux/getcpu.h> 31 32 32 33 #include <linux/compat.h> 33 34 #include <linux/syscalls.h> ··· 2062 2061 break; 2063 2062 } 2064 2063 return error; 2064 + } 2065 + 2066 + asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep, 2067 + struct getcpu_cache __user *cache) 2068 + { 2069 + int err = 0; 2070 + int cpu = raw_smp_processor_id(); 2071 + if (cpup) 2072 + err |= put_user(cpu, cpup); 2073 + if (nodep) 2074 + err |= put_user(cpu_to_node(cpu), nodep); 2075 + if (cache) { 2076 + /* 2077 + * The cache is not needed for this implementation, 2078 + * but make sure user programs pass something 2079 + * valid. vsyscall implementations can instead make 2080 + * good use of the cache. Only use t0 and t1 because 2081 + * these are available in both 32bit and 64bit ABI (no 2082 + * need for a compat_getcpu). 32bit has enough 2083 + * padding 2084 + */ 2085 + unsigned long t0, t1; 2086 + get_user(t0, &cache->t0); 2087 + get_user(t1, &cache->t1); 2088 + t0++; 2089 + t1++; 2090 + put_user(t0, &cache->t0); 2091 + put_user(t1, &cache->t1); 2092 + } 2093 + return err ? -EFAULT : 0; 2065 2094 }
+20 -3
kernel/sysctl.c
··· 76 76 77 77 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) 78 78 int unknown_nmi_panic; 79 - extern int proc_unknown_nmi_panic(ctl_table *, int, struct file *, 80 - void __user *, size_t *, loff_t *); 79 + int nmi_watchdog_enabled; 80 + extern int proc_nmi_enabled(struct ctl_table *, int , struct file *, 81 + void __user *, size_t *, loff_t *); 81 82 #endif 82 83 83 84 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ ··· 629 628 .data = &unknown_nmi_panic, 630 629 .maxlen = sizeof (int), 631 630 .mode = 0644, 632 - .proc_handler = &proc_unknown_nmi_panic, 631 + .proc_handler = &proc_dointvec, 632 + }, 633 + { 634 + .ctl_name = KERN_NMI_WATCHDOG, 635 + .procname = "nmi_watchdog", 636 + .data = &nmi_watchdog_enabled, 637 + .maxlen = sizeof (int), 638 + .mode = 0644, 639 + .proc_handler = &proc_nmi_enabled, 633 640 }, 634 641 #endif 635 642 #if defined(CONFIG_X86) 643 + { 644 + .ctl_name = KERN_PANIC_ON_NMI, 645 + .procname = "panic_on_unrecovered_nmi", 646 + .data = &panic_on_unrecovered_nmi, 647 + .maxlen = sizeof(int), 648 + .mode = 0644, 649 + .proc_handler = &proc_dointvec, 650 + }, 636 651 { 637 652 .ctl_name = KERN_BOOTLOADER_TYPE, 638 653 .procname = "bootloader_type",
+28 -7
kernel/unwind.c
··· 603 603 #define FRAME_REG(r, t) (((t *)frame)[reg_info[r].offs]) 604 604 const u32 *fde = NULL, *cie = NULL; 605 605 const u8 *ptr = NULL, *end = NULL; 606 + unsigned long pc = UNW_PC(frame) - frame->call_frame; 606 607 unsigned long startLoc = 0, endLoc = 0, cfa; 607 608 unsigned i; 608 609 signed ptrType = -1; ··· 613 612 614 613 if (UNW_PC(frame) == 0) 615 614 return -EINVAL; 616 - if ((table = find_table(UNW_PC(frame))) != NULL 615 + if ((table = find_table(pc)) != NULL 617 616 && !(table->size & (sizeof(*fde) - 1))) { 618 617 unsigned long tableSize = table->size; 619 618 ··· 648 647 ptrType & DW_EH_PE_indirect 649 648 ? ptrType 650 649 : ptrType & (DW_EH_PE_FORM|DW_EH_PE_signed)); 651 - if (UNW_PC(frame) >= startLoc && UNW_PC(frame) < endLoc) 650 + if (pc >= startLoc && pc < endLoc) 652 651 break; 653 652 cie = NULL; 654 653 } ··· 658 657 state.cieEnd = ptr; /* keep here temporarily */ 659 658 ptr = (const u8 *)(cie + 2); 660 659 end = (const u8 *)(cie + 1) + *cie; 660 + frame->call_frame = 1; 661 661 if ((state.version = *ptr) != 1) 662 662 cie = NULL; /* unsupported version */ 663 663 else if (*++ptr) { 664 664 /* check if augmentation size is first (and thus present) */ 665 665 if (*ptr == 'z') { 666 - /* check for ignorable (or already handled) 667 - * nul-terminated augmentation string */ 668 - while (++ptr < end && *ptr) 669 - if (strchr("LPR", *ptr) == NULL) 666 + while (++ptr < end && *ptr) { 667 + switch(*ptr) { 668 + /* check for ignorable (or already handled) 669 + * nul-terminated augmentation string */ 670 + case 'L': 671 + case 'P': 672 + case 'R': 673 + continue; 674 + case 'S': 675 + frame->call_frame = 0; 676 + continue; 677 + default: 670 678 break; 679 + } 680 + break; 681 + } 671 682 } 672 683 if (ptr >= end || *ptr) 673 684 cie = NULL; ··· 768 755 state.org = startLoc; 769 756 memcpy(&state.cfa, &badCFA, sizeof(state.cfa)); 770 757 /* process instructions */ 771 - if (!processCFI(ptr, end, UNW_PC(frame), ptrType, &state) 758 + if (!processCFI(ptr, end, pc, ptrType, &state) 772 759 || state.loc > endLoc 773 760 || state.regs[retAddrReg].where == Nowhere 774 761 || state.cfa.reg >= ARRAY_SIZE(reg_info) ··· 776 763 || state.cfa.offs % sizeof(unsigned long)) 777 764 return -EIO; 778 765 /* update frame */ 766 + #ifndef CONFIG_AS_CFI_SIGNAL_FRAME 767 + if(frame->call_frame 768 + && !UNW_DEFAULT_RA(state.regs[retAddrReg], state.dataAlign)) 769 + frame->call_frame = 0; 770 + #endif 779 771 cfa = FRAME_REG(state.cfa.reg, unsigned long) + state.cfa.offs; 780 772 startLoc = min((unsigned long)UNW_SP(frame), cfa); 781 773 endLoc = max((unsigned long)UNW_SP(frame), cfa); ··· 884 866 /*const*/ struct pt_regs *regs) 885 867 { 886 868 info->task = tsk; 869 + info->call_frame = 0; 887 870 arch_unw_init_frame_info(info, regs); 888 871 889 872 return 0; ··· 898 879 struct task_struct *tsk) 899 880 { 900 881 info->task = tsk; 882 + info->call_frame = 0; 901 883 arch_unw_init_blocked(info); 902 884 903 885 return 0; ··· 914 894 void *arg) 915 895 { 916 896 info->task = current; 897 + info->call_frame = 0; 917 898 918 899 return arch_unwind_init_running(info, callback, arg); 919 900 }
+1 -1
lib/Kconfig.debug
··· 225 225 bool 226 226 depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT 227 227 select STACKTRACE 228 - select FRAME_POINTER 228 + select FRAME_POINTER if !X86 229 229 select KALLSYMS 230 230 select KALLSYMS_ALL 231 231
+8 -2
lib/hweight.c
··· 1 1 #include <linux/module.h> 2 2 #include <asm/types.h> 3 + #include <asm/bitops.h> 3 4 4 5 /** 5 6 * hweightN - returns the hamming weight of a N-bit word ··· 41 40 #if BITS_PER_LONG == 32 42 41 return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w); 43 42 #elif BITS_PER_LONG == 64 43 + #ifdef ARCH_HAS_FAST_MULTIPLIER 44 + w -= (w >> 1) & 0x5555555555555555ul; 45 + w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul); 46 + w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful; 47 + return (w * 0x0101010101010101ul) >> 56; 48 + #else 44 49 __u64 res = w - ((w >> 1) & 0x5555555555555555ul); 45 50 res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul); 46 51 res = (res + (res >> 4)) & 0x0F0F0F0F0F0F0F0Ful; 47 52 res = res + (res >> 8); 48 53 res = res + (res >> 16); 49 54 return (res + (res >> 32)) & 0x00000000000000FFul; 50 - #else 51 - #error BITS_PER_LONG not defined 55 + #endif 52 56 #endif 53 57 } 54 58 EXPORT_SYMBOL(hweight64);
+7
scripts/Kbuild.include
··· 63 63 -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \ 64 64 else echo "$(2)"; fi ;) 65 65 66 + # as-instr 67 + # Usage: cflags-y += $(call as-instr, instr, option1, option2) 68 + 69 + as-instr = $(shell if echo -e "$(1)" | $(AS) >/dev/null 2>&1 -W -Z -o astest$$$$.out ; \ 70 + then echo "$(2)"; else echo "$(3)"; fi; \ 71 + rm -f astest$$$$.out) 72 + 66 73 # cc-option 67 74 # Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) 68 75
+6
scripts/gcc-x86_64-has-stack-protector.sh
··· 1 + #!/bin/sh 2 + 3 + echo "int foo(void) { char X[200]; return 3; }" | $1 -S -xc -c -O0 -mcmodel=kernel -fstack-protector - -o - 2> /dev/null | grep -q "%gs" 4 + if [ "$?" -eq "0" ] ; then 5 + echo $2 6 + fi